mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-20 02:54:35 +02:00
8078219: Verify lack of @test tag in files in java/net test directory
Reviewed-by: alanb
This commit is contained in:
parent
7d0d71db03
commit
a9f92bec7f
3 changed files with 75 additions and 75 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -22,76 +22,32 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
* @test
|
||||||
* @bug 4488458
|
* @bug 4488458
|
||||||
|
* @library /test/lib
|
||||||
* @summary Test that MutlicastSocket.joinGroup is working for
|
* @summary Test that MutlicastSocket.joinGroup is working for
|
||||||
* various multicast and non-multicast addresses.
|
* various multicast and non-multicast addresses.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import jdk.test.lib.NetworkConfiguration;
|
||||||
|
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class MulticastAddresses {
|
public class MulticastAddresses {
|
||||||
|
public static void runTest(NetworkInterface ni,
|
||||||
public static void main(String args[]) throws Exception {
|
String[] multicasts,
|
||||||
|
String[] nonMulticasts) throws Exception {
|
||||||
boolean ipv6_available = false;
|
|
||||||
NetworkInterface ni = null;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Examine the network interfaces and determine :-
|
|
||||||
*
|
|
||||||
* 1. If host has IPv6 support
|
|
||||||
* 2. Get reference to a non-loopback interface
|
|
||||||
*/
|
|
||||||
Enumeration nifs = NetworkInterface.getNetworkInterfaces();
|
|
||||||
while (nifs.hasMoreElements()) {
|
|
||||||
NetworkInterface this_ni = (NetworkInterface)nifs.nextElement();
|
|
||||||
|
|
||||||
Enumeration addrs = this_ni.getInetAddresses();
|
|
||||||
while (addrs.hasMoreElements()) {
|
|
||||||
InetAddress addr = (InetAddress)addrs.nextElement();
|
|
||||||
if (addr instanceof Inet6Address) {
|
|
||||||
ipv6_available = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!addr.isLoopbackAddress() && ni == null) {
|
|
||||||
ni = this_ni;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ipv6_available) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int failures = 0;
|
int failures = 0;
|
||||||
|
|
||||||
String multicasts[] = {
|
|
||||||
"224.80.80.80",
|
|
||||||
"ff01::1",
|
|
||||||
"ff02::1234",
|
|
||||||
"ff05::a",
|
|
||||||
"ff0e::1234:a" };
|
|
||||||
|
|
||||||
String non_multicasts[] = {
|
|
||||||
"129.1.1.1",
|
|
||||||
"::1",
|
|
||||||
"::129.1.1.1",
|
|
||||||
"fe80::a00:20ff:fee5:bc02" };
|
|
||||||
|
|
||||||
MulticastSocket s = new MulticastSocket();
|
MulticastSocket s = new MulticastSocket();
|
||||||
|
|
||||||
/* test valid multicast addresses */
|
/* test valid multicast addresses */
|
||||||
|
|
||||||
for (int i = 0; i < multicasts.length; i++) {
|
for (int i = 0; i < multicasts.length; i++) {
|
||||||
InetAddress ia = InetAddress.getByName(multicasts[i]);
|
InetAddress ia = InetAddress.getByName(multicasts[i]);
|
||||||
if (ia instanceof Inet6Address && !ipv6_available) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("Test: " + ia);
|
|
||||||
|
|
||||||
|
System.out.println("Test: " + ia + " " + " ni: " + ni);
|
||||||
try {
|
try {
|
||||||
|
|
||||||
System.out.print(" joinGroup(InetAddress) ");
|
System.out.print(" joinGroup(InetAddress) ");
|
||||||
|
@ -111,13 +67,8 @@ public class MulticastAddresses {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* test non-multicast addresses */
|
/* test non-multicast addresses */
|
||||||
|
for (int i = 0; i < nonMulticasts.length; i++) {
|
||||||
for (int i=0; i<non_multicasts.length; i++) {
|
InetAddress ia = InetAddress.getByName(nonMulticasts[i]);
|
||||||
InetAddress ia = InetAddress.getByName(non_multicasts[i]);
|
|
||||||
if (ia instanceof Inet6Address && !ipv6_available) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean failed = false;
|
boolean failed = false;
|
||||||
|
|
||||||
System.out.println("Test: " + ia + " ");
|
System.out.println("Test: " + ia + " ");
|
||||||
|
@ -130,20 +81,59 @@ public class MulticastAddresses {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println(" Passed: " + e.getMessage());
|
System.out.println(" Passed: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (failed) {
|
if (failed) {
|
||||||
s.leaveGroup(ia);
|
s.leaveGroup(ia);
|
||||||
failures++;
|
failures++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* done */
|
|
||||||
|
|
||||||
s.close();
|
s.close();
|
||||||
|
|
||||||
if (failures > 0) {
|
if (failures > 0) {
|
||||||
throw new Exception(failures + " test(s) failed - see log file.");
|
throw new Exception(failures + " test(s) failed - see log file.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String args[]) throws Exception {
|
||||||
|
|
||||||
|
String[] multicastIPv4 = {
|
||||||
|
"224.80.80.80",
|
||||||
|
};
|
||||||
|
String[] multicastIPv6 = {
|
||||||
|
"ff01::1",
|
||||||
|
"ff02::1234",
|
||||||
|
"ff05::a",
|
||||||
|
"ff0e::1234:a"};
|
||||||
|
|
||||||
|
String[] nonMulticastIPv4 = {
|
||||||
|
"129.1.1.1"
|
||||||
|
};
|
||||||
|
|
||||||
|
String[] nonMulticastIPv6 = {
|
||||||
|
"::1",
|
||||||
|
"::129.1.1.1",
|
||||||
|
"fe80::a00:20ff:fee5:bc02"};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Examine the network interfaces and determine :-
|
||||||
|
*
|
||||||
|
* 1. If host has IPv6 support
|
||||||
|
* 2. Get reference to a non-loopback interface
|
||||||
|
*/
|
||||||
|
NetworkConfiguration nc = NetworkConfiguration.probe();
|
||||||
|
var ipv6List = nc.ip6MulticastInterfaces(false)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
var ipv4List = nc.ip4MulticastInterfaces(false)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (ipv6List.retainAll(ipv4List)) {
|
||||||
|
runTest(ipv6List.get(0), multicastIPv4, nonMulticastIPv4);
|
||||||
|
runTest(ipv6List.get(0), multicastIPv6, nonMulticastIPv6);
|
||||||
|
} else {
|
||||||
|
if (!ipv4List.isEmpty())
|
||||||
|
runTest(ipv4List.get(0), multicastIPv4, nonMulticastIPv4);
|
||||||
|
if (!ipv6List.isEmpty())
|
||||||
|
runTest(ipv6List.get(0), multicastIPv6, nonMulticastIPv6);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -24,6 +24,11 @@
|
||||||
import java.net.MulticastSocket;
|
import java.net.MulticastSocket;
|
||||||
import java.net.BindException;
|
import java.net.BindException;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @test
|
||||||
|
* @summary Check if MulticastSocket sets SO_REUSEADDR
|
||||||
|
*/
|
||||||
|
|
||||||
public class Reuse {
|
public class Reuse {
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
MulticastSocket s1, s2;
|
MulticastSocket s1, s2;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -25,11 +25,16 @@ import java.net.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Regression test for URLClassLoader getURLs() and addURL() methods.
|
* @test
|
||||||
|
* @summary Regression test for URLClassLoader getURLs() and addURL() methods.
|
||||||
* See RFE 4102580: Need URLClassLoader.getURLs() method
|
* See RFE 4102580: Need URLClassLoader.getURLs() method
|
||||||
*/
|
*/
|
||||||
class GetURLsTest {
|
public class GetURLsTest {
|
||||||
|
static final String TEST_DIR = System.getProperty("test.src", ".");
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
File testJars = new File(TEST_DIR, "jars");
|
||||||
|
|
||||||
MyURLClassLoader ucl =
|
MyURLClassLoader ucl =
|
||||||
new MyURLClassLoader(new URL[] { new File(".").toURL() });
|
new MyURLClassLoader(new URL[] { new File(".").toURL() });
|
||||||
p("initial urls = ", ucl.getURLs());
|
p("initial urls = ", ucl.getURLs());
|
||||||
|
@ -37,7 +42,7 @@ class GetURLsTest {
|
||||||
if (u != null) {
|
if (u != null) {
|
||||||
p("found resource = " + u);
|
p("found resource = " + u);
|
||||||
}
|
}
|
||||||
ucl.addURL(new File("jars", "class_path_test.jar").toURL());
|
ucl.addURL(new File(testJars, "class_path_test.jar").toURL());
|
||||||
p("new urls = ", ucl.getURLs());
|
p("new urls = ", ucl.getURLs());
|
||||||
Class c = ucl.loadClass("Foo");
|
Class c = ucl.loadClass("Foo");
|
||||||
p("found class = " + c);
|
p("found class = " + c);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue