Search in sources :

Example 1 with DeletePeriodicPCJ

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);
}
Also used : AccumuloConnectionDetails(org.apache.rya.api.client.accumulo.AccumuloConnectionDetails) SparqlPrompt(org.apache.rya.shell.util.SparqlPrompt) DeletePeriodicPCJ(org.apache.rya.api.client.DeletePeriodicPCJ) RyaClient(org.apache.rya.api.client.RyaClient) InstallPrompt(org.apache.rya.shell.util.InstallPrompt) UninstallPrompt(org.apache.rya.shell.util.UninstallPrompt) Test(org.junit.Test)

Aggregations

DeletePeriodicPCJ (org.apache.rya.api.client.DeletePeriodicPCJ)1 RyaClient (org.apache.rya.api.client.RyaClient)1 AccumuloConnectionDetails (org.apache.rya.api.client.accumulo.AccumuloConnectionDetails)1 InstallPrompt (org.apache.rya.shell.util.InstallPrompt)1 SparqlPrompt (org.apache.rya.shell.util.SparqlPrompt)1 UninstallPrompt (org.apache.rya.shell.util.UninstallPrompt)1 Test (org.junit.Test)1