8170704: java/rmi/activation/Activatable/* tests fails intermittently with "output improperly annotated"
Reviewed-by: dfuchs, rriggs
This commit is contained in:
parent
9877170d02
commit
1dad4ab65f
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2016, 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
|
||||
@ -49,6 +49,7 @@ import java.util.StringTokenizer;
|
||||
public class CheckAnnotations
|
||||
extends Activatable implements MyRMI, Runnable
|
||||
{
|
||||
private static final double TIME_FACTOR = TestLibrary.getTimeoutFactor();
|
||||
|
||||
private static Object dummy = new Object();
|
||||
private static MyRMI myRMI = null;
|
||||
@ -111,9 +112,7 @@ public class CheckAnnotations
|
||||
for (int i = 0; i < 3; i++) {
|
||||
|
||||
// object activated in annotation check via method call
|
||||
if(!checkAnnotations(i-1)) {
|
||||
TestLibrary.bomb("Test failed: output improperly annotated.");
|
||||
}
|
||||
checkAnnotations(i-1);
|
||||
|
||||
/*
|
||||
* Clean up object too.
|
||||
@ -143,24 +142,27 @@ public class CheckAnnotations
|
||||
* check to make sure that the output from a spawned vm is
|
||||
* formatted/annotated properly.
|
||||
*/
|
||||
public static boolean checkAnnotations(int iteration)
|
||||
public static void checkAnnotations(int iteration)
|
||||
throws IOException
|
||||
{
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
Thread.sleep((long)(5000 * TIME_FACTOR));
|
||||
} catch(Exception e) {
|
||||
System.err.println(e.getMessage());
|
||||
}
|
||||
|
||||
final String FAIL_MSG = "Test failed: output improperly annotated.";
|
||||
final String OUT = "outABC";
|
||||
final String ERR = "errXYZ";
|
||||
/**
|
||||
* cause the spawned vm to generate output that will
|
||||
* be checked for proper annotation. printOut is
|
||||
* actually being called on an activated implementation.
|
||||
*/
|
||||
myRMI.printOut("out" + iteration);
|
||||
myRMI.printErr("err" + iteration);
|
||||
myRMI.printOut("out" + iteration);
|
||||
myRMI.printErr("err" + iteration);
|
||||
myRMI.printOut(OUT + iteration);
|
||||
myRMI.printErr(ERR + iteration);
|
||||
myRMI.printOut(OUT + iteration);
|
||||
myRMI.printErr(ERR + iteration);
|
||||
|
||||
/* we have to wait for output to filter down
|
||||
* from children so we can read it before we
|
||||
@ -174,7 +176,7 @@ public class CheckAnnotations
|
||||
// have to give output from rmid time to trickle down to
|
||||
// this process
|
||||
try {
|
||||
Thread.sleep(4000);
|
||||
Thread.sleep((long)(4000 * TIME_FACTOR));
|
||||
} catch(InterruptedException e) {
|
||||
}
|
||||
|
||||
@ -222,27 +224,24 @@ public class CheckAnnotations
|
||||
|
||||
if ((execErr == null)||(errTmp == null)||
|
||||
(destErr == null)) {
|
||||
return false;
|
||||
TestLibrary.bomb(FAIL_MSG);
|
||||
}
|
||||
if ((execOut == null)||(outTmp == null)||
|
||||
(destOut == null)) {
|
||||
return false;
|
||||
TestLibrary.bomb(FAIL_MSG);
|
||||
}
|
||||
|
||||
|
||||
// just make sure that last two strings are what we expect.
|
||||
if (execOut.equals("ExecGroup-" + iteration)
|
||||
&& (new String(destOut.substring(0,4)).equals("out" +
|
||||
if (!execOut.equals("ExecGroup-" + iteration)
|
||||
|| !(new String(destOut.substring(0,OUT.length()+1)).equals(OUT +
|
||||
iteration))
|
||||
&& (execErr.equals("ExecGroup-"+iteration))
|
||||
&& (new String(destErr.substring(0,4)).equals("err" +
|
||||
|| !(execErr.equals("ExecGroup-"+iteration))
|
||||
|| !(new String(destErr.substring(0,ERR.length()+1)).equals(ERR +
|
||||
iteration)) ) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
TestLibrary.bomb(FAIL_MSG);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// implementation of MyRMI, make this object activatable.
|
||||
|
Loading…
Reference in New Issue
Block a user