Package org.serviceconnector.api.cln

Examples of org.serviceconnector.api.cln.SCMgmtClient


   * Description: get SCVersion<br>
   * Expectation: passes
   */
  @Test
  public void t20_getSCVersion() throws Exception {
    client = new SCMgmtClient(TestConstants.HOST, TestConstants.PORT_SC0_TCP, ConnectionType.NETTY_TCP);
    client.attach();
    Assert.assertEquals("ScVersion not equal", SCVersion.CURRENT.toString(), client.getSCVersion());
    client.detach();
  }
View Full Code Here


  }
 
  public void setUpClientToSC() throws Exception {
    if (client == null) {  // client may be already created and attached because the of the class hierarchy
      if (cascadingLevel == 0) {
        client = new SCMgmtClient(TestConstants.HOST, TestConstants.PORT_SC0_TCP, ConnectionType.NETTY_TCP);
        client.attach();
      } else if (cascadingLevel == 1) {
        client = new SCMgmtClient(TestConstants.HOST, TestConstants.PORT_SC1_TCP, ConnectionType.NETTY_TCP);
        client.attach();
      } else if (cascadingLevel == 2) {
        client = new SCMgmtClient(TestConstants.HOST, TestConstants.PORT_SC2_TCP, ConnectionType.NETTY_TCP);
        client.attach();
      }
    }
  }
View Full Code Here

    try {
      if (FileUtility.exists(scProcess.getPidFileName())) {
        // file exists
        if (FileUtility.isFileLocked(scProcess.getPidFileName())) {
          // file is locked - SC is running
          SCMgmtClient client = new SCMgmtClient(TestConstants.HOST, scProcess.getSCPort(), ConnectionType.NETTY_TCP);
          client.attach(timeout);
          client.killSC();
        }
        FileUtility.waitNotExistsOrUnlocked(scProcess.getPidFileName(), timeout);
      }
      testLogger.info(scProcess.getProcessName() + " stopped");
    } catch (Exception e) {
View Full Code Here

  public void stopServer(ProcessCtx srvProcess) throws Exception {
    int timeout = 15; // seconds
    try {
      if (FileUtility.exists(srvProcess.getPidFileName())) {
        SCMgmtClient clientMgmt = new SCMgmtClient(TestConstants.HOST, srvProcess.getSCPort(),
            srvProcess.getConnectionType());
        clientMgmt.attach(timeout);
        String serviceName = srvProcess.getServiceNames().split(",")[0];
        clientMgmt.enableService(serviceName); // service might be disabled during tests
        if (srvProcess.getCommunicatorType() == TestConstants.COMMUNICATOR_TYPE_SESSION) {
          // Create session with KILL command
          SCSessionService scSessionService = clientMgmt.newSessionService(serviceName);
          SCMessage scMessage = new SCMessage();
          scMessage.setSessionInfo(TestConstants.killServerCmd);
          try {
            scSessionService.createSession(scMessage, new TestSessionServiceMessageCallback(scSessionService));
          } catch (SCServiceException ex) {
          }
        } else {
          // Subscribe with KILL command
          SCPublishService scPublishService = clientMgmt.newPublishService(serviceName);
          SCSubscribeMessage scMessage = new SCSubscribeMessage();
          SCMessageCallback cbk = new TestPublishServiceMessageCallback(scPublishService);
          scMessage.setSessionInfo(TestConstants.killServerCmd);
          scMessage.setMask("ABCD"); // dummy (mask may not be empty)
          try {
            scPublishService.subscribe(scMessage, cbk);
          } catch (SCServiceException ex) {
          }
        }
        clientMgmt.detach();
        FileUtility.waitNotExistsOrUnlocked(srvProcess.getPidFileName(), timeout);
      }
      testLogger.info("Server " + srvProcess.getProcessName() + " stopped");
    } catch (Exception e) {
      testLogger.info(e.getMessage());
View Full Code Here

TOP

Related Classes of org.serviceconnector.api.cln.SCMgmtClient

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.