* instances<br>
* Expectation: get messages from cache
*/
@Test
public void t10_2ClientsGetDifferentCacheMessage() throws Exception {
SCMessage request = new SCMessage();
request.setCompressed(false);
SCMessage response = null;
// session service one stores "cacheFor1Hour" with cacheId 700
sessionService1 = client.newSessionService(TestConstants.sesServiceName1);
msgCallback1 = new MsgCallback(sessionService1);
response = sessionService1.createSession(request, msgCallback1);
request.setData("cacheFor1Hour");
request.setCacheId("700");
request.setMessageInfo(TestConstants.cacheCmd);
response = sessionService1.execute(request);
Assert.assertEquals("cacheFor1Hour", response.getData());
// session service two stores "cacheFor2Hour" with cacheId 600
SCSessionService sessionService2 = client.newSessionService(TestConstants.sesServiceName1);
MsgCallback msgCallback2 = new MsgCallback(sessionService1);
response = sessionService2.createSession(request, msgCallback2);
request.setData("cacheFor2Hour");
request.setCacheId("600");
response = sessionService2.execute(request);
Assert.assertEquals("cacheFor2Hour", response.getData());
// session service one gets message with cacheId 700
request.setData(TestConstants.pangram);
request.setCacheId("700");
request.setMessageInfo(TestConstants.cacheCmd);
response = sessionService1.execute(request);
Assert.assertEquals("cacheFor1Hour", response.getData());
Assert.assertEquals("700", response.getCacheId());
Assert.assertEquals("2", response.getCachePartNr());
// session service two gets message with cacheId 600
request.setData(TestConstants.pangram);
request.setCacheId("600");
request.setMessageInfo(TestConstants.cacheCmd);
response = sessionService2.execute(request);
Assert.assertEquals("cacheFor2Hour", response.getData());
Assert.assertEquals("600", response.getCacheId());
Assert.assertEquals("2", response.getCachePartNr());
// session service one gets message with cacheId 600
request.setData(TestConstants.pangram);
request.setCacheId("600");
request.setMessageInfo(TestConstants.cacheCmd);
response = sessionService1.execute(request);
Assert.assertEquals("cacheFor2Hour", response.getData());
Assert.assertEquals("600", response.getCacheId());
Assert.assertEquals("2", response.getCachePartNr());
// session service two gets message with cacheId 700
request.setData(TestConstants.pangram);
request.setCacheId("700");
request.setMessageInfo(TestConstants.cacheCmd);
response = sessionService2.execute(request);
Assert.assertEquals("cacheFor1Hour", response.getData());
Assert.assertEquals("700", response.getCacheId());
Assert.assertEquals("2", response.getCachePartNr());
sessionService2.deleteSession();
sessionService1.deleteSession();
}