Package net.sf.katta.protocol

Examples of net.sf.katta.protocol.MasterQueue


      assertEquals(0, nodeqQueue.size());
    }

    // node completion does not add another balance op since not enough nodes
    // are there
    MasterQueue masterQueue = _protocol.publishMaster(Mocks.mockMaster());
    assertEquals(0, masterQueue.size());
    balanceOperation.nodeOperationsComplete(_context, Collections.EMPTY_LIST);
    assertEquals(0, masterQueue.size());

    // add node and now the balance op should add itself for retry
    Node node3 = Mocks.mockNode();
    NodeQueue nodeQueue3 = Mocks.publisNode(_protocol, node3);
    balanceOperation.nodeOperationsComplete(_context, Collections.EMPTY_LIST);
    assertEquals(1, masterQueue.size());

    // now do the balance
    assertEquals(0, nodeQueue3.size());
    balanceOperation.execute(_context, EMPTY_LIST);
    assertEquals(1, nodeQueue3.size());
    publisShard(node3, nodeQueue3);

    // now it shouldn't add itself again since the index is balanced
    balanceOperation.nodeOperationsComplete(_context, Collections.EMPTY_LIST);
    assertEquals(1, masterQueue.size());
  }
View Full Code Here


  @Test
  public void testMockRemove() throws Exception {
    String nodeName = "nodeA";
    String someOldShard = AbstractIndexOperation.createShardName("someOldIndex", "someOldShard");
    InteractionProtocol protocol = mock(InteractionProtocol.class);
    MasterQueue queue = mock(MasterQueue.class);
    MasterContext context = new MasterContext(protocol, Mocks.mockMaster(), new DefaultDistributionPolicy(), queue);
    when(protocol.getNodeShards(nodeName)).thenReturn(Arrays.asList(someOldShard));

    RemoveObsoleteShardsOperation operation = new RemoveObsoleteShardsOperation(nodeName);
    operation.execute(context, EMPTY_LIST);
View Full Code Here

  public void testNotRemoveDeployingIndex() throws Exception {
    String nodeName = "nodeA";
    String indexName = "someOldIndex";
    String someOldShard = AbstractIndexOperation.createShardName(indexName, "someOldShard");
    InteractionProtocol protocol = mock(InteractionProtocol.class);
    MasterQueue queue = mock(MasterQueue.class);
    MasterContext context = new MasterContext(protocol, Mocks.mockMaster(), new DefaultDistributionPolicy(), queue);
    when(protocol.getNodeShards(nodeName)).thenReturn(Arrays.asList(someOldShard));

    RemoveObsoleteShardsOperation operation = new RemoveObsoleteShardsOperation(nodeName);
    operation.execute(context, new ArrayList<MasterOperation>(Arrays.asList(new IndexDeployOperation(indexName, "path",
View Full Code Here

TOP

Related Classes of net.sf.katta.protocol.MasterQueue

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.