Search in sources :

Example 11 with Install

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;
}
Also used : AccumuloInstall(org.apache.rya.api.client.accumulo.AccumuloInstall) Sail(org.openrdf.sail.Sail) RyaSailRepository(org.apache.rya.rdftriplestore.RyaSailRepository) AccumuloRdfConfiguration(org.apache.rya.accumulo.AccumuloRdfConfiguration) AccumuloInstall(org.apache.rya.api.client.accumulo.AccumuloInstall) Install(org.apache.rya.api.client.Install) InstallConfiguration(org.apache.rya.api.client.Install.InstallConfiguration)

Example 12 with Install

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);
}
Also used : ListInstances(org.apache.rya.api.client.ListInstances) Install(org.apache.rya.api.client.Install) Test(org.junit.Test)

Example 13 with Install

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);
}
Also used : Statement(org.openrdf.model.Statement) ValueFactoryImpl(org.openrdf.model.impl.ValueFactoryImpl) RyaClient(org.apache.rya.api.client.RyaClient) ValueFactory(org.openrdf.model.ValueFactory) Document(org.bson.Document) InstallConfiguration(org.apache.rya.api.client.Install.InstallConfiguration) Install(org.apache.rya.api.client.Install) HashSet(java.util.HashSet) Test(org.junit.Test)

Example 14 with Install

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());
}
Also used : RyaStreamsDetails(org.apache.rya.api.instance.RyaDetails.RyaStreamsDetails) RyaClient(org.apache.rya.api.client.RyaClient) Install(org.apache.rya.api.client.Install) InstallConfiguration(org.apache.rya.api.client.Install.InstallConfiguration) Test(org.junit.Test)

Example 15 with Install

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");
}
Also used : CreatePCJ(org.apache.rya.api.client.CreatePCJ) InstallConfiguration(org.apache.rya.api.client.Install.InstallConfiguration) Install(org.apache.rya.api.client.Install) Test(org.junit.Test)

Aggregations

Install (org.apache.rya.api.client.Install)22 InstallConfiguration (org.apache.rya.api.client.Install.InstallConfiguration)20 Test (org.junit.Test)20 RyaClient (org.apache.rya.api.client.RyaClient)17 CreatePCJ (org.apache.rya.api.client.CreatePCJ)4 RyaDetails (org.apache.rya.api.instance.RyaDetails)4 InstallPrompt (org.apache.rya.shell.util.InstallPrompt)4 SparqlPrompt (org.apache.rya.shell.util.SparqlPrompt)4 UninstallPrompt (org.apache.rya.shell.util.UninstallPrompt)4 ArrayList (java.util.ArrayList)3 InstanceExists (org.apache.rya.api.client.InstanceExists)3 AccumuloConnectionDetails (org.apache.rya.api.client.accumulo.AccumuloConnectionDetails)3 AccumuloCreatePCJ (org.apache.rya.api.client.accumulo.AccumuloCreatePCJ)3 Date (java.util.Date)2 GetInstanceDetails (org.apache.rya.api.client.GetInstanceDetails)2 ListInstances (org.apache.rya.api.client.ListInstances)2 EntityCentricIndexDetails (org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails)2 FreeTextIndexDetails (org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails)2 JoinSelectivityDetails (org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails)2 PCJDetails (org.apache.rya.api.instance.RyaDetails.PCJIndexDetails.PCJDetails)2