Package com.linkedin.databus.client.pub

Examples of com.linkedin.databus.client.pub.ServerInfo


          String bsServerInfo = ckpt.getBootstrapServerInfo();

          if ((null != bsServerInfo) && (null != _serverInfo))
          {
            ServerInfo expServerInfo = null;
            try
            {
              expServerInfo = ServerInfo.buildServerInfoFromHostPort(bsServerInfo.trim(),DbusConstants.HOSTPORT_DELIMITER);
            } catch (Exception ex) {
              LOG.error("Unable to fetch ServerInfo from ckpt. Passed ServerInfo was :" + bsServerInfo.trim());
View Full Code Here


        }
        if ( null != host )
        {
          int port = _bootstrapServer.getHttpPort();
          _serverHostPort = host + DbusConstants.HOSTPORT_DELIMITER + port;
          ServerInfo serverInfo = null;
          try {
            serverInfo = ServerInfo.buildServerInfoFromHostPort(_serverHostPort, DbusConstants.HOSTPORT_DELIMITER);
          } catch (Exception e) {
            LOG.error("Unable to build serverInfo from string (" + _serverHostPort +")", e);
          }
View Full Code Here

    ServerInfoBuilder relayConfigBuilder = rtConfigBuilder.getRelay(Integer.toString(id));
    relayConfigBuilder.setName(name);
    relayConfigBuilder.setHost(addr.getHostName());
    relayConfigBuilder.setPort(addr.getPort());
    relayConfigBuilder.setSources(sources);
    ServerInfo si = relayConfigBuilder.build();
    client.getClientConfigManager().setNewConfig(rtConfigBuilder.build());
    return si;
  }
View Full Code Here

  @Override
  public boolean matches(Object o)
  {
    boolean success = true;

    ServerInfo serverInfo = null;
    if (success) success = o instanceof ServerInfo;
    if (success) serverInfo = (ServerInfo)o;

    int serverIdx = -1;
    if (success)
View Full Code Here

    ServerInfoBuilder relayConfigBuilder = rtConfigBuilder.getRelay(Integer.toString(id));
    relayConfigBuilder.setName(name);
    relayConfigBuilder.setHost(addr.getHostName());
    relayConfigBuilder.setPort(addr.getPort());
    relayConfigBuilder.setSources(sources);
    ServerInfo si = relayConfigBuilder.build();
    client.getClientConfigManager().setNewConfig(rtConfigBuilder.build());
    return si;
  }
View Full Code Here

    throws Exception
  {
    // Server-Set Change TestCases
    {
      Set<ServerInfo> expServerInfo = new TreeSet<ServerInfo>();
      expServerInfo.add(new ServerInfo("relay1", "ONLINE", new InetSocketAddress("localhost",10001),"source1"));
      expServerInfo.add(new ServerInfo("relay2","ONLINE"new InetSocketAddress("localhost",10002),"source1"));
      expServerInfo.add(new ServerInfo("relay3","ONLINE", new InetSocketAddress("localhost",10003),"source1"));

      Set<ServerInfo> expServerInfo2 = new TreeSet<ServerInfo>(expServerInfo);
      expServerInfo2.add(new ServerInfo("relay4","ONLINE", new InetSocketAddress("localhost",10000),"source1"));

      Set<ServerInfo> expServerInfo3 = new TreeSet<ServerInfo>();
      expServerInfo3.add(new ServerInfo("relay4","ONLINE", new InetSocketAddress("localhost",10000),"source1"));


      // when on PICK_SERVER
      {
        RelayPullThreadBuilder bldr = new RelayPullThreadBuilder(false, false);
        RelayPullThread relayPuller = bldr.createRelayPullThread();

        relayPuller.getComponentStatus().start();
        ConnectionState connState = relayPuller.getConnectionState();
        connState.switchToPickServer();
        relayPuller.enqueueMessage(connState);

        // ServerSetChange
        {
          Assert.assertEquals(relayPuller.getCurrentServerIdx(), -1, "Current Server Index");
          Assert.assertEquals(relayPuller.getCurentServer() == null, true, "Current Server Null");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(true, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx(), -1, "Current Server Index");
          Assert.assertEquals(relayPuller.getCurentServer() == null, true, "Current Server Null");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.PICK_SERVER, "ServerSetChange while Pick_Server");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: [PICK_SERVER]", "Queue :ServerSetChange while Pick_Server");
        }

      }

      // When on Request_Sources
      {
        RelayPullThreadBuilder bldr = new RelayPullThreadBuilder(false, false);
        RelayPullThread relayPuller = bldr.createFellOffRelayPullThread();

        relayPuller.getComponentStatus().start();
        ConnectionState connState = relayPuller.getConnectionState();
        connState.switchToPickServer();
        testTransitionCase(relayPuller, StateId.PICK_SERVER, StateId.REQUEST_SOURCES);

        // ServerSetChange when New Set includes CurrentServer
        {
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer() != null, true, "Current Server not Null");
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(true, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.REQUEST_SOURCES, "ServerSetChange while REQUEST_SOURCES");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: [REQUEST_SOURCES]", "Queue :ServerSetChange while REQUEST_SOURCES");
        }

        // ServerSetChange when New Set excludes CurrentServer
        {
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(false, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx() == -1, true, "Current Server Index undefined");
          Assert.assertEquals(relayPuller.getCurentServer() == null, true, "Current Server Null");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo3,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.PICK_SERVER, "ServerSetChange while REQUEST_SOURCES");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: [PICK_SERVER]", "Queue :ServerSetChange while REQUEST_SOURCES");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), false, "Relay FellOff CHeck");
        }
      }

      // When on SOURCES-REQUEST-SENT and Response Successful
      {
        RelayPullThreadBuilder bldr = new RelayPullThreadBuilder(false, true);
        RelayPullThread relayPuller = bldr.createFellOffRelayPullThread();
        relayPuller.getComponentStatus().start();
        ConnectionState connState = relayPuller.getConnectionState();
        connState.switchToPickServer();
        testTransitionCase(relayPuller, StateId.PICK_SERVER, StateId.REQUEST_SOURCES);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_SOURCES, StateId.SOURCES_REQUEST_SENT, "");

        // ServerSetChange when New Set includes CurrentServer
        {
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer() != null, true, "Current Server not Null");
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(true, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.SOURCES_REQUEST_SENT, "ServerSetChange while SOURCES_REQUEST_SENT");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: []", "Queue :ServerSetChange while SOURCES_REQUEST_SENT");
        }

        // ServerSetChange when New Set excludes CurrentServer and SuccessFul Response
        {
          int oldServerIndex = relayPuller.getCurrentServerIdx();
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(false, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx(), oldServerIndex, "Current Server Index unchanged");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo3,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), true, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.SOURCES_REQUEST_SENT, "ServerSetChange while REQUEST_SOURCES");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: []", "Queue :ServerSetChange while REQUEST_SOURCES");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), true, "Relay FellOff Check");

          // Now Response arrives
          List<IdNamePair> sourcesResponse = new ArrayList<IdNamePair>();
          sourcesResponse.add(new IdNamePair(1L, "source1"));
          connState.switchToSourcesSuccess(sourcesResponse, _HOSTNAME, _SVCNAME);
          testTransitionCase(relayPuller, StateId.SOURCES_RESPONSE_SUCCESS, StateId.PICK_SERVER);
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(relayPuller.getCurrentServerIdx() == -1, true, "Current Server Index undefined");
          Assert.assertEquals(relayPuller.getCurentServer() == null, true, "Current Server Null");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), false, "Relay FellOff CHeck");
          validateConnState(connState);
        }
      }

      // When on SOURCES-REQUEST-SENT and SOURCES_RESPONSE_ERROR
      {
        RelayPullThreadBuilder bldr = new RelayPullThreadBuilder(false, true);
        RelayPullThread relayPuller = bldr.createFellOffRelayPullThread();
        relayPuller.getComponentStatus().start();
        ConnectionState connState = relayPuller.getConnectionState();
        connState.switchToPickServer();
        testTransitionCase(relayPuller, StateId.PICK_SERVER, StateId.REQUEST_SOURCES);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_SOURCES, StateId.SOURCES_REQUEST_SENT, "");

        // ServerSetChange when New Set includes CurrentServer
        {
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer() != null, true, "Current Server not Null");
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(true, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.SOURCES_REQUEST_SENT, "ServerSetChange while SOURCES_REQUEST_SENT");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: []", "Queue :ServerSetChange while SOURCES_REQUEST_SENT");
        }

        // ServerSetChange when New Set excludes CurrentServer and SOURCES_RESPONSE_ERROR
        {
          int oldServerIndex = relayPuller.getCurrentServerIdx();
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(false, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx(), oldServerIndex, "Current Server Index unchanged");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo3,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), true, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.SOURCES_REQUEST_SENT, "ServerSetChange while REQUEST_SOURCES");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: []", "Queue :ServerSetChange while REQUEST_SOURCES");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), true, "Relay FellOff CHeck");

          // Now Response arrives
          List<IdNamePair> sourcesResponse = new ArrayList<IdNamePair>();
          sourcesResponse.add(new IdNamePair(1L, "source1"));
          connState.switchToSourcesResponseError();
          testTransitionCase(relayPuller, StateId.SOURCES_RESPONSE_ERROR, StateId.PICK_SERVER);
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(relayPuller.getCurrentServerIdx() == -1, true, "Current Server Index undefined");
          Assert.assertEquals(relayPuller.getCurentServer() == null, true, "Current Server Null");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), false, "Relay FellOff CHeck");
        }
      }

      // When on SOURCES-REQUEST-SENT and SOURCES_REQUEST_ERROR
      {
        RelayPullThreadBuilder bldr = new RelayPullThreadBuilder(false, true);
        RelayPullThread relayPuller = bldr.createFellOffRelayPullThread();
        relayPuller.getComponentStatus().start();
        ConnectionState connState = relayPuller.getConnectionState();
        connState.switchToPickServer();
        testTransitionCase(relayPuller, StateId.PICK_SERVER, StateId.REQUEST_SOURCES);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_SOURCES, StateId.SOURCES_REQUEST_SENT, "");

        // ServerSetChange when New Set includes CurrentServer
        {
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer() != null, true, "Current Server not Null");
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(true, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.SOURCES_REQUEST_SENT, "ServerSetChange while SOURCES_REQUEST_SENT");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: []", "Queue :ServerSetChange while SOURCES_REQUEST_SENT");
        }

        // ServerSetChange when New Set excludes CurrentServer and SOURCES_REQUEST_ERROR
        {
          int oldServerIndex = relayPuller.getCurrentServerIdx();
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(false, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx(), oldServerIndex, "Current Server Index unchanged");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo3,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), true, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.SOURCES_REQUEST_SENT, "ServerSetChange while REQUEST_SOURCES");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: []", "Queue :ServerSetChange while REQUEST_SOURCES");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), true, "Relay FellOff CHeck");

          // Now Response arrives
          List<IdNamePair> sourcesResponse = new ArrayList<IdNamePair>();
          sourcesResponse.add(new IdNamePair(1L, "source1"));
          connState.switchToSourcesRequestError();
          testTransitionCase(relayPuller, StateId.SOURCES_REQUEST_ERROR, StateId.PICK_SERVER);
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(relayPuller.getCurrentServerIdx() == -1, true, "Current Server Index undefined");
          Assert.assertEquals(relayPuller.getCurentServer() == null, true, "Current Server Null");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), false, "Relay FellOff CHeck");

        }
      }

      // When on Request Register
      {
        RelayPullThreadBuilder bldr = new RelayPullThreadBuilder(false, true);
        RelayPullThread relayPuller = bldr.createFellOffRelayPullThread();
        relayPuller.getComponentStatus().start();
        ConnectionState connState = relayPuller.getConnectionState();
        connState.switchToPickServer();
        testTransitionCase(relayPuller, StateId.PICK_SERVER, StateId.REQUEST_SOURCES);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_SOURCES, StateId.SOURCES_REQUEST_SENT, "");
        List<IdNamePair> sourcesResponse = new ArrayList<IdNamePair>();
        sourcesResponse.add(new IdNamePair(1L, "source1"));
        connState.switchToSourcesSuccess(sourcesResponse, _HOSTNAME, _SVCNAME);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.SOURCES_RESPONSE_SUCCESS, StateId.REQUEST_REGISTER);
        validateConnState(connState);

        // ServerSetChange when New Set includes CurrentServer
        {
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer() != null, true, "Current Server not Null");
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(true, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.REQUEST_REGISTER, "ServerSetChange while REQUEST_REGISTER");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: [REQUEST_REGISTER]", "Queue :ServerSetChange while REQUEST_REGISTER");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), true, "Relay FellOff CHeck");
        }

        // ServerSetChange when New Set excludes CurrentServer
        {
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(false, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx() == -1, true, "Current Server Index undefined");
          Assert.assertEquals(relayPuller.getCurentServer() == null, true, "Current Server Null");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo3,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.PICK_SERVER, "ServerSetChange while REQUEST_REGISTER");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: [PICK_SERVER]", "Queue :ServerSetChange while REQUEST_REGISTER");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), false, "Relay FellOff CHeck");
        }
      }

      // When on REGISTER-REQUEST-SENT and REGISTER_RESPONSE_ERROR
      {
        RelayPullThreadBuilder bldr = new RelayPullThreadBuilder(false, true);
        RelayPullThread relayPuller = bldr.createFellOffRelayPullThread();
        relayPuller.getComponentStatus().start();
        ConnectionState connState = relayPuller.getConnectionState();
        connState.switchToPickServer();
        testTransitionCase(relayPuller, StateId.PICK_SERVER, StateId.REQUEST_SOURCES);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_SOURCES, StateId.SOURCES_REQUEST_SENT, "");
        List<IdNamePair> sourcesResponse = new ArrayList<IdNamePair>();
        sourcesResponse.add(new IdNamePair(1L, "source1"));
        connState.switchToSourcesSuccess(sourcesResponse, _HOSTNAME, _SVCNAME);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.SOURCES_RESPONSE_SUCCESS, StateId.REQUEST_REGISTER);
        relayPuller.getMessageQueue().clear();
        String subsListString = "[{\"physicalSource\":{\"uri\":\"databus:physical-source:ANY\",\"role\":\"MASTER\"},\"physicalPartition\":{\"id\":-1,\"name\":\"*\"},\"logicalPartition\":{\"source\":{\"id\":0,\"name\":\"source1\"},\"id\":-1}}]";
        String sourcesIdListString = "1";
        connState.switchToRequestSourcesSchemas(sourcesIdListString, subsListString);
        testTransitionCase(relayPuller, StateId.REQUEST_REGISTER, StateId.REGISTER_REQUEST_SENT,"");


        // ServerSetChange when New Set includes CurrentServer
        {
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer() != null, true, "Current Server not Null");
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(true, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.REGISTER_REQUEST_SENT, "ServerSetChange while REGISTER_REQUEST_SENT");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: []", "Queue :ServerSetChange while REGISTER_REQUEST_SENT");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), true, "Relay FellOff CHeck");
        }

        // ServerSetChange when New Set excludes CurrentServer and SuccessFul Response
        {
          int oldServerIndex = relayPuller.getCurrentServerIdx();
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(false, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx(), oldServerIndex, "Current Server Index unchanged");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo3,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), true, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.REGISTER_REQUEST_SENT, "ServerSetChange while REQUEST_REGISTER");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: []", "Queue :ServerSetChange while REQUEST_REGISTER");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), true, "Relay FellOff CHeck");

          connState.switchToRegisterResponseError();
          testTransitionCase(relayPuller, StateId.REGISTER_RESPONSE_ERROR, StateId.PICK_SERVER);
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(relayPuller.getCurrentServerIdx() == -1, true, "Current Server Index undefined");
          Assert.assertEquals(relayPuller.getCurentServer() == null, true, "Current Server Null");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), false, "Relay FellOff CHeck");

        }
      }

      // When on REGISTER-REQUEST-SENT and REGISTER_REQUEST_ERROR
      {
        RelayPullThreadBuilder bldr = new RelayPullThreadBuilder(false, true);
        RelayPullThread relayPuller = bldr.createFellOffRelayPullThread();
        relayPuller.getComponentStatus().start();
        ConnectionState connState = relayPuller.getConnectionState();
        connState.switchToPickServer();
        testTransitionCase(relayPuller, StateId.PICK_SERVER, StateId.REQUEST_SOURCES);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_SOURCES, StateId.SOURCES_REQUEST_SENT, "");
        List<IdNamePair> sourcesResponse = new ArrayList<IdNamePair>();
        sourcesResponse.add(new IdNamePair(1L, "source1"));
        connState.switchToSourcesSuccess(sourcesResponse, _HOSTNAME, _SVCNAME);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.SOURCES_RESPONSE_SUCCESS, StateId.REQUEST_REGISTER);
        relayPuller.getMessageQueue().clear();
        String subsListString = "[{\"physicalSource\":{\"uri\":\"databus:physical-source:ANY\",\"role\":\"MASTER\"},\"physicalPartition\":{\"id\":-1,\"name\":\"*\"},\"logicalPartition\":{\"source\":{\"id\":0,\"name\":\"source1\"},\"id\":-1}}]";
        String sourcesIdListString = "1";
        connState.switchToRequestSourcesSchemas(sourcesIdListString, subsListString);
        testTransitionCase(relayPuller, StateId.REQUEST_REGISTER, StateId.REGISTER_REQUEST_SENT,"");


        // ServerSetChange when New Set includes CurrentServer
        {
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer() != null, true, "Current Server not Null");
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(true, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.REGISTER_REQUEST_SENT, "ServerSetChange while REGISTER_REQUEST_SENT");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: []", "Queue :ServerSetChange while REGISTER_REQUEST_SENT");
        }

        // ServerSetChange when New Set excludes CurrentServer and SuccessFul Response
        {
          int oldServerIndex = relayPuller.getCurrentServerIdx();
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(false, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx(), oldServerIndex, "Current Server Index unchanged");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo3,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), true, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.REGISTER_REQUEST_SENT, "ServerSetChange while REQUEST_REGISTER");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: []", "Queue :ServerSetChange while REQUEST_REGISTER");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), true, "Relay FellOff CHeck");

          connState.switchToSourcesRequestError();
          testTransitionCase(relayPuller, StateId.REGISTER_REQUEST_ERROR, StateId.PICK_SERVER);
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(relayPuller.getCurrentServerIdx() == -1, true, "Current Server Index undefined");
          Assert.assertEquals(relayPuller.getCurentServer() == null, true, "Current Server Null");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), false, "Relay FellOff CHeck");

        }
      }

      // When on REGISTER-REQUEST-SENT and Response Successful
      {
        RelayPullThreadBuilder bldr = new RelayPullThreadBuilder(false, true);
        RelayPullThread relayPuller = bldr.createFellOffRelayPullThread();
        relayPuller.getComponentStatus().start();
        ConnectionState connState = relayPuller.getConnectionState();
        connState.switchToPickServer();
        testTransitionCase(relayPuller, StateId.PICK_SERVER, StateId.REQUEST_SOURCES);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_SOURCES, StateId.SOURCES_REQUEST_SENT, "");
        List<IdNamePair> sourcesResponse = new ArrayList<IdNamePair>();
        sourcesResponse.add(new IdNamePair(1L, "source1"));
        connState.switchToSourcesSuccess(sourcesResponse, _HOSTNAME, _SVCNAME);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.SOURCES_RESPONSE_SUCCESS, StateId.REQUEST_REGISTER);
        validateConnState(connState);
        relayPuller.getMessageQueue().clear();
        String subsListString = "[{\"physicalSource\":{\"uri\":\"databus:physical-source:ANY\",\"role\":\"MASTER\"},\"physicalPartition\":{\"id\":-1,\"name\":\"*\"},\"logicalPartition\":{\"source\":{\"id\":0,\"name\":\"source1\"},\"id\":-1}}]";
        String sourcesIdListString = "1";
        connState.switchToRequestSourcesSchemas(sourcesIdListString, subsListString);
        testTransitionCase(relayPuller, StateId.REQUEST_REGISTER, StateId.REGISTER_REQUEST_SENT,"");


        // ServerSetChange when New Set includes CurrentServer
        {
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer() != null, true, "Current Server not Null");
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(true, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.REGISTER_REQUEST_SENT, "ServerSetChange while REGISTER_REQUEST_SENT");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: []", "Queue :ServerSetChange while REGISTER_REQUEST_SENT");
        }

        // ServerSetChange when New Set excludes CurrentServer and SuccessFul Response
        {
          int oldServerIndex = relayPuller.getCurrentServerIdx();
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(false, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx(), oldServerIndex, "Current Server Index unchanged");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo3,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), true, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.REGISTER_REQUEST_SENT, "ServerSetChange while REQUEST_REGISTER");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: []", "Queue :ServerSetChange while REQUEST_REGISTER");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), true, "Relay FellOff CHeck");

          // Now Response arrives
          MockRelayConnection conn = (MockRelayConnection)connState.getRelayConnection();
          connState.switchToRegisterSuccess(conn.getRegisterResponse(), conn.getRegisterResponse(), conn.getRegisterMetadataResponse());
          testTransitionCase(relayPuller, StateId.REGISTER_RESPONSE_SUCCESS, StateId.PICK_SERVER);
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(relayPuller.getCurrentServerIdx() == -1, true, "Current Server Index undefined");
          Assert.assertEquals(relayPuller.getCurentServer() == null, true, "Current Server Null");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), false, "Relay FellOff CHeck");

        }
      }

      // when on REQUEST_STREAM
      {
        RelayPullThreadBuilder bldr = new RelayPullThreadBuilder(false, false);
        RelayPullThread relayPuller = bldr.createFellOffRelayPullThread();
        relayPuller.getComponentStatus().start();
        ConnectionState connState = relayPuller.getConnectionState();
        connState.switchToPickServer();
        testTransitionCase(relayPuller, StateId.PICK_SERVER, StateId.REQUEST_SOURCES);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_SOURCES, StateId.SOURCES_RESPONSE_SUCCESS);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.SOURCES_RESPONSE_SUCCESS, StateId.REQUEST_REGISTER);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_REGISTER, StateId.REGISTER_RESPONSE_SUCCESS);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REGISTER_RESPONSE_SUCCESS, StateId.REQUEST_STREAM);

        // ServerSetChange when New Set includes CurrentServer
        {
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer() != null, true, "Current Server not Null");
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(true, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.REQUEST_STREAM, "ServerSetChange while REQUEST_STREAM");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: [REQUEST_STREAM]", "Queue :ServerSetChange while REQUEST_STREAM");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), true, "Relay FellOff CHeck");
        }

        // ServerSetChange when New Set excludes CurrentServer
        {
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(false, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx() == -1, true, "Current Server Index undefined");
          Assert.assertEquals(relayPuller.getCurentServer() == null, true, "Current Server Null");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo3,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.PICK_SERVER, "ServerSetChange while REQUEST_STREAM");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: [PICK_SERVER]", "Queue :ServerSetChange while REQUEST_STREAM");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), false, "Relay FellOff CHeck");
        }
      }

      // When on STREAM_REQUEST_SENT and response successful
      {
        RelayPullThreadBuilder bldr = new RelayPullThreadBuilder(false, true);
        RelayPullThread relayPuller = bldr.createFellOffRelayPullThread();
        relayPuller.getComponentStatus().start();
        ConnectionState connState = relayPuller.getConnectionState();
        connState.switchToPickServer();
        testTransitionCase(relayPuller, StateId.PICK_SERVER, StateId.REQUEST_SOURCES);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_SOURCES, StateId.SOURCES_REQUEST_SENT, "");
        List<IdNamePair> sourcesResponse = new ArrayList<IdNamePair>();
        sourcesResponse.add(new IdNamePair(1L, "source1"));
        connState.switchToSourcesSuccess(sourcesResponse, _HOSTNAME, _SVCNAME);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.SOURCES_RESPONSE_SUCCESS, StateId.REQUEST_REGISTER);
        relayPuller.getMessageQueue().clear();
        String subsListString = "[{\"physicalSource\":{\"uri\":\"databus:physical-source:ANY\",\"role\":\"MASTER\"},\"physicalPartition\":{\"id\":-1,\"name\":\"*\"},\"logicalPartition\":{\"source\":{\"id\":0,\"name\":\"source1\"},\"id\":-1}}]";
        String sourcesIdListString = "1";
        connState.switchToRequestSourcesSchemas(sourcesIdListString, subsListString);
        testTransitionCase(relayPuller, StateId.REQUEST_REGISTER, StateId.REGISTER_REQUEST_SENT,"");
        relayPuller.getMessageQueue().clear();
        MockRelayConnection conn = (MockRelayConnection)connState.getRelayConnection();
        connState.switchToRegisterSuccess(conn.getRegisterResponse(), conn.getRegisterResponse(), conn.getRegisterMetadataResponse());
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REGISTER_RESPONSE_SUCCESS, StateId.REQUEST_STREAM);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_STREAM, StateId.STREAM_REQUEST_SENT, "");


        // ServerSetChange when New Set includes CurrentServer
        {
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer() != null, true, "Current Server not Null");
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(true, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.STREAM_REQUEST_SENT, "ServerSetChange while STREAM_REQUEST_SENT");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: []", "Queue :ServerSetChange while STREAM_REQUEST_SENT");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), true, "Relay FellOff CHeck");
        }

        // ServerSetChange when New Set excludes CurrentServer and SuccessFul Response
        {
          int oldServerIndex = relayPuller.getCurrentServerIdx();
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(false, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx(), oldServerIndex, "Current Server Index unchanged");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo3,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), true, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.STREAM_REQUEST_SENT, "ServerSetChange while REQUEST_STREAM");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: []", "Queue :ServerSetChange while REQUEST_STREAM");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), true, "Relay FellOff CHeck");

          // Now Response arrives
          conn = (MockRelayConnection)connState.getRelayConnection();
          connState.switchToStreamSuccess(conn.getStreamResponse());
          testTransitionCase(relayPuller, StateId.STREAM_REQUEST_SUCCESS, StateId.PICK_SERVER);
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(relayPuller.getCurrentServerIdx() == -1, true, "Current Server Index undefined");
          Assert.assertEquals(relayPuller.getCurentServer() == null, true, "Current Server Null");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), false, "Relay FellOff CHeck");
        }
      }

      // When on STREAM_REQUEST_SENT and STREAM_RESPONSE_ERROR
      {
        RelayPullThreadBuilder bldr = new RelayPullThreadBuilder(false, true);
        RelayPullThread relayPuller = bldr.createFellOffRelayPullThread();
        relayPuller.getComponentStatus().start();
        ConnectionState connState = relayPuller.getConnectionState();
        connState.switchToPickServer();
        testTransitionCase(relayPuller, StateId.PICK_SERVER, StateId.REQUEST_SOURCES);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_SOURCES, StateId.SOURCES_REQUEST_SENT, "");
        List<IdNamePair> sourcesResponse = new ArrayList<IdNamePair>();
        sourcesResponse.add(new IdNamePair(1L, "source1"));
        connState.switchToSourcesSuccess(sourcesResponse, _HOSTNAME, _SVCNAME);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.SOURCES_RESPONSE_SUCCESS, StateId.REQUEST_REGISTER);
        relayPuller.getMessageQueue().clear();
        String subsListString = "[{\"physicalSource\":{\"uri\":\"databus:physical-source:ANY\",\"role\":\"MASTER\"},\"physicalPartition\":{\"id\":-1,\"name\":\"*\"},\"logicalPartition\":{\"source\":{\"id\":0,\"name\":\"source1\"},\"id\":-1}}]";
        String sourcesIdListString = "1";
        connState.switchToRequestSourcesSchemas(sourcesIdListString, subsListString);
        testTransitionCase(relayPuller, StateId.REQUEST_REGISTER, StateId.REGISTER_REQUEST_SENT,"");
        relayPuller.getMessageQueue().clear();
        MockRelayConnection conn = (MockRelayConnection)connState.getRelayConnection();
        connState.switchToRegisterSuccess(conn.getRegisterResponse(), conn.getRegisterResponse(), conn.getRegisterMetadataResponse());
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REGISTER_RESPONSE_SUCCESS, StateId.REQUEST_STREAM);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_STREAM, StateId.STREAM_REQUEST_SENT, "");


        // ServerSetChange when New Set includes CurrentServer
        {
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer() != null, true, "Current Server not Null");
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(true, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.STREAM_REQUEST_SENT, "ServerSetChange while STREAM_REQUEST_SENT");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: []", "Queue :ServerSetChange while STREAM_REQUEST_SENT");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), true, "Relay FellOff CHeck");
        }

        // ServerSetChange when New Set excludes CurrentServer and StreamResponse Error
        {
          int oldServerIndex = relayPuller.getCurrentServerIdx();
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(false, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx(), oldServerIndex, "Current Server Index unchanged");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo3,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), true, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.STREAM_REQUEST_SENT, "ServerSetChange while REQUEST_STREAM");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: []", "Queue :ServerSetChange while REQUEST_STREAM");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), true, "Relay FellOff CHeck");

          // Now Response arrives
          connState.switchToStreamResponseError();
          testTransitionCase(relayPuller, StateId.STREAM_REQUEST_SUCCESS, StateId.PICK_SERVER);
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(relayPuller.getCurrentServerIdx() == -1, true, "Current Server Index undefined");
          Assert.assertEquals(relayPuller.getCurentServer() == null, true, "Current Server Null");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), false, "Relay FellOff CHeck");
        }
      }

      // When on STREAM_REQUEST_SENT and STREAM_REQUEST_ERROR
      {
        RelayPullThreadBuilder bldr = new RelayPullThreadBuilder(false, true);
        RelayPullThread relayPuller = bldr.createFellOffRelayPullThread();
        relayPuller.getComponentStatus().start();
        ConnectionState connState = relayPuller.getConnectionState();
        connState.switchToPickServer();
        testTransitionCase(relayPuller, StateId.PICK_SERVER, StateId.REQUEST_SOURCES);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_SOURCES, StateId.SOURCES_REQUEST_SENT, "");
        List<IdNamePair> sourcesResponse = new ArrayList<IdNamePair>();
        sourcesResponse.add(new IdNamePair(1L, "source1"));
        connState.switchToSourcesSuccess(sourcesResponse, _HOSTNAME, _SVCNAME);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.SOURCES_RESPONSE_SUCCESS, StateId.REQUEST_REGISTER);
        validateConnState(connState);
        relayPuller.getMessageQueue().clear();
        String subsListString = "[{\"physicalSource\":{\"uri\":\"databus:physical-source:ANY\",\"role\":\"MASTER\"},\"physicalPartition\":{\"id\":-1,\"name\":\"*\"},\"logicalPartition\":{\"source\":{\"id\":0,\"name\":\"source1\"},\"id\":-1}}]";
        String sourcesIdListString = "1";
        connState.switchToRequestSourcesSchemas(sourcesIdListString, subsListString);
        testTransitionCase(relayPuller, StateId.REQUEST_REGISTER, StateId.REGISTER_REQUEST_SENT,"");
        relayPuller.getMessageQueue().clear();
        MockRelayConnection conn = (MockRelayConnection)connState.getRelayConnection();
        connState.switchToRegisterSuccess(conn.getRegisterResponse(), conn.getRegisterResponse(), conn.getRegisterMetadataResponse());
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REGISTER_RESPONSE_SUCCESS, StateId.REQUEST_STREAM);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_STREAM, StateId.STREAM_REQUEST_SENT, "");


        // ServerSetChange when New Set includes CurrentServer
        {
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer() != null, true, "Current Server not Null");
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(true, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.STREAM_REQUEST_SENT, "ServerSetChange while STREAM_REQUEST_SENT");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: []", "Queue :ServerSetChange while STREAM_REQUEST_SENT");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), true, "Relay FellOff CHeck");
        }

        // ServerSetChange when New Set excludes CurrentServer and StreamRequest Error
        {
          int oldServerIndex = relayPuller.getCurrentServerIdx();
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(false, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx(), oldServerIndex, "Current Server Index unchanged");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo3,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), true, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.STREAM_REQUEST_SENT, "ServerSetChange while REQUEST_STREAM");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: []", "Queue :ServerSetChange while REQUEST_STREAM");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), true, "Relay FellOff CHeck");

          // Now Response arrives
          connState.switchToStreamRequestError();
          testTransitionCase(relayPuller, StateId.STREAM_REQUEST_SUCCESS, StateId.PICK_SERVER);
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(relayPuller.getCurrentServerIdx() == -1, true, "Current Server Index undefined");
          Assert.assertEquals(relayPuller.getCurentServer() == null, true, "Current Server Null");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), false, "Relay FellOff CHeck");

        }
      }

      // when Stream_Response_done
      {
        RelayPullThreadBuilder bldr = new RelayPullThreadBuilder(false, false);
        RelayPullThread relayPuller = bldr.createFellOffRelayPullThread();
        relayPuller.getComponentStatus().start();
        ConnectionState connState = relayPuller.getConnectionState();
        connState.switchToPickServer();
        testTransitionCase(relayPuller, StateId.PICK_SERVER, StateId.REQUEST_SOURCES);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_SOURCES, StateId.SOURCES_RESPONSE_SUCCESS);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.SOURCES_RESPONSE_SUCCESS, StateId.REQUEST_REGISTER);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_REGISTER, StateId.REGISTER_RESPONSE_SUCCESS);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REGISTER_RESPONSE_SUCCESS, StateId.REQUEST_STREAM);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_STREAM, StateId.STREAM_REQUEST_SUCCESS);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.STREAM_REQUEST_SUCCESS,StateId.STREAM_RESPONSE_DONE);
        Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), false, "Relay FellOff CHeck");
        relayPuller.getConnectionState().setRelayFellOff(true);

        // ServerSetChange when New Set includes CurrentServer
        {
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer() != null, true, "Current Server not Null");
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(true, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.STREAM_RESPONSE_DONE, "ServerSetChange while STREAM_RESPONSE_DONE");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: [STREAM_RESPONSE_DONE]", "Queue :ServerSetChange while STREAM_RESPONSE_DONE");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), true, "Relay FellOff CHeck");
        }

        // ServerSetChange when New Set excludes CurrentServer
        {
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(false, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx() == -1, true, "Current Server Index undefined");
          Assert.assertEquals(relayPuller.getCurentServer() == null, true, "Current Server Null");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo3,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.PICK_SERVER, "ServerSetChange while STREAM_RESPONSE_DONE");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: [PICK_SERVER]", "Queue :ServerSetChange while STREAM_RESPONSE_DONE");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), false, "Relay FellOff CHeck");
        }
      }

      // When doBootstrap
      {
        RelayPullThreadBuilder bldr = new RelayPullThreadBuilder(false, false);
        bldr.setBootstrapEnabled(true).setReadLatestScnEnabled(false).setReadDataThrowException(false)
        .setReadDataException(true).setExceptionName(ScnNotFoundException.class.getName());
        RelayPullThread relayPuller = bldr.createRelayPullThread();
        relayPuller.getComponentStatus().start();
        ConnectionState connState = relayPuller.getConnectionState();
        connState.switchToPickServer();
        testTransitionCase(relayPuller, StateId.PICK_SERVER, StateId.REQUEST_SOURCES);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_SOURCES, StateId.SOURCES_RESPONSE_SUCCESS);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.SOURCES_RESPONSE_SUCCESS, StateId.REQUEST_REGISTER);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_REGISTER, StateId.REGISTER_RESPONSE_SUCCESS);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REGISTER_RESPONSE_SUCCESS, StateId.REQUEST_STREAM);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_STREAM, StateId.STREAM_REQUEST_SUCCESS);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.STREAM_REQUEST_SUCCESS,StateId.BOOTSTRAP);

        // ServerSetChange when New Set includes CurrentServer
        {
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer() != null, true, "Current Server not Null");
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(true, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.BOOTSTRAP, "ServerSetChange while BOOTSTRAP");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: [BOOTSTRAP]", "Queue :ServerSetChange while BOOTSTRAP");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), true, "Relay FellOff CHeck");
        }

        // ServerSetChange when New Set excludes CurrentServer
        {
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(false, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx() == -1, true, "Current Server Index undefined");
          Assert.assertEquals(relayPuller.getCurentServer() == null, true, "Current Server Null");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo3,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.PICK_SERVER, "ServerSetChange while BOOTSTRAP");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: [PICK_SERVER]", "Queue :ServerSetChange while BOOTSTRAP");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), false, "Relay FellOff CHeck");
        }
      }

      // When doBootstrapRequested and bootstrap Successful
      {
        RelayPullThreadBuilder bldr = new RelayPullThreadBuilder(false, false);
        bldr.setBootstrapEnabled(true).setReadLatestScnEnabled(false).setReadDataThrowException(false)
        .setReadDataException(true).setExceptionName(ScnNotFoundException.class.getName());
        RelayPullThread relayPuller = bldr.createRelayPullThread();
        relayPuller.getComponentStatus().start();
        ConnectionState connState = relayPuller.getConnectionState();
        connState.switchToPickServer();
        testTransitionCase(relayPuller, StateId.PICK_SERVER, StateId.REQUEST_SOURCES);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_SOURCES, StateId.SOURCES_RESPONSE_SUCCESS);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.SOURCES_RESPONSE_SUCCESS, StateId.REQUEST_REGISTER);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_REGISTER, StateId.REGISTER_RESPONSE_SUCCESS);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REGISTER_RESPONSE_SUCCESS, StateId.REQUEST_STREAM);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_STREAM, StateId.STREAM_REQUEST_SUCCESS);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.STREAM_REQUEST_SUCCESS,StateId.BOOTSTRAP);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.BOOTSTRAP,StateId.BOOTSTRAP_REQUESTED,"");

        // ServerSetChange when New Set includes CurrentServer
        {
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer() != null, true, "Current Server not Null");
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(true, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.BOOTSTRAP_REQUESTED, "ServerSetChange while BOOTSTRAP_REQUESTED");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: []", "Queue :ServerSetChange while BOOTSTRAP_REQUESTED");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), true, "Relay FellOff CHeck");
        }

        // ServerSetChange when New Set excludes CurrentServer and SuccessFul Response
        {
          int oldServerIndex = relayPuller.getCurrentServerIdx();
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(false, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx(), oldServerIndex, "Current Server Index unchanged");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo3,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), true, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.BOOTSTRAP_REQUESTED, "ServerSetChange while BOOTSTRAP");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: []", "Queue :ServerSetChange while BOOTSTRAP");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), true, "Relay FellOff CHeck");

          // Now Response arrives
          BootstrapResultMessage msg = BootstrapResultMessage.createBootstrapCompleteMessage(new Checkpoint());
          doExecuteAndChangeState(relayPuller,msg);
          Assert.assertEquals(connState.getStateId(),StateId.PICK_SERVER, "BOOTSTRAP_REQUESTED to PICK_SERVER");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: [PICK_SERVER]", "Queue :BOOTSTRAP_REQUESTED to REQUEST_STREAM");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(relayPuller.getCurrentServerIdx() == -1, true, "Current Server Index undefined");
          Assert.assertEquals(relayPuller.getCurentServer() == null, true, "Current Server Null");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), false, "Relay FellOff CHeck");
        }
      }

      // When doBootstrapRequested and bootstrap failed
      {
        RelayPullThreadBuilder bldr = new RelayPullThreadBuilder(false, false);
        bldr.setBootstrapEnabled(true).setReadLatestScnEnabled(false).setReadDataThrowException(false)
        .setReadDataException(true).setExceptionName(ScnNotFoundException.class.getName());
        RelayPullThread relayPuller = bldr.createRelayPullThread();
        relayPuller.getComponentStatus().start();
        ConnectionState connState = relayPuller.getConnectionState();
        connState.switchToPickServer();
        testTransitionCase(relayPuller, StateId.PICK_SERVER, StateId.REQUEST_SOURCES);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_SOURCES, StateId.SOURCES_RESPONSE_SUCCESS);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.SOURCES_RESPONSE_SUCCESS, StateId.REQUEST_REGISTER);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_REGISTER, StateId.REGISTER_RESPONSE_SUCCESS);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REGISTER_RESPONSE_SUCCESS, StateId.REQUEST_STREAM);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.REQUEST_STREAM, StateId.STREAM_REQUEST_SUCCESS);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.STREAM_REQUEST_SUCCESS,StateId.BOOTSTRAP);
        relayPuller.getMessageQueue().clear();
        testTransitionCase(relayPuller, StateId.BOOTSTRAP,StateId.BOOTSTRAP_REQUESTED,"");

        // ServerSetChange when New Set includes CurrentServer
        {
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer() != null, true, "Current Server not Null");
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(true, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          Assert.assertEquals(relayPuller.toTearConnAfterHandlingResponse(), false, "Tear Conn After Handling Response");
          Assert.assertEquals(connState.getStateId(),StateId.BOOTSTRAP_REQUESTED, "ServerSetChange while BOOTSTRAP_REQUESTED");
          Assert.assertEquals(relayPuller.getQueueListString(), "RelayPuller queue: []", "Queue :ServerSetChange while BOOTSTRAP_REQUESTED");
          Assert.assertEquals(relayPuller.getConnectionState().isRelayFellOff(), true, "Relay FellOff CHeck");
        }

        // ServerSetChange when New Set excludes CurrentServer and SuccessFul Response
        {
          int oldServerIndex = relayPuller.getCurrentServerIdx();
          ServerInfo oldServer = relayPuller.getCurentServer();
          Assert.assertEquals(relayPuller.getServers(),expServerInfo2,"Server Set");
          doExecuteAndChangeState(relayPuller,createSetServerMessage(false, relayPuller));
          Assert.assertEquals(relayPuller.getCurrentServerIdx(), oldServerIndex, "Current Server Index unchanged");
          Assert.assertEquals(relayPuller.getCurentServer(), oldServer, "Current Server unchanged");
          Assert.assertEquals(relayPuller.getServers(),expServerInfo3,"Server Set");
View Full Code Here

  private ServerSetChangeMessage createSetServerMessage(boolean keepCurrent, BasePullThread puller)
  {
    Set<ServerInfo> serverInfoSet = new HashSet<ServerInfo>();
    InetSocketAddress inetAddr1 = new InetSocketAddress("localhost",10000);

    ServerInfo s = new ServerInfo("newRelay1", "ONLINE", inetAddr1, Arrays.asList("source1"));
    serverInfoSet.add(s);

    if ( keepCurrent )
    {
      serverInfoSet.addAll(puller.getServers());
View Full Code Here

        relay.start();
        List<MsgState> msgList = new ArrayList<MsgState>();
        DatabusHttpClientImpl.Config conf = new DatabusHttpClientImpl.Config();
        conf.getContainer().setReadTimeoutMs(54);
        factory = new TestClientConnectionFactory(conf.build());
        ServerInfo relayInfo = new ServerInfo("dummy", "dummy", new InetSocketAddress(InetAddress.getLocalHost(), port), "dummy");
        for (int i = 0 ; i < 10 ; i++)
        {
            TestClientConnection conn = factory.createConnection(relayInfo, msgList);
          conn.requestCall();
          Thread.sleep(1000);
View Full Code Here

        InputStream bodyStream = Channels.newInputStream(_decorated);

        ObjectMapper mapper = new ObjectMapper();
        String scnString = mapper.readValue(bodyStream, String.class);

        ServerInfo serverInfo  = null;
        String serverHostPort = _decorated.getMetadata(DbusConstants.SERVER_INFO_HOSTPORT_HEADER_PARAM);
        try
        {
          serverInfo = ServerInfo.buildServerInfoFromHostPort(serverHostPort, DbusConstants.HOSTPORT_DELIMITER);
        } catch(Exception ex) {
View Full Code Here

    {

      throw new DatabusClientException("Unable to find servers to support sources: " + sources);
    }
    Random rng = new Random();
    ServerInfo randomRelay = candidateServers.get(rng.nextInt(candidateServers.size()));
    return randomRelay;
  }
View Full Code Here

TOP

Related Classes of com.linkedin.databus.client.pub.ServerInfo

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.