Package net.sf.katta.master

Examples of net.sf.katta.master.MasterContext


    LoadTestMasterOperation operation = new LoadTestMasterOperation(nodeCount, 10, 20, 2, 20000, _queryExecutor,
            _temporaryFolder.newFolder("result"));
    operation.execute(_context, Collections.EMPTY_LIST);

    _master = Mocks.mockMaster();
    _context = new MasterContext(_protocol, _master, new DefaultDistributionPolicy(), _queue);
    operation.execute(_context, Collections.EMPTY_LIST);
  }
View Full Code Here


    NodeQueue nodeQueue3 = Mocks.publisNode(_protocol, node3);
    assertEquals(0, nodeQueue3.size());
    BalanceIndexOperation balanceOperation = new BalanceIndexOperation(_indexName);
    FileSystem fileSystem = mock(FileSystem.class);
    when(fileSystem.exists(any(Path.class))).thenReturn(false);
    MasterContext spiedContext = spy(_context);
    doReturn(fileSystem).when(spiedContext).getFileSystem(any(IndexMetaData.class));
    List<OperationId> nodeOperations = balanceOperation.execute(spiedContext, EMPTY_LIST);
    assertEquals(null, nodeOperations);
  }
View Full Code Here

    // add node and then balance again
    Node node3 = Mocks.mockNode();
    NodeQueue nodeQueue3 = Mocks.publisNode(_protocol, node3);
    assertEquals(0, nodeQueue3.size());
    BalanceIndexOperation balanceOperation = new BalanceIndexOperation(_indexName);
    MasterContext spiedContext = spy(_context);
    doThrow(new RuntimeException("test-exception")).when(spiedContext).getFileSystem(any(IndexMetaData.class));
    List<OperationId> nodeOperations = balanceOperation.execute(spiedContext, EMPTY_LIST);
    assertEquals(null, nodeOperations);
  }
View Full Code Here

  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

    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",
            1))));
View Full Code Here

TOP

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

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.