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))));