[8u] RFR 8151678: com/sun/jndi/ldap/LdapTimeoutTest.java failed due to timeout on DeadServerNoTimeoutTest is incorrect
Andrew Hughes
gnu.andrew at redhat.com
Mon Sep 7 06:10:57 UTC 2020
On 09:24 Sat 29 Aug , Zhengyu Gu wrote:
> I would like to backport this patch for parity with Oracle 8u271.
>
> The original patch does not apply cleanly. The conflicts on the fixes
> are minors, can be easily resolved manually.
>
> 1) LdapTimeoutTest.java is not in ProblemList.txt in 8u
> 2) Copyright lines in LdapTimeoutTest.java do not match
> 3) Import lines in BaseLdapServer.java do not match
>
>
> However, LdapTimeoutTest.java uses some new language features and APIs that
> do not exist in 8u. It also uses new test library that needs to map back to
> 8u test library.
>
> /*
> * @test
> - * @library /test/lib
> + * @library /lib/testlibrary
> * lib/
> * @run testng/othervm LdapTimeoutTest
> * @bug 7094377 8000487 6176036 7056489 8151678
> @@ -59,7 +59,7 @@
> import static java.lang.String.format;
> import static java.util.concurrent.TimeUnit.MILLISECONDS;
> import static java.util.concurrent.TimeUnit.NANOSECONDS;
> -import static jdk.test.lib.Utils.adjustTimeout;
> +import static jdk.testlibrary.Utils.adjustTimeout;
> import static org.testng.Assert.assertTrue;
> import static org.testng.Assert.expectThrows;
>
> @@ -120,7 +120,7 @@
> executorService.shutdown();
> }
> int failedCount = 0;
> - for (var f : futures) {
> + for (Future f : futures) {
> try {
> f.get();
> } catch (ExecutionException e) {
> @@ -283,11 +283,14 @@
>
> @Override
> protected void beforeAcceptingConnections() {
> - starting.completeAsync(() -> null);
> + CompletableFuture.supplyAsync(() -> null)
> + .whenComplete((input, exception) -> {
> + starting.complete(null);
> + });
> }
>
> public CompletableFuture<Void> starting() {
> - return starting.copy();
> + return starting.toCompletableFuture();
> }
> }
>
> Test:
> jdk_other
>
> Thanks,
>
> -Zhengyu
>
There seem to be a couple of additional copyright header changes in
this backport, in
src/share/classes/com/sun/jndi/ldap/DefaultLdapDnsProvider.java and
src/share/classes/com/sun/jndi/ldap/LdapDnsProviderService.java. Where
do these come from?
With the changes to LdapTimeoutTest.java, .copy() is not the same
as .toCompletableFuture(), as the former creates a new CompleteableFuture
(via newInCompleteFuture(), another 9u addition) that relays the
result of the original, while the latter would appear to be just the
same as returning starting directly. A closer equivalent would appear
to be starting.thenApply((x) -> x), as suggested in the documentation of
copy().
Do the amended tests complete successfully?
Thanks,
--
Andrew :)
Senior Free Java Software Engineer
OpenJDK Package Owner
Red Hat, Inc. (http://www.redhat.com)
PGP Key: ed25519/0xCFDA0F9B35964222 (hkp://keys.gnupg.net)
Fingerprint = 5132 579D D154 0ED2 3E04 C5A0 CFDA 0F9B 3596 4222
More information about the jdk8u-dev
mailing list