use of org.apache.rya.api.client.Install.InstallConfiguration 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.InstallConfiguration in project incubator-rya by apache.
the class RyaAdminCommands method installWithAccumuloParameters.
@CliCommand(value = INSTALL_ACCUMULO_PARAMETERS_CMD, help = "Create a new Accumulo instance of Rya with command line parameters.")
public String installWithAccumuloParameters(@CliOption(key = { "instanceName" }, mandatory = true, help = "The name of the Rya instance to create.") final String instanceName, @CliOption(key = { "enableTableHashPrefix" }, mandatory = false, help = "Use Shard Balancing (improves streamed input write speeds).", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") final boolean enableTableHashPrefix, @CliOption(key = { "enableEntityCentricIndex" }, mandatory = false, help = "Use Entity Centric Indexing.", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") final boolean enableEntityCentricIndex, @CliOption(key = { "enableFreeTextIndex" }, mandatory = false, help = "Use Free Text Indexing.", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") final boolean enableFreeTextIndex, @CliOption(key = { "enableTemporalIndex" }, mandatory = false, help = "Use Temporal Indexing.", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") final boolean enableTemporalIndex, @CliOption(key = { "enablePcjIndex" }, mandatory = false, help = "Use Precomputed Join (PCJ) Indexing.", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") final boolean enablePcjIndex, @CliOption(key = { "fluoPcjAppName" }, mandatory = false, help = "Fluo Application Name for PCJ Index Updater (fluo app must be initialized and enablePcjIndex=true).") final String fluoPcjAppName) {
// Fetch the commands that are connected to the store.
final RyaClient commands = state.getShellState().getConnectedCommands().get();
try {
final InstallConfiguration installConfig = InstallConfiguration.builder().setEnableTableHashPrefix(enableTableHashPrefix).setEnableEntityCentricIndex(enableEntityCentricIndex).setEnableFreeTextIndex(enableFreeTextIndex).setEnableTemporalIndex(enableTemporalIndex).setEnablePcjIndex(enablePcjIndex).setFluoPcjAppName(fluoPcjAppName).build();
// Verify the configuration is what the user actually wants to do.
if (!installPrompt.promptVerified(instanceName, installConfig)) {
return "Skipping Installation.";
}
// Execute the command.
commands.getInstall().install(instanceName, installConfig);
return String.format("The Rya instance named '%s' has been installed.", instanceName);
} catch (final DuplicateInstanceNameException e) {
throw new RuntimeException(String.format("A Rya instance named '%s' already exists. Try again with a different name.", instanceName), e);
} catch (final IOException | RyaClientException e) {
throw new RuntimeException("Could not install a new instance of Rya. Reason: " + e.getMessage(), e);
}
}
use of org.apache.rya.api.client.Install.InstallConfiguration in project incubator-rya by apache.
the class RyaAdminCommands method installWithMongoParameters.
@CliCommand(value = INSTALL_MONGO_PARAMETERS_CMD, help = "Create a new MongoDB instance of Rya with command line parameters.")
public String installWithMongoParameters(@CliOption(key = { "instanceName" }, mandatory = true, help = "The name of the Rya instance to create.") final String instanceName, @CliOption(key = { "enableFreeTextIndex" }, mandatory = false, help = "Use Free Text Indexing.", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") final boolean enableFreeTextIndex, @CliOption(key = { "enableTemporalIndex" }, mandatory = false, help = "Use Temporal Indexing.", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") final boolean enableTemporalIndex, @CliOption(key = { "enablePcjIndex" }, mandatory = false, help = "Use Precomputed Join (PCJ) Indexing.", unspecifiedDefaultValue = "false", specifiedDefaultValue = "true") final boolean enablePcjIndex) {
// Fetch the commands that are connected to the store.
final RyaClient commands = state.getShellState().getConnectedCommands().get();
try {
final InstallConfiguration installConfig = InstallConfiguration.builder().setEnableFreeTextIndex(enableFreeTextIndex).setEnableTemporalIndex(enableTemporalIndex).setEnablePcjIndex(enablePcjIndex).build();
// Verify the configuration is what the user actually wants to do.
if (!installPrompt.promptVerified(instanceName, installConfig)) {
return "Skipping Installation.";
}
// Execute the command.
commands.getInstall().install(instanceName, installConfig);
return String.format("The Rya instance named '%s' has been installed.", instanceName);
} catch (final DuplicateInstanceNameException e) {
throw new RuntimeException(String.format("A Rya instance named '%s' already exists. Try again with a different name.", instanceName), e);
} catch (final IOException | RyaClientException e) {
throw new RuntimeException("Could not install a new instance of Rya. Reason: " + e.getMessage(), e);
}
}
use of org.apache.rya.api.client.Install.InstallConfiguration 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.InstallConfiguration 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);
}
Aggregations