use of org.apache.rya.api.client.Install in project incubator-rya by apache.
the class FluoITBase method setupRya.
/**
* Sets up a Rya instance.
*/
protected RyaSailRepository setupRya() throws AccumuloException, AccumuloSecurityException, RepositoryException, RyaDAOException, NumberFormatException, UnknownHostException, InferenceEngineException, AlreadyInitializedException, RyaDetailsRepositoryException, DuplicateInstanceNameException, RyaClientException, SailException {
checkNotNull(instanceName);
checkNotNull(zookeepers);
// Setup Rya configuration values.
final AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration();
conf.setTablePrefix(getRyaInstanceName());
conf.setDisplayQueryPlan(true);
conf.setBoolean(ConfigUtils.USE_MOCK_INSTANCE, false);
conf.set(ConfigUtils.CLOUDBASE_USER, clusterInstance.getUsername());
conf.set(ConfigUtils.CLOUDBASE_PASSWORD, clusterInstance.getPassword());
conf.set(ConfigUtils.CLOUDBASE_INSTANCE, clusterInstance.getInstanceName());
conf.set(ConfigUtils.CLOUDBASE_ZOOKEEPERS, clusterInstance.getZookeepers());
conf.set(ConfigUtils.USE_PCJ, "true");
conf.set(ConfigUtils.FLUO_APP_NAME, getRyaInstanceName());
conf.set(ConfigUtils.PCJ_STORAGE_TYPE, PrecomputedJoinIndexerConfig.PrecomputedJoinStorageType.ACCUMULO.toString());
conf.set(ConfigUtils.PCJ_UPDATER_TYPE, PrecomputedJoinIndexerConfig.PrecomputedJoinUpdaterType.FLUO.toString());
conf.set(ConfigUtils.CLOUDBASE_AUTHS, "");
// Install the test instance of Rya.
final Install install = new AccumuloInstall(createConnectionDetails(), accumuloConn);
final InstallConfiguration installConfig = InstallConfiguration.builder().setEnableTableHashPrefix(true).setEnableEntityCentricIndex(true).setEnableFreeTextIndex(true).setEnableTemporalIndex(true).setEnablePcjIndex(true).setEnableGeoIndex(true).setFluoPcjAppName(getRyaInstanceName()).build();
install.install(getRyaInstanceName(), installConfig);
// Connect to the instance of Rya that was just installed.
final Sail sail = RyaSailFactory.getInstance(conf);
final RyaSailRepository ryaRepo = new RyaSailRepository(sail);
return ryaRepo;
}
use of org.apache.rya.api.client.Install in project incubator-rya by apache.
the class AccumuloListInstancesIT method listInstances_hasRyaDetailsTable.
@Test
public void listInstances_hasRyaDetailsTable() throws AccumuloException, AccumuloSecurityException, RyaClientException {
// Install a few instances of Rya using the install command.
final AccumuloConnectionDetails connectionDetails = new AccumuloConnectionDetails(getUsername(), getPassword().toCharArray(), getInstanceName(), getZookeepers());
final Install install = new AccumuloInstall(connectionDetails, getConnector());
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 AccumuloListInstances(connectionDetails, getConnector());
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 MongoLoadStatementsFileIT method loadTurtleFile.
@Test
public void loadTurtleFile() throws Exception {
// Install an instance of Rya.
final InstallConfiguration installConfig = InstallConfiguration.builder().setEnableTableHashPrefix(false).setEnableEntityCentricIndex(false).setEnableFreeTextIndex(false).setEnableTemporalIndex(false).setEnablePcjIndex(false).setEnableGeoIndex(false).build();
final MongoConnectionDetails connectionDetails = getConnectionDetails();
final RyaClient ryaClient = MongoRyaClientFactory.build(connectionDetails, getMongoClient());
final Install install = ryaClient.getInstall();
install.install(conf.getRyaInstanceName(), installConfig);
// Load the test statement file.
ryaClient.getLoadStatementsFile().loadStatements(conf.getRyaInstanceName(), Paths.get("src/test/resources/example.ttl"), RDFFormat.TURTLE);
// Verify that the statements were loaded.
final ValueFactory vf = new ValueFactoryImpl();
final Set<Statement> expected = new HashSet<>();
expected.add(vf.createStatement(vf.createURI("http://example#alice"), vf.createURI("http://example#talksTo"), vf.createURI("http://example#bob")));
expected.add(vf.createStatement(vf.createURI("http://example#bob"), vf.createURI("http://example#talksTo"), vf.createURI("http://example#charlie")));
expected.add(vf.createStatement(vf.createURI("http://example#charlie"), vf.createURI("http://example#likes"), vf.createURI("http://example#icecream")));
final Set<Statement> statements = new HashSet<>();
final MongoCursor<Document> triplesIterator = getMongoClient().getDatabase(conf.getRyaInstanceName()).getCollection(conf.getTriplesCollectionName()).find().iterator();
while (triplesIterator.hasNext()) {
final Document triple = triplesIterator.next();
statements.add(vf.createStatement(vf.createURI(triple.getString("subject")), vf.createURI(triple.getString("predicate")), vf.createURI(triple.getString("object"))));
}
assertEquals(expected, statements);
}
use of org.apache.rya.api.client.Install in project incubator-rya by apache.
the class MongoSetRyaStreamsConfigurationIT method updatesRyaDetails.
@Test
public void updatesRyaDetails() throws Exception {
final RyaClient ryaClient = MongoRyaClientFactory.build(getConnectionDetails(), getMongoClient());
// Install an instance of Rya.
final String ryaInstance = conf.getRyaInstanceName();
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 in project incubator-rya by apache.
the class AccumuloCreatePCJIT method createPCJ_invalidSparql.
@Test(expected = RyaClientException.class)
public void createPCJ_invalidSparql() throws DuplicateInstanceNameException, RyaClientException {
// Install an instance of Rya.
final InstallConfiguration installConfig = InstallConfiguration.builder().setEnableTableHashPrefix(true).setEnableEntityCentricIndex(false).setEnableFreeTextIndex(false).setEnableTemporalIndex(false).setEnablePcjIndex(true).setEnableGeoIndex(false).setFluoPcjAppName(getRyaInstanceName()).build();
final Install install = new AccumuloInstall(createConnectionDetails(), accumuloConn);
install.install(getRyaInstanceName(), installConfig);
// Create a PCJ using invalid SPARQL.
final CreatePCJ createPCJ = new AccumuloCreatePCJ(createConnectionDetails(), accumuloConn);
createPCJ.createPCJ(getRyaInstanceName(), "not valid sparql");
}
Aggregations