Package org.serviceconnector.api

Examples of org.serviceconnector.api.SCMessage


   * Description: Delete session on service which has been disabled<br>
   * Expectation: passes
   */
  @Test
  public void t91_disabledService() throws Exception {
    SCMessage request = new SCMessage();
    SCMessage response = null;
    sessionService1 = client.newSessionService(TestConstants.sesServiceName1);
    msgCallback1 = new MsgCallback(sessionService1);
    response = sessionService1.createSession(request, msgCallback1);
    Assert.assertNotNull("the session ID is null", sessionService1.getSessionId());

View Full Code Here


   * Description: Delete session twice<br>
   * Expectation: passes
   */
  @Test
  public void t92_deleteSessionTwice() throws Exception {
    SCMessage request = new SCMessage();
    SCMessage response = null;
    sessionService1 = client.newSessionService(TestConstants.sesServiceName1);
    msgCallback1 = new MsgCallback(sessionService1);
    response = sessionService1.createSession(request, msgCallback1);
    Assert.assertNotNull("the session ID is null", sessionService1.getSessionId());
    sessionService1.deleteSession();
View Full Code Here

  public void t34_cc_2Clients2Server1Cache() throws Exception {
    // 1: connect new client2 to top level (cascaded) SC
    SCClient client2 = new SCClient(TestConstants.HOST, sessionClient.getPort(), ConnectionType.NETTY_TCP);
    client2.attach();
    SCSessionService sessionService2 = client2.newSessionService(TestConstants.sesServiceName1);
    sessionService2.createSession(new SCMessage(), new SessionMsgCallback(sessionService2));

    // 2: load data to cache (cid=700) by client1
    SCMessage request = new SCMessage();
    request.setData("cacheFor1Hour_managedData");
    request.setCacheId("700");
    request.setMessageInfo(TestConstants.cacheCmd);
    sessionService1.execute(request);

    // 3: start cache guardian1 - publish 3 large appendix
    SCSubscribeMessage subMsg = new SCSubscribeMessage();
    subMsg.setMask(TestConstants.mask);
View Full Code Here

  public void t34_cc_2Clients2Server1Cache30000Msgs() throws Exception {
    // 1: connect new client2 to top level (cascaded) SC
    SCClient client2 = new SCClient(TestConstants.HOST, sessionClient.getPort(), ConnectionType.NETTY_TCP);
    client2.attach();
    SCSessionService sessionService2 = client2.newSessionService(TestConstants.sesServiceName1);
    sessionService2.createSession(new SCMessage(), new SessionMsgCallback(sessionService2));

    // 2: load data to cache (cid=700) by client1
    SCMessage request = new SCMessage();
    request.setData("cacheFor1Hour_managedData");
    request.setCacheId("700");
    request.setMessageInfo(TestConstants.cacheCmd);
    sessionService1.execute(request);

    // 3: start cache guardian1
    SCSubscribeMessage subMsg = new SCSubscribeMessage();
    subMsg.setMask(TestConstants.mask);
View Full Code Here

   * Expectation: passes
   */
  @Test
  public void t50_cc_cachedFlag() throws Exception {
    // 1: load data to cache (cid=700)
    SCMessage request = new SCMessage();
    request.setCacheId("700");
    request.setData("cacheFor1Hour_managedData");
    request.setMessageInfo(TestConstants.cacheCmd);
    sessionService1.execute(request);

    // 2: start cache guardian - publish 3 Appendix
    SCSubscribeMessage subMsg = new SCSubscribeMessage();
    subMsg.setMask(TestConstants.mask);
    subMsg.setSessionInfo(TestConstants.publish3AppendixMsgCmd);
    subMsg.setData("700");
    guardianClient.startCacheGuardian(TestConstants.cacheGuardian1, subMsg, cacheGuardianCbk);

    // 3: verify callback retrieval - 3 appendix within 10sec
    cacheGuardianCbk.waitForAppendMessage(3, 10);

    // 4: read data from cache and verify
    SCMessage response = sessionService1.execute(request);
    this.checkAppendices(response, 3);
    Assert.assertTrue("cached flag wrong value", response.isCached());
    SCManagedMessage managedMessage = (SCManagedMessage) response;
    Assert.assertTrue("cached flag wrong value", managedMessage.getAppendixes().get(0).isCached());
    Assert.assertTrue("cached flag wrong value", managedMessage.getAppendixes().get(1).isCached());
    Assert.assertTrue("cached flag wrong value", managedMessage.getAppendixes().get(2).isCached());
  }
View Full Code Here

   * Expectation: passes
   */
  @Test
  public void t01_cc_expirationOfInitialData() throws Exception {
    // 1: load initial data to cache (cid=700) 2 seconds expiration
    SCMessage request = new SCMessage();
    request.setCacheId("700");
    request.setData("cacheFor2Sec_managedData");
    request.setMessageInfo(TestConstants.cacheCmd);
    sessionService1.execute(request);

    // 2: wait until expiration time runs out
    Thread.sleep(2000);

View Full Code Here

   * Expectation: passes
   */
  @Test
  public void t02_cc_expirationOfInitialDataAndAppendix() throws Exception {
    // 1: load initial data to cache (cid=700) 4 seconds expiration
    SCMessage request = new SCMessage();
    request.setCacheId("700");
    request.setData("cacheFor4Sec_managedData");
    request.setMessageInfo(TestConstants.cacheCmd);
    sessionService1.execute(request);

    // 2: start cache guardian - publish 3 Appendix
    SCSubscribeMessage subMsg = new SCSubscribeMessage();
    subMsg.setMask(TestConstants.mask);
View Full Code Here

   * Expectation: passes
   */
  @Test
  public void t03_cc_initialDataRemove() throws Exception {
    // 1: load initial data to cache (cid=700)
    SCMessage request = new SCMessage();
    request.setCacheId("700");
    request.setData("managedData");
    request.setMessageInfo(TestConstants.cacheCmd);
    sessionService1.execute(request);

    // 2: verify data is in top level cache
    Map<String, String> inspectResponse = mgmtClient.inspectCache("700");
    this.checkCacheInspectString(inspectResponse, "success", SC_CACHE_ENTRY_STATE.LOADED, "700", "0", "700/0/0=0&", "unset");
View Full Code Here

   * Expectation: passes
   */
  @Test
  public void t04_cc_initialData3LargeAppendixRemove() throws Exception {
    // 1: load initial data to cache (cid=700) 2 seconds expiration
    SCMessage request = new SCMessage();
    request.setCacheId("700");
    request.setData("managedData");
    request.setMessageInfo(TestConstants.cacheCmd);
    sessionService1.execute(request);

    // 2: verify data is in top level cache
    Map<String, String> inspectResponse = mgmtClient.inspectCache("700");
    this.checkCacheInspectString(inspectResponse, "success", SC_CACHE_ENTRY_STATE.LOADED, "700", "0", "700/0/0=0&", "unset");
View Full Code Here

   * Expectation: passes
   */
  @Test
  public void t05_cc_initialLargeDataReplaceByInitialData() throws Exception {
    // 1: load initial data to cache (cid=700)
    SCMessage request = new SCMessage();
    request.setCacheId("700");
    request.setData("cache10MBStringFor1Hour_managedData");
    request.setMessageInfo(TestConstants.cacheCmd);
    sessionService1.execute(request);

    // 2: verify data is in top level cache
    Map<String, String> inspectResponse = mgmtClient.inspectCache("700");
    this.checkCacheInspectString(inspectResponse, "success", SC_CACHE_ENTRY_STATE.LOADED, "700", "0", "700/0/0=51&", "unset");
View Full Code Here

TOP

Related Classes of org.serviceconnector.api.SCMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.