WSIFCorrelationServiceLocator.getCorrelationService();
assertTrue(cs == cs2);
try {
WSIFCorrelationId cid = new WSIFJMSCorrelationId("1");
cs.put(cid, "petra", (long) 0);
cid = new WSIFJMSCorrelationId("2");
cs.put(cid, "ant", (long) 0);
cid = new WSIFJMSCorrelationId("3");
cs2.put(cid, "tanya", 3000);
cid = new WSIFJMSCorrelationId("1");
String s = (String) cs.get(cid);
assertTrue(s.equals("petra"));
cid = new WSIFJMSCorrelationId("2");
s = (String) cs.get(cid);
assertTrue(s.equals("ant"));
cid = new WSIFJMSCorrelationId("3");
s = (String) cs.get(cid);
assertTrue(s.equals("tanya"));
System.out.println("\nwaiting for timeouts...");
try {
Thread.sleep(10000);
} catch (Exception ex) {
System.out.println("interupted early");
}
cid = new WSIFJMSCorrelationId("1");
s = (String) cs.get(cid);
assertTrue(s.equals("petra"));
cid = new WSIFJMSCorrelationId("2");
s = (String) cs.get(cid);
assertTrue(s.equals("ant"));
cid = new WSIFJMSCorrelationId("3");
s = (String) cs.get(cid);
assertTrue(s == null); // should have timed out
cid = new WSIFJMSCorrelationId("2");
cs.remove(cid);
cid = new WSIFJMSCorrelationId("1");
s = (String) cs.get(cid);
assertTrue(s.equals("petra"));
cid = new WSIFJMSCorrelationId("2");
s = (String) cs.get(cid);
assertTrue(s == null); // due to remove
// test primative clasess
Class[] clss =
new Class[] {
int.class,
float.class,
long.class,
double.class,
short.class,
byte.class,
boolean.class,
void.class };
Class[] clss2;
cid = new WSIFJMSCorrelationId("P1");
cs.put(cid, clss, (long) 0);
clss2 = (Class[]) cs.get(cid);
for (int i = 0; i < clss.length; i++) {
assertTrue(
"class " + clss[i] + " failed!!",