mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-11 23:48:38 +00:00
8380990: Update testng and junit tests to use diagnoseConfigurationIssue() method and post processing
Reviewed-by: dfuchs
This commit is contained in:
parent
cfae18fa60
commit
d7bace12ff
@ -37,12 +37,11 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.nio.charset.UnsupportedCharsetException;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import jtreg.SkippedException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.TestInstance;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
import org.opentest4j.TestAbortedException;
|
||||
|
||||
/*
|
||||
* @test
|
||||
@ -180,7 +179,7 @@ public class ReaderWriterTest {
|
||||
cs = Charset.forName(encoding);
|
||||
System.out.println("Charset: " + cs);
|
||||
} catch (UnsupportedCharsetException use) {
|
||||
throw new SkippedException("Charset not supported: " + encoding);
|
||||
throw new TestAbortedException("Charset not supported: " + encoding);
|
||||
}
|
||||
String cleanCSName = cleanCharsetName(cs);
|
||||
|
||||
|
||||
@ -87,8 +87,6 @@
|
||||
|
||||
import jdk.test.lib.RandomFactory;
|
||||
import jdk.test.lib.Platform;
|
||||
import jdk.test.lib.net.IPSupport;
|
||||
import jtreg.SkippedException;
|
||||
import org.testng.SkipException;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.DataProvider;
|
||||
@ -102,9 +100,11 @@ import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.MulticastSocket;
|
||||
import java.nio.channels.DatagramChannel;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
import static java.net.StandardSocketOptions.SO_RCVBUF;
|
||||
import static jdk.test.lib.net.IPSupport.diagnoseConfigurationIssue;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.expectThrows;
|
||||
@ -127,14 +127,11 @@ public class SendReceiveMaxSize {
|
||||
|
||||
@BeforeTest
|
||||
public void setUp() throws IOException {
|
||||
try {
|
||||
// This method throws jtreg.SkippedException, which is
|
||||
// interpreted as a test failure by testng
|
||||
IPSupport.throwSkippedExceptionIfNonOperational();
|
||||
} catch (SkippedException skip) {
|
||||
// throws the appropriate TestNG SkipException
|
||||
throw new SkipException(skip.getMessage(), skip);
|
||||
}
|
||||
Optional<String> configurationIssue = diagnoseConfigurationIssue();
|
||||
configurationIssue.map(SkipException::new).ifPresent(x -> {
|
||||
throw x;
|
||||
});
|
||||
|
||||
HOST_ADDR = PREFER_LOOPBACK ? InetAddress.getLoopbackAddress() : InetAddress.getLocalHost();
|
||||
BUF_LIMIT = (HOST_ADDR instanceof Inet6Address) ? IPV6_SNDBUF : IPV4_SNDBUF;
|
||||
System.out.printf("Host address: %s, Buffer limit: %d%n", HOST_ADDR, BUF_LIMIT);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,12 +32,15 @@
|
||||
*/
|
||||
|
||||
import java.net.*;
|
||||
import java.util.Optional;
|
||||
|
||||
import jdk.test.lib.net.IPSupport;
|
||||
import org.testng.SkipException;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static jdk.test.lib.net.IPSupport.diagnoseConfigurationIssue;
|
||||
|
||||
public class ToString {
|
||||
|
||||
private static final String loopbackAddr;
|
||||
@ -74,7 +77,10 @@ public class ToString {
|
||||
|
||||
@BeforeTest
|
||||
public void setup() {
|
||||
IPSupport.throwSkippedExceptionIfNonOperational();
|
||||
Optional<String> configurationIssue = diagnoseConfigurationIssue();
|
||||
configurationIssue.map(SkipException::new).ifPresent(x -> {
|
||||
throw x;
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -27,8 +27,10 @@ import java.net.MulticastSocket;
|
||||
import java.net.NetworkInterface;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import jdk.test.lib.NetworkConfiguration;
|
||||
import jdk.test.lib.net.IPSupport;
|
||||
import org.testng.SkipException;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Test;
|
||||
@ -36,6 +38,7 @@ import static java.lang.String.format;
|
||||
import static java.lang.System.out;
|
||||
import static java.net.StandardSocketOptions.IP_MULTICAST_IF;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import static jdk.test.lib.net.IPSupport.diagnoseConfigurationIssue;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
@ -53,7 +56,10 @@ public class IPMulticastIF {
|
||||
|
||||
@BeforeTest
|
||||
public void sanity() {
|
||||
IPSupport.throwSkippedExceptionIfNonOperational();
|
||||
Optional<String> configurationIssue = diagnoseConfigurationIssue();
|
||||
configurationIssue.map(SkipException::new).ifPresent(x -> {
|
||||
throw x;
|
||||
});
|
||||
NetworkConfiguration.printSystemConfiguration(out);
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -30,6 +30,7 @@
|
||||
* @run testng/othervm -Djava.net.preferIPv4Stack=true NetworkInterfaceStreamTest
|
||||
*/
|
||||
|
||||
import org.testng.SkipException;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@ -39,12 +40,13 @@ import java.net.SocketException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.OpTestCase;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.stream.TestData;
|
||||
|
||||
import jdk.test.lib.net.IPSupport;
|
||||
import static jdk.test.lib.net.IPSupport.diagnoseConfigurationIssue;
|
||||
|
||||
public class NetworkInterfaceStreamTest extends OpTestCase {
|
||||
|
||||
@ -52,7 +54,10 @@ public class NetworkInterfaceStreamTest extends OpTestCase {
|
||||
|
||||
@BeforeTest
|
||||
void setup() {
|
||||
IPSupport.throwSkippedExceptionIfNonOperational();
|
||||
Optional<String> configurationIssue = diagnoseConfigurationIssue();
|
||||
configurationIssue.map(SkipException::new).ifPresent(x -> {
|
||||
throw x;
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -31,8 +31,11 @@
|
||||
* @run testng/othervm -Djava.net.preferIPv4Stack=true NullMacAddress
|
||||
*/
|
||||
|
||||
import org.testng.SkipException;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static jdk.test.lib.net.IPSupport.diagnoseConfigurationIssue;
|
||||
import static org.testng.Assert.*;
|
||||
|
||||
import java.io.UncheckedIOException;
|
||||
@ -40,14 +43,17 @@ import java.math.BigInteger;
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
|
||||
import jdk.test.lib.net.IPSupport;
|
||||
|
||||
public class NullMacAddress {
|
||||
|
||||
@BeforeTest
|
||||
void setup() {
|
||||
IPSupport.throwSkippedExceptionIfNonOperational();
|
||||
Optional<String> configurationIssue = diagnoseConfigurationIssue();
|
||||
configurationIssue.map(SkipException::new).ifPresent(x -> {
|
||||
throw x;
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -33,18 +33,23 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.*;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import jdk.test.lib.net.IPSupport;
|
||||
|
||||
import org.testng.SkipException;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static jdk.test.lib.net.IPSupport.diagnoseConfigurationIssue;
|
||||
|
||||
public class ImmutableOptions {
|
||||
|
||||
@BeforeTest
|
||||
void setupServerSocketFactory() throws IOException {
|
||||
IPSupport.throwSkippedExceptionIfNonOperational();
|
||||
Optional<String> configurationIssue = diagnoseConfigurationIssue();
|
||||
configurationIssue.map(SkipException::new).ifPresent(x -> {
|
||||
throw x;
|
||||
});
|
||||
ServerSocket.setSocketFactory(new ServerSocketImplFactory());
|
||||
}
|
||||
|
||||
|
||||
@ -21,7 +21,6 @@
|
||||
* questions.
|
||||
*/
|
||||
import jdk.internal.net.http.quic.VariableLengthEncoder;
|
||||
import jtreg.SkippedException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
@ -31,9 +30,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
import org.opentest4j.TestAbortedException;
|
||||
|
||||
/*
|
||||
* @test
|
||||
@ -345,7 +344,7 @@ public class VariableLengthTest {
|
||||
case 2 -> ByteBuffer.allocate(capacity).putShort((short) length);
|
||||
case 4 -> ByteBuffer.allocate(capacity).putInt((int) length);
|
||||
case 8 -> ByteBuffer.allocate(capacity).putLong(length);
|
||||
default -> throw new SkippedException("bad value used for capacity");
|
||||
default -> throw new TestAbortedException("bad value used for capacity");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,9 +31,11 @@ import static java.net.spi.InetAddressResolver.LookupPolicy.IPV4;
|
||||
import static java.net.spi.InetAddressResolver.LookupPolicy.IPV4_FIRST;
|
||||
import static java.net.spi.InetAddressResolver.LookupPolicy.IPV6;
|
||||
import static java.net.spi.InetAddressResolver.LookupPolicy.IPV6_FIRST;
|
||||
import static jdk.test.lib.net.IPSupport.diagnoseConfigurationIssue;
|
||||
|
||||
import jdk.test.lib.net.IPSupport;
|
||||
import jdk.test.lib.NetworkConfiguration;
|
||||
import org.junit.jupiter.api.Assumptions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
@ -95,7 +97,7 @@ public class LookupPolicyMappingTest {
|
||||
|
||||
// Throws SkipException if platform doesn't support required IP address types
|
||||
static void checkPlatformNetworkConfiguration() {
|
||||
IPSupport.throwSkippedExceptionIfNonOperational();
|
||||
diagnoseConfigurationIssue().ifPresent(Assumptions::abort);
|
||||
IPSupport.printPlatformSupport(System.err);
|
||||
NetworkConfiguration.printSystemConfiguration(System.err);
|
||||
// If preferIPv4=true and no IPv4 - skip
|
||||
|
||||
@ -49,8 +49,11 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import static jdk.test.lib.net.IPSupport.diagnoseConfigurationIssue;
|
||||
|
||||
import jdk.test.lib.net.IPSupport;
|
||||
|
||||
import org.junit.jupiter.api.Assumptions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
@ -92,7 +95,8 @@ public class AfterDisconnect {
|
||||
|
||||
@Test
|
||||
public void execute() throws IOException {
|
||||
IPSupport.throwSkippedExceptionIfNonOperational();
|
||||
diagnoseConfigurationIssue().ifPresent(Assumptions::abort);
|
||||
|
||||
boolean preferIPv6 = Boolean.getBoolean("java.net.preferIPv6Addresses");
|
||||
InetAddress lb = InetAddress.getLoopbackAddress();
|
||||
|
||||
|
||||
@ -83,14 +83,14 @@ import static java.net.StandardProtocolFamily.INET;
|
||||
import static java.net.StandardProtocolFamily.INET6;
|
||||
import static java.net.StandardSocketOptions.SO_SNDBUF;
|
||||
import static java.net.StandardSocketOptions.SO_RCVBUF;
|
||||
import static jdk.test.lib.net.IPSupport.hasIPv4;
|
||||
import static jdk.test.lib.net.IPSupport.hasIPv6;
|
||||
import static jdk.test.lib.net.IPSupport.preferIPv4Stack;
|
||||
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
import org.junit.jupiter.api.Assumptions;
|
||||
|
||||
import static jdk.test.lib.net.IPSupport.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
@ -107,7 +107,7 @@ public class SendReceiveMaxSize {
|
||||
|
||||
@BeforeAll
|
||||
public static void setUp() {
|
||||
IPSupport.throwSkippedExceptionIfNonOperational();
|
||||
diagnoseConfigurationIssue().ifPresent(Assumptions::abort);
|
||||
}
|
||||
|
||||
public static List<Arguments> testCases() throws IOException {
|
||||
|
||||
@ -42,9 +42,9 @@ import java.util.Iterator;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.lang.System.out;
|
||||
|
||||
import static jdk.test.lib.net.IPSupport.*;
|
||||
|
||||
import jtreg.SkippedException;
|
||||
import org.junit.jupiter.api.Assumptions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
@ -56,12 +56,7 @@ public class LocalSocketAddressType {
|
||||
@BeforeAll()
|
||||
public static void setup() {
|
||||
IPSupport.printPlatformSupport(out);
|
||||
try {
|
||||
throwSkippedExceptionIfNonOperational();
|
||||
} catch (SkippedException skippedException) {
|
||||
// jtreg.SkippedException would cause a JUnit test to fail
|
||||
Assumptions.assumeTrue(false, skippedException.getMessage());
|
||||
}
|
||||
diagnoseConfigurationIssue().ifPresent(Assumptions::abort);
|
||||
}
|
||||
|
||||
public static Iterator<Object[]> addresses() throws Exception {
|
||||
|
||||
@ -42,7 +42,6 @@ import static java.net.StandardProtocolFamily.INET;
|
||||
import static java.net.StandardProtocolFamily.INET6;
|
||||
import static jdk.test.lib.net.IPSupport.*;
|
||||
|
||||
import jtreg.SkippedException;
|
||||
import org.junit.jupiter.api.Assumptions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
@ -89,12 +88,7 @@ public class OpenAndConnect {
|
||||
public static void setup() {
|
||||
NetworkConfiguration.printSystemConfiguration(out);
|
||||
IPSupport.printPlatformSupport(out);
|
||||
try {
|
||||
throwSkippedExceptionIfNonOperational();
|
||||
} catch (SkippedException skippedException) {
|
||||
// jtreg.SkippedException would cause a JUnit test to fail
|
||||
Assumptions.assumeTrue(false, skippedException.getMessage());
|
||||
}
|
||||
diagnoseConfigurationIssue().ifPresent(Assumptions::abort);
|
||||
|
||||
out.println("IA4LOCAL: " + IA4LOCAL);
|
||||
out.println("IA6LOCAL: " + IA6LOCAL);
|
||||
|
||||
@ -45,7 +45,6 @@ import static java.net.StandardProtocolFamily.INET;
|
||||
import static java.net.StandardProtocolFamily.INET6;
|
||||
import static jdk.test.lib.net.IPSupport.*;
|
||||
|
||||
import jtreg.SkippedException;
|
||||
import org.junit.jupiter.api.Assumptions;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -77,12 +76,7 @@ public class ProtocolFamilies {
|
||||
public static void setup() throws Exception {
|
||||
NetworkConfiguration.printSystemConfiguration(out);
|
||||
IPSupport.printPlatformSupport(out);
|
||||
try {
|
||||
throwSkippedExceptionIfNonOperational();
|
||||
} catch (SkippedException skippedException) {
|
||||
// jtreg.SkippedException would cause a JUnit test to fail
|
||||
Assumptions.assumeTrue(false, skippedException.getMessage());
|
||||
}
|
||||
diagnoseConfigurationIssue().ifPresent(Assumptions::abort);
|
||||
|
||||
ia4 = getLocalIPv4Address();
|
||||
ia6 = getLocalIPv6Address();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -29,8 +29,8 @@
|
||||
* @run junit/othervm --add-opens=java.base/java.text=ALL-UNNAMED CloneTest
|
||||
*/
|
||||
|
||||
import jtreg.SkippedException;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.opentest4j.TestAbortedException;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
@ -78,7 +78,7 @@ public class CloneTest {
|
||||
|
||||
digitListClass = digitList.getClass();
|
||||
} catch (ReflectiveOperationException e) {
|
||||
throw new SkippedException("reflective access in white-box test failed", e);
|
||||
throw new TestAbortedException("reflective access in white-box test failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ public class CloneTest {
|
||||
|
||||
assertEquals(digitListField.get(original), digitListField.get(dfClone));
|
||||
} catch (ReflectiveOperationException e) {
|
||||
throw new SkippedException("reflective access in white-box test failed", e);
|
||||
throw new TestAbortedException("reflective access in white-box test failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,7 +32,6 @@
|
||||
* @run testng/othervm -Djava.net.preferIPv4Stack=true AsynchronousSocketChannelNAPITest
|
||||
*/
|
||||
|
||||
import jdk.test.lib.net.IPSupport;
|
||||
import org.testng.SkipException;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
@ -44,7 +43,9 @@ import java.net.SocketException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.AsynchronousServerSocketChannel;
|
||||
import java.nio.channels.AsynchronousSocketChannel;
|
||||
import java.util.Optional;
|
||||
|
||||
import static jdk.test.lib.net.IPSupport.diagnoseConfigurationIssue;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertThrows;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
@ -59,7 +60,10 @@ public class AsynchronousSocketChannelNAPITest {
|
||||
|
||||
@BeforeTest
|
||||
public void setup() throws IOException {
|
||||
IPSupport.throwSkippedExceptionIfNonOperational();
|
||||
Optional<String> configurationIssue = diagnoseConfigurationIssue();
|
||||
configurationIssue.map(SkipException::new).ifPresent(x -> {
|
||||
throw x;
|
||||
});
|
||||
try (var sc = AsynchronousSocketChannel.open();
|
||||
var ssc = AsynchronousServerSocketChannel.open()) {
|
||||
if (!sc.supportedOptions().contains(SO_INCOMING_NAPI_ID)) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -31,7 +31,6 @@
|
||||
* @run testng/othervm -Djava.net.preferIPv4Stack=true DatagramChannelNAPITest
|
||||
*/
|
||||
|
||||
import jdk.test.lib.net.IPSupport;
|
||||
import org.testng.SkipException;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
@ -42,7 +41,9 @@ import java.net.InetSocketAddress;
|
||||
import java.net.SocketException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.DatagramChannel;
|
||||
import java.util.Optional;
|
||||
|
||||
import static jdk.test.lib.net.IPSupport.diagnoseConfigurationIssue;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertThrows;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
@ -56,7 +57,10 @@ public class DatagramChannelNAPITest {
|
||||
|
||||
@BeforeTest
|
||||
public void setup() throws IOException {
|
||||
IPSupport.throwSkippedExceptionIfNonOperational();
|
||||
Optional<String> configurationIssue = diagnoseConfigurationIssue();
|
||||
configurationIssue.map(SkipException::new).ifPresent(x -> {
|
||||
throw x;
|
||||
});
|
||||
try (var dc = DatagramChannel.open()) {
|
||||
if (!dc.supportedOptions().contains(SO_INCOMING_NAPI_ID)) {
|
||||
assertThrows(UOE, () -> dc.getOption(SO_INCOMING_NAPI_ID));
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -37,12 +37,13 @@ import java.net.DatagramPacket;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketException;
|
||||
import java.util.Optional;
|
||||
|
||||
import jdk.test.lib.net.IPSupport;
|
||||
import org.testng.SkipException;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static jdk.test.lib.net.IPSupport.diagnoseConfigurationIssue;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
import static org.testng.Assert.assertThrows;
|
||||
@ -56,7 +57,10 @@ public class DatagramSocketNAPITest {
|
||||
|
||||
@BeforeTest
|
||||
public void setup() throws IOException {
|
||||
IPSupport.throwSkippedExceptionIfNonOperational();
|
||||
Optional<String> configurationIssue = diagnoseConfigurationIssue();
|
||||
configurationIssue.map(SkipException::new).ifPresent(x -> {
|
||||
throw x;
|
||||
});
|
||||
try (var ds = new DatagramSocket()) {
|
||||
if (!ds.supportedOptions().contains(SO_INCOMING_NAPI_ID)) {
|
||||
assertThrows(UOE, () -> ds.getOption(SO_INCOMING_NAPI_ID));
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -32,7 +32,6 @@
|
||||
* @run testng/othervm -Djava.net.preferIPv4Stack=true SocketChannelNAPITest
|
||||
*/
|
||||
|
||||
import jdk.test.lib.net.IPSupport;
|
||||
import org.testng.SkipException;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
@ -44,7 +43,9 @@ import java.net.SocketException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.ServerSocketChannel;
|
||||
import java.nio.channels.SocketChannel;
|
||||
import java.util.Optional;
|
||||
|
||||
import static jdk.test.lib.net.IPSupport.diagnoseConfigurationIssue;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertThrows;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
@ -59,7 +60,10 @@ public class SocketChannelNAPITest {
|
||||
|
||||
@BeforeTest
|
||||
public void setup() throws IOException {
|
||||
IPSupport.throwSkippedExceptionIfNonOperational();
|
||||
Optional<String> configurationIssue = diagnoseConfigurationIssue();
|
||||
configurationIssue.map(SkipException::new).ifPresent(x -> {
|
||||
throw x;
|
||||
});
|
||||
try (var s = SocketChannel.open();
|
||||
var ssc = ServerSocketChannel.open()) {
|
||||
if (!s.supportedOptions().contains(SO_INCOMING_NAPI_ID)) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2026, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -41,12 +41,13 @@ import java.net.InetSocketAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.util.Optional;
|
||||
|
||||
import jdk.test.lib.net.IPSupport;
|
||||
import org.testng.SkipException;
|
||||
import org.testng.annotations.BeforeTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import static jdk.test.lib.net.IPSupport.diagnoseConfigurationIssue;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertThrows;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
@ -61,7 +62,10 @@ public class SocketNAPITest {
|
||||
|
||||
@BeforeTest
|
||||
public void setup() throws IOException {
|
||||
IPSupport.throwSkippedExceptionIfNonOperational();
|
||||
Optional<String> configurationIssue = diagnoseConfigurationIssue();
|
||||
configurationIssue.map(SkipException::new).ifPresent(x -> {
|
||||
throw x;
|
||||
});
|
||||
try (var s = new Socket();
|
||||
var ss = new ServerSocket()) {
|
||||
if (!s.supportedOptions().contains(SO_INCOMING_NAPI_ID)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user