Package net.sf.katta.node

Examples of net.sf.katta.node.Node


  @SuppressWarnings("unchecked")
  @Test(timeout = 10000)
  public void testMasterOperationPickup() throws Exception {
    Master master = new Master(_zk.getInteractionProtocol(), false);
    Node node = Mocks.mockNode();// leave safe mode
    _protocol.publishNode(node, new NodeMetaData("node1"));
    master.start();

    MasterOperation operation1 = mock(MasterOperation.class, withSettings().serializable());
    MasterOperation operation2 = mock(MasterOperation.class, withSettings().serializable());
View Full Code Here


  }

  @Test(timeout = 500000)
  public void testMasterChange_OnSessionReconnect() throws Exception {
    Master master = new Master(_zk.getInteractionProtocol(), false);
    Node node = Mocks.mockNode();// leave safe mode
    _protocol.publishNode(node, new NodeMetaData("node1"));
    master.start();
    TestUtil.waitUntilLeaveSafeMode(master);

    Master secMaster = new Master(_zk.getInteractionProtocol(), false);
View Full Code Here

  }

  @Test(timeout = 50000)
  public void testMasterChangeWhileDeploingIndex() throws Exception {
    Master master = new Master(_zk.getInteractionProtocol(), false);
    Node node = Mocks.mockNode();// leave safe mode
    NodeQueue nodeQueue = _protocol.publishNode(node, new NodeMetaData("node1"));
    master.start();
    TestUtil.waitUntilLeaveSafeMode(master);

    // phase I - until watchdog is running and its node turn
View Full Code Here

    Gateway gateway = new Gateway(GATEWAY_PORT, _zk.getServerPort());
    gateway.start();
    final ZkClient zkGatewayClient = ZkKattaUtil.startZkClient(gatewayConf, 30000);
    InteractionProtocol gatewayProtocol = new InteractionProtocol(zkGatewayClient, gatewayConf);
    FileUtil.deleteFolder(new NodeConfiguration().getShardFolder());
    final Node node = new Node(gatewayProtocol, new LuceneServer());
    node.start();

    // check node-master link
    master.start();
    TestUtil.waitUntilLeaveSafeMode(master);
    TestUtil.waitUntilNumberOfLiveNode(_protocol, 1);
    assertEquals(1, _protocol.getLiveNodes().size());

    // now break the node connection
    gateway.stop();
    TestUtil.waitUntilNumberOfLiveNode(_protocol, 0);

    // now fix the node connection
    gateway.start();
    TestUtil.waitUntilNumberOfLiveNode(_protocol, 1);

    // cleanup
    node.shutdown();
    master.shutdown();
    zkGatewayClient.close();
    gateway.stop();
  }
View Full Code Here

    }
    _protocol = new InteractionProtocol(_zkServer.getZkClient(), _zkConfiguration);
    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();
View Full Code Here

  }

  public Node startAdditionalNode() throws Exception {
    NodeConfiguration nodeConfiguration = new NodeConfiguration();
    nodeConfiguration.setStartPort(_nodeStartPort + _startedNodes);
    Node node = new Node(_protocol, nodeConfiguration, _contentServerClass.newInstance());
    _nodes.add(node);
    node.start();
    _startedNodes++;
    return node;
  }
View Full Code Here

  public int getStartedNodeCount() {
    return _startedNodes;
  }

  public Node shutdownNode(int i) {
    Node node = _nodes.remove(i);
    node.shutdown();
    return node;
  }
View Full Code Here

    node.shutdown();
    return node;
  }

  public Node restartNode(int i) {
    Node shutdownNode = getNode(i);
    NodeConfiguration nodeConfiguration = new NodeConfiguration();
    nodeConfiguration.setStartPort(shutdownNode.getRPCServerPort());
    shutdownNode(i);
    Node node = new Node(_protocol, nodeConfiguration, shutdownNode.getContext().getContentServer());
    node.start();
    _nodes.add(i, node);
    return node;
  }
View Full Code Here

    _nodes.add(i, node);
    return node;
  }

  public Node shutdownNodeRpc(int i) {
    Node node = _nodes.get(i);
    node.getRpcServer().stop();
    return node;
  }
View Full Code Here

    Master master = mockMaster();
    return protocol.publishMaster(master);
  }

  public static Node mockNode() {
    Node node = mock(Node.class);
    when(node.getName()).thenReturn("node" + _nodeCounter++);
    return node;
  }
View Full Code Here

TOP

Related Classes of net.sf.katta.node.Node

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.