Search in sources :

Example 1 with UninstallPrompt

use of org.apache.rya.shell.util.UninstallPrompt in project incubator-rya by apache.

the class RyaAdminCommandsTest method uninstall_no.

@Test
public void uninstall_no() throws Exception {
    // Mock the object that performs the Uninstall command.
    final Uninstall mockUninstall = mock(Uninstall.class);
    // Mock a prompt that says the user does want to uninstall it.
    final UninstallPrompt uninstallPrompt = mock(UninstallPrompt.class);
    when(uninstallPrompt.promptAreYouSure(eq("test_instance"))).thenReturn(false);
    final RyaClient mockClient = mock(RyaClient.class);
    when(mockClient.getUninstall()).thenReturn(mockUninstall);
    final SharedShellState state = new SharedShellState();
    state.connectedToAccumulo(mock(AccumuloConnectionDetails.class), mockClient);
    state.connectedToInstance("test_instance");
    // Execute the command.
    final RyaAdminCommands commands = new RyaAdminCommands(state, mock(InstallPrompt.class), mock(SparqlPrompt.class), uninstallPrompt);
    commands.uninstall();
    // Verify the request was forwarded to the client.
    verify(mockUninstall, never()).uninstall(eq("test_instance"));
}
Also used : AccumuloConnectionDetails(org.apache.rya.api.client.accumulo.AccumuloConnectionDetails) SparqlPrompt(org.apache.rya.shell.util.SparqlPrompt) Uninstall(org.apache.rya.api.client.Uninstall) 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)

Example 2 with UninstallPrompt

use of org.apache.rya.shell.util.UninstallPrompt in project incubator-rya by apache.

the class RyaAdminCommandsTest method uninstall_yes.

@Test
public void uninstall_yes() throws Exception {
    // Mock the object that performs the Uninstall command.
    final Uninstall mockUninstall = mock(Uninstall.class);
    // Mock a prompt that says the user does want to uninstall it.
    final UninstallPrompt uninstallPrompt = mock(UninstallPrompt.class);
    when(uninstallPrompt.promptAreYouSure(eq("test_instance"))).thenReturn(true);
    final RyaClient mockClient = mock(RyaClient.class);
    when(mockClient.getUninstall()).thenReturn(mockUninstall);
    final SharedShellState state = new SharedShellState();
    state.connectedToAccumulo(mock(AccumuloConnectionDetails.class), mockClient);
    state.connectedToInstance("test_instance");
    // Execute the command.
    final RyaAdminCommands commands = new RyaAdminCommands(state, mock(InstallPrompt.class), mock(SparqlPrompt.class), uninstallPrompt);
    commands.uninstall();
    // Verify the request was forwarded to the client.
    verify(mockUninstall).uninstall(eq("test_instance"));
}
Also used : AccumuloConnectionDetails(org.apache.rya.api.client.accumulo.AccumuloConnectionDetails) SparqlPrompt(org.apache.rya.shell.util.SparqlPrompt) Uninstall(org.apache.rya.api.client.Uninstall) 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

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