Hi, I am writing some DACS API tests by following the java examples. Each test case creates a daemon connection, does something, then close the connection. All tests pass if I run them manually. But only the first test works if I run them together in a group. I did a lot debugging and found starting from the second test case, the agent.daemonConnectionState() is always "CONNECTION_DOWN" immediately after calling "createAuthorizationAgent". So the while loop checking for State "CONNECTION_PENDING" never gets executed. I feel like I might miss something when closing the daemonConnection of the first test case so the second tests (and others) never work. Interestingly, if I add a delay, then State will become "CONNECTION_PENDING". But we don't think this is a proper fix. Here is the snippet from my second test case. Thanks
// Create AuthorizationAgent
authorizationAgent = authorizationSystem.createAuthorizationAgent(_authorizationAgentName,true);
//The following line print the State is equal to "CONNECTION_DOWN"
//logger.info("Demon connection state is " + authorizationAgent.daemonConnectionState().toString());
//Thread.sleep(50) --> however if this delay is enabled, then the following State would work
while (authorizationAgent.daemonConnectionState() != AuthorizationConnection.CONNECTION_PENDING) {
try {
if (authorizationAgent.daemonConnectionState() == AuthorizationConnection.CONNECTION_UP) {
logger.info("Demon connection state is UP: " + authorizationAgent.daemonConnectionState().toString() );
}
else if (authorizationAgent.daemonConnectionState() == AuthorizationConnection.CONNECTION_DOWN) {
logger.info("Demon connection state is DOWN: " + authorizationAgent.daemonConnectionState().toString());
}
else if (authorizationAgent.daemonConnectionState() == AuthorizationConnection.CONNECTION_PENDING) {
logger.info("Demon connection state is CONNECTION_PENDING: " + authorizationAgent.daemonConnectionState().toString());
}
else {
logger.info("Demon connection state is UNKNOWN: " + authorizationAgent.daemonConnectionState().toString());
}
Thread.sleep(1);
}