use of org.apache.rya.api.client.DeletePeriodicPCJ in project incubator-rya by apache.
the class RyaAdminCommandsTest method deletePeriodicPCJ.
@Test
public void deletePeriodicPCJ() throws InstanceDoesNotExistException, RyaClientException {
// Mock the object that performs the delete operation.
final DeletePeriodicPCJ mockDeletePCJ = mock(DeletePeriodicPCJ.class);
final RyaClient mockCommands = mock(RyaClient.class);
when(mockCommands.getDeletePeriodicPCJ()).thenReturn(java.util.Optional.of(mockDeletePCJ));
final SharedShellState state = new SharedShellState();
state.connectedToAccumulo(mock(AccumuloConnectionDetails.class), mockCommands);
final String instanceName = "unitTests";
state.connectedToInstance(instanceName);
// Execute the command.
final String pcjId = "123412342";
final String topic = "topic";
final String brokers = "brokers";
final RyaAdminCommands commands = new RyaAdminCommands(state, mock(InstallPrompt.class), mock(SparqlPrompt.class), mock(UninstallPrompt.class));
final String message = commands.deletePeriodicPcj(pcjId, topic, brokers);
// Verify the values that were provided to the command were passed through to the DeletePCJ.
verify(mockDeletePCJ).deletePeriodicPCJ(eq(instanceName), eq(pcjId), eq(topic), eq(brokers));
// Verify a message is returned that explains what was deleted.
final String expected = "The Periodic PCJ has been deleted.";
assertEquals(expected, message);
}
Aggregations