use of org.apache.rya.api.client.Install.InstallConfiguration 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.InstallConfiguration 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.InstallConfiguration in project incubator-rya by apache.
the class MongoLoadStatementsIT method loadStatements.
/**
* Pass a list of statements to our loadStatement class.
*/
@Test
public void loadStatements() throws Exception {
// Install an instance of Rya.
final MongoConnectionDetails connectionDetails = getConnectionDetails();
final RyaClient ryaClient = MongoRyaClientFactory.build(connectionDetails, getMongoClient());
final InstallConfiguration installConfig = InstallConfiguration.builder().setEnableTableHashPrefix(false).setEnableEntityCentricIndex(false).setEnableFreeTextIndex(false).setEnableTemporalIndex(false).setEnablePcjIndex(false).setEnableGeoIndex(false).build();
ryaClient.getInstall().install(conf.getRyaInstanceName(), installConfig);
// Create the statements that will be loaded.
final Set<Statement> statements = makeTestStatements();
// Load them.
ryaClient.getLoadStatements().loadStatements(conf.getRyaInstanceName(), statements);
// Fetch the statements that have been stored in Mongo DB.
final Set<Statement> stmtResults = new HashSet<>();
final MongoCursor<Document> triplesIterator = getMongoClient().getDatabase(conf.getRyaInstanceName()).getCollection(conf.getTriplesCollectionName()).find().iterator();
while (triplesIterator.hasNext()) {
final Document triple = triplesIterator.next();
stmtResults.add(VF.createStatement(VF.createURI(triple.getString("subject")), VF.createURI(triple.getString("predicate")), VF.createURI(triple.getString("object"))));
}
// Show the discovered statements match the original statements.
assertEquals(statements, stmtResults);
}
use of org.apache.rya.api.client.Install.InstallConfiguration 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());
}
use of org.apache.rya.api.client.Install.InstallConfiguration 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);
}
Aggregations