Search in sources :

Example 6 with Install

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

the class MongoInstallIT method install_alreadyExists.

@Test(expected = DuplicateInstanceNameException.class)
public void install_alreadyExists() throws DuplicateInstanceNameException, RyaClientException {
    // Install an instance of Rya.
    final String instanceName = conf.getRyaInstanceName();
    final InstallConfiguration installConfig = InstallConfiguration.builder().build();
    final MongoConnectionDetails connectionDetails = getConnectionDetails();
    final RyaClient ryaClient = MongoRyaClientFactory.build(connectionDetails, getMongoClient());
    final Install install = ryaClient.getInstall();
    install.install(instanceName, installConfig);
    // Install it again throws expected error.
    install.install(instanceName, installConfig);
}
Also used : 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)

Example 7 with Install

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

the class MongoInstallIT method install_withAllIndexers.

@Test
public void install_withAllIndexers() throws DuplicateInstanceNameException, RyaClientException {
    // Install an instance of Rya.
    final String ryaInstance = conf.getMongoDBName();
    // Setup the connection details that were used for the embedded Mongo DB instance we are testing with.
    final MongoConnectionDetails connectionDetails = getConnectionDetails();
    // Check that the instance does not exist.
    final InstanceExists instanceExists = new MongoInstanceExists(getMongoClient());
    assertFalse(instanceExists.exists(ryaInstance));
    // Install an instance of Rya with all the valid options turned on.
    final InstallConfiguration installConfig = InstallConfiguration.builder().setEnableTableHashPrefix(true).setEnableFreeTextIndex(true).setEnableTemporalIndex(true).setEnableEntityCentricIndex(true).setEnableGeoIndex(true).setEnablePcjIndex(true).build();
    final RyaClient ryaClient = MongoRyaClientFactory.build(connectionDetails, getMongoClient());
    final Install install = ryaClient.getInstall();
    install.install(ryaInstance, installConfig);
    // Check that the instance exists.
    assertTrue(instanceExists.exists(ryaInstance));
    // Show that the expected collections were created within the database.
    final List<String> expected = Arrays.asList(INSTANCE_DETAILS_COLLECTION_NAME, "rya_triples");
    int count = 0;
    final List<String> found = new ArrayList<>();
    for (final String collection : getMongoClient().getDatabase(conf.getMongoDBName()).listCollectionNames()) {
        count += expected.contains(collection) ? 1 : 0;
        found.add(collection);
    }
    assertTrue("Tables missing from:" + expected + " actual:" + found, expected.size() == count);
    assertTrue("Instance should exist.", instanceExists.exists(ryaInstance));
}
Also used : InstanceExists(org.apache.rya.api.client.InstanceExists) ArrayList(java.util.ArrayList) 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)

Example 8 with Install

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

the class RyaAdminCommandsTest method installWithMongoParameters.

@Test
public void installWithMongoParameters() 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.connectedToMongo(mock(MongoConnectionDetails.class), mockCommands);
    final String instanceName = "unitTests";
    final boolean enableFreeTextIndex = false;
    final boolean enableTemporalIndex = false;
    final boolean enablePcjIndex = false;
    // Execute the command.
    final InstallConfiguration installConfig = InstallConfiguration.builder().setEnableFreeTextIndex(enableFreeTextIndex).setEnableTemporalIndex(enableTemporalIndex).setEnablePcjIndex(enablePcjIndex).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(true);
    final RyaAdminCommands commands = new RyaAdminCommands(state, mockInstallPrompt, mock(SparqlPrompt.class), mock(UninstallPrompt.class));
    final String message = commands.installWithMongoParameters(instanceName, enableFreeTextIndex, enableTemporalIndex, enablePcjIndex);
    // Verify the values that were provided to the command were passed through to the Install.
    verify(mockInstall).install(eq(instanceName), eq(installConfig));
    // Verify a message is returned that indicates the success of the operation.
    final String expected = "The Rya instance named 'unitTests' has been installed.";
    assertEquals(expected, message);
}
Also used : MongoConnectionDetails(org.apache.rya.api.client.mongo.MongoConnectionDetails) 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)

Example 9 with Install

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

the class RyaAdminCommandsTest method installWithAccumuloParameters.

@Test
public void installWithAccumuloParameters() 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(true);
    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 the values that were provided to the command were passed through to the Install.
    verify(mockInstall).install(eq(instanceName), eq(installConfig));
    // Verify a message is returned that indicates the success of the operation.
    final String expected = "The Rya instance named 'unitTests' has been installed.";
    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)

Example 10 with Install

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

Install (org.apache.rya.api.client.Install)22 InstallConfiguration (org.apache.rya.api.client.Install.InstallConfiguration)20 Test (org.junit.Test)20 RyaClient (org.apache.rya.api.client.RyaClient)17 CreatePCJ (org.apache.rya.api.client.CreatePCJ)4 RyaDetails (org.apache.rya.api.instance.RyaDetails)4 InstallPrompt (org.apache.rya.shell.util.InstallPrompt)4 SparqlPrompt (org.apache.rya.shell.util.SparqlPrompt)4 UninstallPrompt (org.apache.rya.shell.util.UninstallPrompt)4 ArrayList (java.util.ArrayList)3 InstanceExists (org.apache.rya.api.client.InstanceExists)3 AccumuloConnectionDetails (org.apache.rya.api.client.accumulo.AccumuloConnectionDetails)3 AccumuloCreatePCJ (org.apache.rya.api.client.accumulo.AccumuloCreatePCJ)3 Date (java.util.Date)2 GetInstanceDetails (org.apache.rya.api.client.GetInstanceDetails)2 ListInstances (org.apache.rya.api.client.ListInstances)2 EntityCentricIndexDetails (org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails)2 FreeTextIndexDetails (org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails)2 JoinSelectivityDetails (org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails)2 PCJDetails (org.apache.rya.api.instance.RyaDetails.PCJIndexDetails.PCJDetails)2