Package org.serviceconnector.api.srv

Examples of org.serviceconnector.api.srv.SCSessionServer


      sc.setKeepAliveIntervalSeconds(10); // can be set before register
      sc.setImmediateConnect(true); // can be set before register
      sc.startListener(); // regular

      String serviceName = "session-1";
      SCSessionServer server = sc.newSessionServer(serviceName); // no other params possible
      int maxSess = 100;
      int maxConn = 10;
      SCSessionServerCallback cbk = newSrvCallback(server);
      try {
        server.register(maxSess, maxConn, cbk); // regular
        // server.registerServer(10, maxSess, maxConn, cbk); //
        // alternative with operation timeout
      } catch (Exception e) {
        LOGGER.error("runSessionServer", e);
        server.deregister();
        throw e;
      }
    } catch (Exception e) {
      LOGGER.error("runSessionServer", e);
      sc.stopListener();
View Full Code Here


      sc.setKeepAliveIntervalSeconds(10); // can be set before register
      sc.setImmediateConnect(true); // can be set before register
      sc.startListener(); // regular

      String serviceName = "session-1";
      SCSessionServer server = sc.newSessionServer(serviceName); // no other params possible
      int maxSess = 100;
      int maxConn = 10;
      SCSessionServerCallback cbk = newSessionSrvCallback(server);
      try {
        server.register(maxSess, maxConn, cbk); // regular
        // server.registerServer(10, maxSess, maxConn, cbk); //
        // alternative with operation timeout
      } catch (Exception e) {
        LOGGER.error("runSessionServer", e);
        server.deregister();
        throw e;
      }
    } catch (Exception e) {
      LOGGER.error("runSessionServer", e);
      sc.stopListener();
      sc.destroy();
    }

    try {
      String serviceName = "cacheGuardian1";
      SCPublishServer server = sc.newPublishServer(serviceName);
      int maxSess = 100;
      int maxConn = 10;
      SCPublishServerCallback cbk = newPublishSrvCallback(server);
      try {
        server.register(maxSess, maxConn, cbk); // regular
        // server.registerServer(10, maxSess, maxConn, cbk); //
        // alternative with operation timeout
      } catch (Exception e) {
        LOGGER.error("runSessionServer", e);
        server.deregister();
        throw e;
      }
    } catch (Exception e) {
      LOGGER.error("runSessionServer", e);
      sc.stopListener();
View Full Code Here

   * Description:  Create new session server<br>
   * Expectation:  server is not null
   */
  @Test
  public void t01_SessionServer() throws Exception {
    SCSessionServer sessionServer = server.newSessionServer(TestConstants.sesServiceName1);
    Assert.assertNotNull("Can not create SessionServer!", sessionServer);
  }
View Full Code Here

   * Description:  Invoke sessionServer.destroy()<br>
   * Expectation:  The SessionServer is destroyed.
   */
  @Test
  public void t02_SessionServer() throws Exception {
    SCSessionServer sessionServer = server.newSessionServer(TestConstants.sesServiceName1);
    Assert.assertNotNull("No SessionServer", sessionServer);
  }
View Full Code Here

   * Description:  Check the Host and Port<br>
   * Expectation:  The Host and Port have a value.
   */ 
  @Test
  public void t03_ServerHostPort() throws Exception {
    SCSessionServer sessionServer = server.newSessionServer(TestConstants.sesServiceName1);
    Assert.assertNotNull("Can not create SessionServer!", sessionServer);
    /* Cannot test interfaces, because they have dynamic values
    Assert.assertEquals("SessionServer Host", TestConstants.HOST, sessionServer.getListenerInterfaces());
    */
    Assert.assertEquals("SessionServer Port", TestConstants.PORT_SES_SRV_TCP, sessionServer.getListenerPort());
 
View Full Code Here

   * Description:  Check the SCHost and SCPort<br>
   * Expectation:  The SCHost and SCPort have a value.
   */ 
  @Test
  public void t04_SCHostPort() throws Exception  {
    SCSessionServer sessionServer = server.newSessionServer(TestConstants.sesServiceName1);
    Assert.assertNotNull("Can not create SessionServer!", sessionServer);
    Assert.assertEquals("SC Host", TestConstants.HOST, sessionServer.getSCHost());
    Assert.assertEquals("SC Port", TestConstants.PORT_SC0_TCP, sessionServer.getSCPort());
  }
View Full Code Here

      sc.setImmediateConnect(true);
      sc.startListener();

      String[] serviceNames = this.serviceNames.split(",");
      for (String serviceName : serviceNames) {
        SCSessionServer server = sc.newSessionServer(serviceName);
        SCSessionServerCallback cbk = new SrvCallback(server);
        try {
          server.register(10, this.maxSessions, this.maxConnections, cbk);
        } catch (Exception e) {
          LOGGER.error("runSessionServer", e);
          server.deregister();
        }
      }
      FileCtx fileCtx = FileUtility.createPIDfileAndLock(FileUtility.getLogPath() + fs + this.serverName + ".pid");
      // add exit handler
      try {
View Full Code Here

   */
  @Test
  public void t198_register() throws Exception {
    server = new SCServer(TestConstants.HOST, TestConstants.PORT_SC0_TCP, TestConstants.PORT_SES_SRV_TCP, ConnectionType.NETTY_TCP);
    server.startListener();
    SCSessionServer sessionServer1 = server.newSessionServer(TestConstants.sesServiceName1);
    SCSessionServerCallback cbk1 = new SesSrvCallback(sessionServer1);
    sessionServer1.register(1, 1, cbk1);
    Assert.assertEquals("SessionServer is not registered", true, sessionServer1.isRegistered());
   
    SCSessionServer sessionServer2 = server.newSessionServer(TestConstants.sesServiceName2);
    SCSessionServerCallback cbk2 = new SesSrvCallback(sessionServer2);
    sessionServer2.register(1, 1, cbk2);
    Assert.assertEquals("SessionServer is not registered", true, sessionServer2.isRegistered());
   
    sessionServer1.deregister();
    sessionServer2.deregister();
  }
View Full Code Here

   */
  @Test
  public void t199_register() throws Exception {
    server = new SCServer(TestConstants.HOST, TestConstants.PORT_SC0_TCP, TestConstants.PORT_SES_SRV_TCP, ConnectionType.NETTY_TCP);
    server.startListener();
    SCSessionServer sessionServer1 = server.newSessionServer(TestConstants.sesServiceName1);
    SCSessionServerCallback cbk = new SesSrvCallback(sessionServer1);
    sessionServer1.register(1, 1, cbk);
    Assert.assertEquals("SessionServer is not registered", true, sessionServer1.isRegistered());
   
    SCSessionServer sessionServer2 = server.newSessionServer(TestConstants.sesServiceName2);
    sessionServer2.register(1, 1, cbk);
    Assert.assertEquals("SessionServer is not registered", true, sessionServer2.isRegistered());
   
    sessionServer1.deregister();
    sessionServer2.deregister();
  }
View Full Code Here

   */
  @Test
  public void t298_register() throws Exception {
    server = new SCServer(TestConstants.HOST, TestConstants.PORT_SC0_HTTP, TestConstants.PORT_SES_SRV_HTTP, ConnectionType.NETTY_HTTP);
    server.startListener();
    SCSessionServer sessionServer1 = server.newSessionServer(TestConstants.sesServiceName1);
    SCSessionServerCallback cbk1 = new SesSrvCallback(sessionServer1);
    sessionServer1.register(1, 1, cbk1);
    Assert.assertEquals("SessionServer is not registered", true, sessionServer1.isRegistered());
   
    SCSessionServer sessionServer2 = server.newSessionServer(TestConstants.sesServiceName2);
    SCSessionServerCallback cbk2 = new SesSrvCallback(sessionServer2);
    sessionServer2.register(1, 1, cbk2);
    Assert.assertEquals("SessionServer is not registered", true, sessionServer2.isRegistered());
   
    sessionServer1.deregister();
    sessionServer2.deregister();
  }
View Full Code Here

TOP

Related Classes of org.serviceconnector.api.srv.SCSessionServer

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.