Search in sources :

Example 1 with Uninstall

use of org.apache.rya.api.client.Uninstall in project incubator-rya by apache.

the class MongoUninstallIT method uninstall_instanceDoesNotExists.

@Test(expected = InstanceDoesNotExistException.class)
public void uninstall_instanceDoesNotExists() throws MongoException, RyaClientException {
    // Install an instance of Rya.
    final String instanceName = "testInstance_";
    // Uninstall the instance
    final RyaClient ryaClient = MongoRyaClientFactory.build(getConnectionDetails(), getMongoClient());
    final Uninstall uninstall = ryaClient.getUninstall();
    uninstall.uninstall(instanceName);
}
Also used : Uninstall(org.apache.rya.api.client.Uninstall) RyaClient(org.apache.rya.api.client.RyaClient) Test(org.junit.Test)

Example 2 with Uninstall

use of org.apache.rya.api.client.Uninstall 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 3 with Uninstall

use of org.apache.rya.api.client.Uninstall 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)

Example 4 with Uninstall

use of org.apache.rya.api.client.Uninstall in project incubator-rya by apache.

the class MongoUninstallIT method uninstall.

@Test
public void uninstall() throws MongoException, RyaClientException {
    // Install an instance of Rya.
    final String instanceName = "testInstance_";
    final InstallConfiguration installConfig = InstallConfiguration.builder().setEnableTableHashPrefix(true).setEnableEntityCentricIndex(true).setEnableFreeTextIndex(true).setEnableTemporalIndex(true).setEnablePcjIndex(true).setEnableGeoIndex(true).setFluoPcjAppName("fluo_app_name").build();
    final RyaClient ryaClient = MongoRyaClientFactory.build(getConnectionDetails(), getMongoClient());
    final Install install = ryaClient.getInstall();
    install.install(instanceName, installConfig);
    // Show that the instance exists.
    final InstanceExists instanceExists = ryaClient.getInstanceExists();
    assertTrue(instanceExists.exists(instanceName));
    // Uninstall the instance
    final Uninstall uninstall = ryaClient.getUninstall();
    uninstall.uninstall(instanceName);
    // Check that the instance no longer exists.
    assertFalse(instanceExists.exists(instanceName));
}
Also used : InstanceExists(org.apache.rya.api.client.InstanceExists) Uninstall(org.apache.rya.api.client.Uninstall) RyaClient(org.apache.rya.api.client.RyaClient) InstallConfiguration(org.apache.rya.api.client.Install.InstallConfiguration) Install(org.apache.rya.api.client.Install) Test(org.junit.Test)

Aggregations

RyaClient (org.apache.rya.api.client.RyaClient)4 Uninstall (org.apache.rya.api.client.Uninstall)4 Test (org.junit.Test)4 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 Install (org.apache.rya.api.client.Install)1 InstallConfiguration (org.apache.rya.api.client.Install.InstallConfiguration)1 InstanceExists (org.apache.rya.api.client.InstanceExists)1