Package com.linkedin.databus.core

Examples of com.linkedin.databus.core.Checkpoint


  {
    // targetScn = 50 < 100 = startScn
    BootstrapPullThread bsPuller = createBootstrapPullThread(false, false, false, false, false, null, 12000, 1, true,
                                                             100, 50);

    Checkpoint cp = _ckptHandlerSource1.createInitialBootstrapCheckpoint(null, 0L);
    //TODO remove
    //cp.setSnapshotSource("source1");
    //cp.setCatchupSource("source1");
    //cp.setConsumptionMode(DbusClientMode.BOOTSTRAP_SNAPSHOT);
    cp.setBootstrapServerInfo(_serverInfoName);

    bsPuller.getComponentStatus().start();
    ConnectionState connState = bsPuller.getConnectionState();
    connState.switchToBootstrap(cp);
    testTransitionCase(bsPuller, StateId.BOOTSTRAP, StateId.REQUEST_START_SCN, cp);

    bsPuller.getMessageQueue().clear();
    testTransitionCase(bsPuller, StateId.REQUEST_START_SCN, StateId.START_SCN_RESPONSE_SUCCESS, null);
    bsPuller.getMessageQueue().clear();
    Map<Long, List<RegisterResponseEntry>> entries = new HashMap<Long, List<RegisterResponseEntry>>();

    entries.put(1L, new ArrayList<RegisterResponseEntry>());
    connState.setSourcesSchemas(entries);

    testTransitionCase(bsPuller, StateId.START_SCN_RESPONSE_SUCCESS, StateId.REQUEST_STREAM, null);
    bsPuller.getMessageQueue().clear();

    connState.getSourcesNameMap().put("source1", new IdNamePair(1L, "source1"));
    connState.getSourceIdMap().put(1L, new IdNamePair(1L, "source1"));
    testTransitionCase(bsPuller, StateId.REQUEST_STREAM, StateId.STREAM_REQUEST_SUCCESS, null);

    bsPuller.getMessageQueue().clear();
    testTransitionCase(bsPuller, StateId.STREAM_REQUEST_SUCCESS, StateId.STREAM_RESPONSE_DONE, null);

    bsPuller.getMessageQueue().clear();
    cp.setSnapshotOffset(-1);
    testTransitionCase(bsPuller, StateId.STREAM_RESPONSE_DONE, StateId.REQUEST_TARGET_SCN, null);
    Assert.assertEquals(cp.getConsumptionMode(), DbusClientMode.BOOTSTRAP_SNAPSHOT, "Consumption Mode check");
    Assert.assertFalse(cp.isBootstrapTargetScnSet());

    bsPuller.getMessageQueue().clear();
//    testTransitionCase(bsPuller, StateId.REQUEST_TARGET_SCN, StateId.TARGET_SCN_RESPONSE_SUCCESS, null);
    testTransitionCase(bsPuller, StateId.REQUEST_TARGET_SCN, StateId.TARGET_SCN_RESPONSE_ERROR, null);

    bsPuller.getMessageQueue().clear();
    testTransitionCase(bsPuller, StateId.TARGET_SCN_RESPONSE_ERROR, StateId.PICK_SERVER, null);
    Assert.assertEquals(cp.getConsumptionMode(), DbusClientMode.BOOTSTRAP_SNAPSHOT, "Consumption Mode check");
    Assert.assertFalse(cp.isBootstrapTargetScnSet());
    Assert.assertEquals(cp.getBootstrapTargetScn().longValue(), Checkpoint.UNSET_BOOTSTRAP_TARGET_SCN);

  }
View Full Code Here


  @Test
  public void testTransition_ErrorStates() throws Exception
  {
    BootstrapPullThread bsPuller = createBootstrapPullThread(false, false, false);
    Checkpoint cp = _ckptHandlerSource1.createInitialBootstrapCheckpoint(null, 0L);
    //TODO remove
    //cp.setConsumptionMode(DbusClientMode.BOOTSTRAP_SNAPSHOT);
    cp.setBootstrapServerInfo(_serverInfoName);

    bsPuller.getComponentStatus().start();
    ConnectionState connState = bsPuller.getConnectionState();
    connState.switchToBootstrap(cp);
    testTransitionCase(bsPuller, StateId.BOOTSTRAP, StateId.REQUEST_START_SCN, cp);
View Full Code Here

                                                           null,
                                                           null);
    mockSuccessConn.setCallback(bsPuller);

    bsPuller.getComponentStatus().start();
    Checkpoint cp = _ckptHandlerSource1.createInitialBootstrapCheckpoint(null, 0L);
    //TODO remove
    //cp.setSnapshotSource("source1");
    //cp.setCatchupSource("source1");
    //cp.setConsumptionMode(DbusClientMode.BOOTSTRAP_SNAPSHOT);
View Full Code Here

  /** Test ServerSet change when in Request_start_Scn state */
  public void testServerSetChange_RequestStartScn() throws Exception
  {
    BootstrapPullThread bsPuller = createBootstrapPullThread(false, false, false);

    Checkpoint cp = _ckptHandlerSource1.createInitialBootstrapCheckpoint(null, 0L);

    bsPuller.getComponentStatus().start();
    ConnectionState connState = bsPuller.getConnectionState();
    connState.switchToBootstrap(cp);
    testTransitionCase(bsPuller, StateId.BOOTSTRAP, StateId.REQUEST_START_SCN, cp);
View Full Code Here

  public void testServerSetChange_StartScnRequestSent() throws Exception
  {
    //Logger.getRootLogger().setLevel(Level.INFO);
    BootstrapPullThread bsPuller = createBootstrapPullThread(false, false, true);

    Checkpoint cp = _ckptHandlerSource1.createInitialBootstrapCheckpoint(null, 1L);

    bsPuller.getComponentStatus().start();
    ConnectionState connState = bsPuller.getConnectionState();
    connState.switchToBootstrap(cp);
    testTransitionCase(bsPuller, StateId.BOOTSTRAP, StateId.REQUEST_START_SCN, cp);
View Full Code Here

  /** Test ServerSet change when in Start_Scn_Response_Success */
  public void testServerSetChange_StartScnResponseSuccess() throws Exception
  {
    BootstrapPullThread bsPuller = createBootstrapPullThread(false, false, false);

    Checkpoint cp = _ckptHandlerSource1.createInitialBootstrapCheckpoint(null, 0L);

    bsPuller.getComponentStatus().start();
    ConnectionState connState = bsPuller.getConnectionState();
    connState.switchToBootstrap(cp);
    testTransitionCase(bsPuller, StateId.BOOTSTRAP, StateId.REQUEST_START_SCN, cp);
View Full Code Here

  @Test
  /** Test ServerSet Change when in Request_stream state */
  public void testServerSetChange_RequestStream() throws Exception
  {
    BootstrapPullThread bsPuller = createBootstrapPullThread(false, false, false);
    Checkpoint cp = _ckptHandlerSource1.createInitialBootstrapCheckpoint(null, 1L);

    bsPuller.getComponentStatus().start();
    ConnectionState connState = bsPuller.getConnectionState();
    connState.switchToBootstrap(cp);
    testTransitionCase(bsPuller, StateId.BOOTSTRAP, StateId.REQUEST_START_SCN, cp);
View Full Code Here

  @Test
  /** Tests ServerSet change when in Stream_Request_Sent */
  public void testServerSetChange_StreamRequestSent() throws Exception
  {
    BootstrapPullThread bsPuller = createBootstrapPullThread(false, false, false, 12000, 1);
    Checkpoint cp = _ckptHandlerSource1.createInitialBootstrapCheckpoint(null, 0L);
    //TODO remove
//    cp.setConsumptionMode(DbusClientMode.BOOTSTRAP_SNAPSHOT);
//    cp.setSnapshotSource("source1");
//    cp.setCatchupSource("source1");

View Full Code Here

  @Test
  /** Test ServerSet change when in Stream_Response_Success state */
  public void testServerSetChange_StreamResponseSuccess() throws Exception
  {
    BootstrapPullThread bsPuller = createBootstrapPullThread(false, false, false, 12000, 1);
    Checkpoint cp = _ckptHandlerSource1.createInitialBootstrapCheckpoint(null, 0L);
    //TODO remove
//    cp.setConsumptionMode(DbusClientMode.BOOTSTRAP_SNAPSHOT);
//    cp.setSnapshotSource("source1");
//    cp.setCatchupSource("source1");

View Full Code Here

  /** Test ServerSet change when in Request_target_Scn state */
  public void testServerSetChange_RequestTargetScn() throws Exception
  {
    BootstrapPullThread bsPuller = createBootstrapPullThread(false, false, false, false, false, null, 12000, 1, true);

    Checkpoint cp = _ckptHandlerSource1.createInitialBootstrapCheckpoint(null, 0L);

    bsPuller.getComponentStatus().start();
    ConnectionState connState = bsPuller.getConnectionState();
    connState.switchToBootstrap(cp);
    testTransitionCase(bsPuller, StateId.BOOTSTRAP, StateId.REQUEST_START_SCN, cp);

    bsPuller.getMessageQueue().clear();
    testTransitionCase(bsPuller, StateId.REQUEST_START_SCN, StateId.START_SCN_RESPONSE_SUCCESS, null);
    bsPuller.getMessageQueue().clear();
    Map<Long, List<RegisterResponseEntry>> entries = new HashMap<Long, List<RegisterResponseEntry>>();

    entries.put(1L, new ArrayList<RegisterResponseEntry>());
    connState.setSourcesSchemas(entries);
    connState.setCurrentBSServerInfo(bsPuller.getCurentServer());

    testTransitionCase(bsPuller, StateId.START_SCN_RESPONSE_SUCCESS, StateId.REQUEST_STREAM, null);
    bsPuller.getMessageQueue().clear();

    connState.getSourcesNameMap().put("source1", new IdNamePair(1L, "source1"));
    connState.getSourceIdMap().put(1L, new IdNamePair(1L, "source1"));
    testTransitionCase(bsPuller, StateId.REQUEST_STREAM, StateId.STREAM_REQUEST_SUCCESS, null);

    bsPuller.getMessageQueue().clear();
    testTransitionCase(bsPuller, StateId.STREAM_REQUEST_SUCCESS, StateId.STREAM_RESPONSE_DONE, null);

    bsPuller.getMessageQueue().clear();
    cp.setConsumptionMode(DbusClientMode.BOOTSTRAP_SNAPSHOT);
    cp.setSnapshotOffset(-1);
    //cp.setBootstrapStartScn(100L);
    testTransitionCase(bsPuller, StateId.STREAM_RESPONSE_DONE, StateId.REQUEST_TARGET_SCN, null);
    //Assert.assertEquals(cp.getWindowScn(), 100L, "WindowSCN Check");
    //Assert.assertEquals(cp.getConsumptionMode(), DbusClientMode.BOOTSTRAP_CATCHUP, "Consumption Mode check");
    Assert.assertEquals(cp.getConsumptionMode(), DbusClientMode.BOOTSTRAP_SNAPSHOT, "Consumption Mode check");
    Assert.assertEquals(cp.getCatchupSource(), "source1", "Catchup Source check");

    // ServerSetChange when New Set includes CurrentServer
    {
      Assert.assertEquals(bsPuller.getCurrentServerIdx() != -1, true, "Current Server Index defined");
      Assert.assertEquals(bsPuller.getCurentServer() != null, true, "Current Server not Null");
View Full Code Here

TOP

Related Classes of com.linkedin.databus.core.Checkpoint

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.