Package net.sf.katta.master

Examples of net.sf.katta.master.Master


  }

  @Test(timeout = 20000)
  public void testMasterFail() throws Exception {
    // start secondary master..
    Master secondaryMaster = _miniCluster.startSecondaryMaster();
    assertTrue(_miniCluster.getMaster().isMaster());
    assertFalse(secondaryMaster.isMaster());

    // kill master
    _miniCluster.getMaster().shutdown();

    // just make sure we can read the file
View Full Code Here


    deployTestIndices(1, getNodeCount());
    _miniCluster.getMaster().shutdown();

    ZkClient zkClient = new ZkClient(_miniCluster.getZkConfiguration().getZKServers());
    InteractionProtocol protocol = new InteractionProtocol(zkClient, _miniCluster.getZkConfiguration());
    Master master = new Master(protocol, false);
    master.start();
    TestUtil.waitUntilBecomeMaster(master);

    final IDeployClient deployClient = new DeployClient(_protocol);
    WatchedEvent event = new WatchedEvent(new WatcherEvent(EventType.None.getIntValue(), KeeperState.Expired
            .getIntValue(), null));
View Full Code Here

    assertFalse(protocol.isNodeOperationQueued(operation2Id));
  }

  @Test(timeout = 7000)
  public void testPublishMaster() throws Exception {
    Master master1 = mock(Master.class);
    Master master2 = mock(Master.class);
    when(master1.getMasterName()).thenReturn("master1");
    when(master2.getMasterName()).thenReturn("master2");
    MasterOperation operation = mock(MasterOperation.class);
    _protocol.addMasterOperation(operation);

    MasterQueue queue = _protocol.publishMaster(master1);
    assertNotNull(queue);
View Full Code Here

    // listeners nshould be removed
  }

  @Test(timeout = 7000)
  public void testDeleteEphemeraksOnUnregisterComponent() throws Exception {
    Master master = mock(Master.class);
    _protocol.publishMaster(master);
    assertNotNull(_protocol.getMasterMD());

    _protocol.unregisterComponent(master);
    assertNull(_protocol.getMasterMD());
View Full Code Here

    NodeConfiguration nodeConfiguration = new NodeConfiguration();
    nodeConfiguration.setStartPort(_nodeStartPort);
    for (int i = 0; i < _nodeCount; i++) {
      _nodes.add(new Node(_protocol, nodeConfiguration, _contentServerClass.newInstance()));
    }
    _master = new Master(_protocol, false);
    _master.start();
    for (Node node : _nodes) {
      node.start();
      _startedNodes++;
    }
View Full Code Here

    _startedNodes++;
    return node;
  }

  public Master startSecondaryMaster() throws KattaException {
    _secondaryMaster = new Master(_protocol, false);
    _secondaryMaster.start();
    return _secondaryMaster;
  }
View Full Code Here

    return _secondaryMaster;
  }

  public void restartMaster() throws Exception {
    _master.shutdown();
    _master = new Master(_protocol, false);
    _master.start();
    TestUtil.waitUntilLeaveSafeMode(_master);
  }
View Full Code Here

    IndexMetaData indexMD = _protocol.getIndexMD(_indexName);
    assertNotNull(indexMD);
    assertNull(indexMD.getDeployError());

    // balance index should have been be triggered
    Master master = Mocks.mockMaster();
    MasterQueue masterQueue = _protocol.publishMaster(master);
    MasterOperation operation = masterQueue.peek();
    assertNotNull(operation);
    assertTrue(operation instanceof BalanceIndexOperation);
  }
View Full Code Here

  private static int _nodeCounter;
  private static int _masterCounter;

  public static Master mockMaster() {
    Master master = mock(Master.class);
    when(master.getMasterName()).thenReturn("master" + _masterCounter++);
    return master;
  }
View Full Code Here

    when(master.getMasterName()).thenReturn("master" + _masterCounter++);
    return master;
  }

  public static MasterQueue publishMaster(InteractionProtocol protocol) {
    Master master = mockMaster();
    return protocol.publishMaster(master);
  }
View Full Code Here

TOP

Related Classes of net.sf.katta.master.Master

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.