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"));
}
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"));
}
Aggregations