Search in sources :

Example 6 with InstallPrompt

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

the class RyaAdminCommandsTest method installWithAccumuloParameters_userAbort.

@Test
public void installWithAccumuloParameters_userAbort() throws DuplicateInstanceNameException, RyaClientException, IOException {
    // Mock the object that performs the install operation.
    final Install mockInstall = mock(Install.class);
    final RyaClient mockCommands = mock(RyaClient.class);
    when(mockCommands.getInstall()).thenReturn(mockInstall);
    final SharedShellState state = new SharedShellState();
    state.connectedToAccumulo(mock(AccumuloConnectionDetails.class), mockCommands);
    final String instanceName = "unitTests";
    final boolean enableTableHashPrefix = false;
    final boolean enableEntityCentricIndex = true;
    final boolean enableFreeTextIndex = false;
    final boolean enableTemporalIndex = false;
    final boolean enablePcjIndex = true;
    final String fluoPcjAppName = instanceName + "pcj_updater";
    // Execute the command.
    final InstallConfiguration installConfig = InstallConfiguration.builder().setEnableTableHashPrefix(enableTableHashPrefix).setEnableEntityCentricIndex(enableEntityCentricIndex).setEnableFreeTextIndex(enableFreeTextIndex).setEnableTemporalIndex(enableTemporalIndex).setEnablePcjIndex(enablePcjIndex).setFluoPcjAppName(fluoPcjAppName).build();
    final InstallPrompt mockInstallPrompt = mock(InstallPrompt.class);
    when(mockInstallPrompt.promptInstanceName()).thenReturn(instanceName);
    when(mockInstallPrompt.promptInstallConfiguration(instanceName)).thenReturn(installConfig);
    when(mockInstallPrompt.promptVerified(eq(instanceName), eq(installConfig))).thenReturn(false);
    final RyaAdminCommands commands = new RyaAdminCommands(state, mockInstallPrompt, mock(SparqlPrompt.class), mock(UninstallPrompt.class));
    final String message = commands.installWithAccumuloParameters(instanceName, enableTableHashPrefix, enableEntityCentricIndex, enableFreeTextIndex, enableTemporalIndex, enablePcjIndex, fluoPcjAppName);
    // Verify a message is returned that indicates the success of the operation.
    final String expected = "Skipping Installation.";
    assertEquals(expected, message);
}
Also used : AccumuloConnectionDetails(org.apache.rya.api.client.accumulo.AccumuloConnectionDetails) SparqlPrompt(org.apache.rya.shell.util.SparqlPrompt) RyaClient(org.apache.rya.api.client.RyaClient) Install(org.apache.rya.api.client.Install) InstallConfiguration(org.apache.rya.api.client.Install.InstallConfiguration) InstallPrompt(org.apache.rya.shell.util.InstallPrompt) UninstallPrompt(org.apache.rya.shell.util.UninstallPrompt) Test(org.junit.Test)

Aggregations

InstallConfiguration (org.apache.rya.api.client.Install.InstallConfiguration)6 InstallPrompt (org.apache.rya.shell.util.InstallPrompt)6 Test (org.junit.Test)6 Install (org.apache.rya.api.client.Install)4 RyaClient (org.apache.rya.api.client.RyaClient)4 SparqlPrompt (org.apache.rya.shell.util.SparqlPrompt)4 UninstallPrompt (org.apache.rya.shell.util.UninstallPrompt)4 AccumuloConnectionDetails (org.apache.rya.api.client.accumulo.AccumuloConnectionDetails)3 ShellState (org.apache.rya.shell.SharedShellState.ShellState)2 ApplicationContext (org.springframework.context.ApplicationContext)2 Bootstrap (org.springframework.shell.Bootstrap)2 CommandResult (org.springframework.shell.core.CommandResult)2 JLineShellComponent (org.springframework.shell.core.JLineShellComponent)2 MiniAccumuloCluster (org.apache.accumulo.minicluster.MiniAccumuloCluster)1 MongoConnectionDetails (org.apache.rya.api.client.mongo.MongoConnectionDetails)1 PasswordPrompt (org.apache.rya.shell.util.PasswordPrompt)1