Search in sources :

Example 1 with Install

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);
}
Also used : AccumuloConnectionDetails(org.apache.rya.api.client.accumulo.AccumuloConnectionDetails) SparqlPrompt(org.apache.rya.shell.util.SparqlPrompt) RyaClient(org.apache.rya.api.client.RyaClient) Install(org.apache.rya.api.client.Install) InstallConfiguration(org.apache.rya.api.client.Install.InstallConfiguration) InstallPrompt(org.apache.rya.shell.util.InstallPrompt) UninstallPrompt(org.apache.rya.shell.util.UninstallPrompt) Test(org.junit.Test)

Example 2 with Install

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

Example 3 with Install

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());
}
Also used : ProspectorDetails(org.apache.rya.api.instance.RyaDetails.ProspectorDetails) RyaDetails(org.apache.rya.api.instance.RyaDetails) RyaClient(org.apache.rya.api.client.RyaClient) InstallConfiguration(org.apache.rya.api.client.Install.InstallConfiguration) Date(java.util.Date) JoinSelectivityDetails(org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails) EntityCentricIndexDetails(org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails) TemporalIndexDetails(org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails) GetInstanceDetails(org.apache.rya.api.client.GetInstanceDetails) FreeTextIndexDetails(org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails) Install(org.apache.rya.api.client.Install) Test(org.junit.Test)

Example 4 with Install

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

Example 5 with Install

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());
}
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)

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