Package net.sf.katta.operation.node

Examples of net.sf.katta.operation.node.NodeOperation


    NodeQueue queue = _protocol.publishNode(node, new NodeMetaData(node.getName()));
    assertNotNull(queue);
    assertNotNull(_protocol.getNodeMD(node.getName()));

    // test operation
    NodeOperation operation = mock(NodeOperation.class);
    OperationId operationId = _protocol.addNodeOperation(node.getName(), operation);
    assertEquals(1, queue.size());
    assertNotNull(queue.peek());
    assertEquals(node.getName(), operationId.getNodeName());
  }
View Full Code Here


    _processor.run();
  }

  @Test(timeout = 10000)
  public void testInterruptedException_Operation() throws Exception {
    NodeOperation nodeOperation = mock(NodeOperation.class);
    when(_queue.peek()).thenReturn(nodeOperation);
    when(nodeOperation.execute(_context)).thenThrow(new InterruptedException());
    _processor.run();
  }
View Full Code Here

    _processor.run();
  }

  @Test(timeout = 10000)
  public void testInterruptedException_Operation_ZK() throws Exception {
    NodeOperation nodeOperation = mock(NodeOperation.class);
    when(_queue.peek()).thenReturn(nodeOperation);
    when(nodeOperation.execute(_context)).thenThrow(new ZkInterruptedException(new InterruptedException()));
    _processor.run();
  }
View Full Code Here

  @Test(timeout = 10000)
  public void testNodeOperationPickup() throws Exception {
    Node node = new Node(_zk.getInteractionProtocol(), new LuceneServer());
    node.start();

    NodeOperation operation1 = mock(NodeOperation.class, withSettings().serializable());
    NodeOperation operation2 = mock(NodeOperation.class, withSettings().serializable());

    SerializableCountDownLatchAnswer answer = new SerializableCountDownLatchAnswer(2);
    when(operation1.execute((NodeContext) notNull())).thenAnswer(answer);
    when(operation2.execute((NodeContext) notNull())).thenAnswer(answer);
    _protocol.addNodeOperation(node.getName(), operation1);
    _protocol.addNodeOperation(node.getName(), operation2);
    answer.getCountDownLatch().await();

    node.shutdown();
View Full Code Here

    Node node = new Node(_zk.getInteractionProtocol(), new LuceneServer());
    node.start();

    node.disconnect();
    node.reconnect();
    NodeOperation operation1 = mock(NodeOperation.class, withSettings().serializable());
    NodeOperation operation2 = mock(NodeOperation.class, withSettings().serializable());

    SerializableCountDownLatchAnswer answer = new SerializableCountDownLatchAnswer(2);
    when(operation1.execute((NodeContext) notNull())).thenAnswer(answer);
    when(operation2.execute((NodeContext) notNull())).thenAnswer(answer);
    _protocol.addNodeOperation(node.getName(), operation1);
    _protocol.addNodeOperation(node.getName(), operation2);
    answer.getCountDownLatch().await();

    node.shutdown();
View Full Code Here

  @Test(timeout = 10000)
  public void testNodeOperationException() throws Exception {
    Node node = new Node(_zk.getInteractionProtocol(), new LuceneServer());
    node.start();

    NodeOperation operation1 = mock(NodeOperation.class, withSettings().serializable());
    NodeOperation operation2 = mock(NodeOperation.class, withSettings().serializable());

    SerializableCountDownLatchAnswer answer = new SerializableCountDownLatchAnswer(2);
    when(operation1.execute((NodeContext) notNull())).thenAnswer(answer);
    when(operation2.execute((NodeContext) notNull())).thenAnswer(answer);
    _protocol.addNodeOperation(node.getName(), operation1);
    _protocol.addNodeOperation(node.getName(), operation2);
    answer.getCountDownLatch().await();

    node.shutdown();
View Full Code Here

    operation.execute(_context, EMPTY_LIST);

    // now complete the deployment
    List<OperationResult> results = new ArrayList<OperationResult>();
    for (NodeQueue nodeQueue : nodeQueues) {
      NodeOperation nodeOperation = nodeQueue.peek();
      DeployResult deployResult = new DeployResult(_indexName);
      Set<String> nodeShards = ((ShardDeployOperation) nodeOperation).getShardNames();
      for (String shardName : nodeShards) {
        deployResult.addShardException(shardName, new Exception());
      }
View Full Code Here

    // check results
    Set<String> shards = new HashSet<String>();
    int shardOnNodeCount = 0;
    for (NodeQueue nodeQueue : nodeQueues) {
      assertEquals(1, nodeQueue.size());
      NodeOperation nodeOperation = nodeQueue.peek();
      assertNotNull(nodeOperation);
      assertTrue(nodeOperation instanceof ShardDeployOperation);

      Set<String> nodeShards = ((ShardDeployOperation) nodeOperation).getShardNames();
      assertEquals(_shardCount, nodeShards.size());
View Full Code Here

TOP

Related Classes of net.sf.katta.operation.node.NodeOperation

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.