use of org.apache.rya.api.client.Install in project incubator-rya by apache.
the class RyaAdminCommandsTest method install.
@Test
public void install() 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);
// Execute the command.
final String instanceName = "unitTests";
final InstallConfiguration installConfig = InstallConfiguration.builder().setEnableGeoIndex(true).setEnablePcjIndex(true).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.install();
// 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 MongoDeletePCJIT method deletePCJ.
@Test
public void deletePCJ() throws Exception {
final MongoConnectionDetails connectionDetails = getConnectionDetails();
final RyaClient ryaClient = MongoRyaClientFactory.build(connectionDetails, getMongoClient());
// Initialize the commands that will be used by this test.
final CreatePCJ createPCJ = ryaClient.getCreatePCJ();
final Install installRya = ryaClient.getInstall();
final InstallConfiguration installConf = InstallConfiguration.builder().setEnablePcjIndex(true).build();
installRya.install(conf.getRyaInstanceName(), installConf);
System.out.println(getMongoClient().getDatabase(conf.getRyaInstanceName()).getCollection("instance_details").find().first().toJson());
// Create a PCJ.
final String sparql = "SELECT ?x " + "WHERE { " + "?x <http://talksTo> <http://Eve>. " + "?x <http://worksAt> <http://TacoJoint>." + "}";
final String pcjId = createPCJ.createPCJ(conf.getRyaInstanceName(), sparql);
final DeletePCJ deletePCJ = ryaClient.getDeletePCJ();
deletePCJ.deletePCJ(conf.getRyaInstanceName(), pcjId);
// Verify the RyaDetails were updated to include the new PCJ.
final Optional<RyaDetails> ryaDetails = ryaClient.getGetInstanceDetails().getDetails(conf.getRyaInstanceName());
final ImmutableMap<String, PCJDetails> details = ryaDetails.get().getPCJIndexDetails().getPCJDetails();
final PCJDetails pcjDetails = details.get(pcjId);
assertNull(pcjDetails);
}
use of org.apache.rya.api.client.Install in project incubator-rya by apache.
the class MongoGetInstanceDetailsIT method getDetails.
@Test
public void getDetails() throws MongoException, RyaClientException {
final String instanceName = "instance";
// Install an instance of Rya.
final InstallConfiguration installConfig = InstallConfiguration.builder().setEnableTableHashPrefix(true).setEnableEntityCentricIndex(true).setEnableFreeTextIndex(true).setEnableTemporalIndex(true).setEnablePcjIndex(true).build();
final RyaClient ryaClient = MongoRyaClientFactory.build(getConnectionDetails(), getMongoClient());
final Install install = ryaClient.getInstall();
install.install(instanceName, installConfig);
// Verify the correct details were persisted.
final GetInstanceDetails getInstanceDetails = ryaClient.getGetInstanceDetails();
final Optional<RyaDetails> details = getInstanceDetails.getDetails(instanceName);
final RyaDetails expectedDetails = RyaDetails.builder().setRyaInstanceName(instanceName).setRyaVersion(details.get().getRyaVersion()).setTemporalIndexDetails(new TemporalIndexDetails(true)).setFreeTextDetails(new FreeTextIndexDetails(true)).setEntityCentricIndexDetails(new EntityCentricIndexDetails(false)).setPCJIndexDetails(PCJIndexDetails.builder().setEnabled(true)).setProspectorDetails(new ProspectorDetails(Optional.<Date>absent())).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.<Date>absent())).build();
assertEquals(expectedDetails, details.get());
}
use of org.apache.rya.api.client.Install in project incubator-rya by apache.
the class MongoListInstancesIT method listInstances_hasRyaDetailsTable.
@Test
public void listInstances_hasRyaDetailsTable() throws MongoException, DuplicateInstanceNameException, RyaClientException {
// Install a few instances of Rya using the install command.
final RyaClient ryaClient = MongoRyaClientFactory.build(getConnectionDetails(), getMongoClient());
final Install install = ryaClient.getInstall();
install.install("instance1_", InstallConfiguration.builder().build());
install.install("instance2_", InstallConfiguration.builder().build());
install.install("instance3_", InstallConfiguration.builder().build());
// Fetch the list and verify it matches what is expected.
final ListInstances listInstances = new MongoListInstances(getMongoClient());
final List<String> instances = listInstances.listInstances();
Collections.sort(instances);
final List<String> expected = Lists.newArrayList("instance1_", "instance2_", "instance3_");
assertEquals(expected, instances);
}
use of org.apache.rya.api.client.Install in project incubator-rya by apache.
the class AccumuloSetRyaStreamsConfigurationIT method updatesRyaDetails.
@Test
public void updatesRyaDetails() throws Exception {
final String ryaInstance = getRyaInstanceName();
final AccumuloConnectionDetails connectionDetails = new AccumuloConnectionDetails(getUsername(), getPassword().toCharArray(), getInstanceName(), getZookeepers());
final RyaClient ryaClient = AccumuloRyaClientFactory.build(connectionDetails, getConnector());
// Install an instance of Rya.
final Install installRya = ryaClient.getInstall();
final InstallConfiguration installConf = InstallConfiguration.builder().build();
installRya.install(ryaInstance, installConf);
// Fetch its details and show they do not have any RyaStreamsDetails.
com.google.common.base.Optional<RyaStreamsDetails> streamsDetails = ryaClient.getGetInstanceDetails().getDetails(ryaInstance).get().getRyaStreamsDetails();
assertFalse(streamsDetails.isPresent());
// Set the details.
final RyaStreamsDetails details = new RyaStreamsDetails("localhost", 6);
ryaClient.getSetRyaStreamsConfiguration().setRyaStreamsConfiguration(ryaInstance, details);
// Fetch its details again and show that they are now filled in.
streamsDetails = ryaClient.getGetInstanceDetails().getDetails(ryaInstance).get().getRyaStreamsDetails();
assertEquals(details, streamsDetails.get());
}
Aggregations