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