Search in sources :

Example 11 with RyaStreamsDetails

use of org.apache.rya.api.instance.RyaDetails.RyaStreamsDetails in project incubator-rya by apache.

the class RyaDetailsTest method equals.

@Test
public void equals() {
    final RyaDetails.Builder builder = RyaDetails.builder();
    builder.setRyaInstanceName("test_instance").setRyaVersion("1.2.3.4").setEntityCentricIndexDetails(new EntityCentricIndexDetails(true)).setTemporalIndexDetails(new TemporalIndexDetails(true)).setFreeTextDetails(new FreeTextIndexDetails(true)).setPCJIndexDetails(PCJIndexDetails.builder().setEnabled(true).setFluoDetails(new FluoDetails("test_instance_rya_pcj_updater")).addPCJDetails(PCJDetails.builder().setId("pcj 1").setUpdateStrategy(PCJUpdateStrategy.BATCH).setLastUpdateTime(new Date())).addPCJDetails(PCJDetails.builder().setId("pcj 2").setUpdateStrategy(PCJUpdateStrategy.INCREMENTAL))).setProspectorDetails(new ProspectorDetails(Optional.of(new Date()))).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.of(new Date()))).setRyaStreamsDetails(new RyaStreamsDetails("localhost", 5));
    final RyaDetails details1 = builder.build();
    final RyaDetails details2 = builder.build();
    assertEquals(details1, details2);
}
Also used : ProspectorDetails(org.apache.rya.api.instance.RyaDetails.ProspectorDetails) EntityCentricIndexDetails(org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails) RyaStreamsDetails(org.apache.rya.api.instance.RyaDetails.RyaStreamsDetails) TemporalIndexDetails(org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails) FreeTextIndexDetails(org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails) FluoDetails(org.apache.rya.api.instance.RyaDetails.PCJIndexDetails.FluoDetails) Date(java.util.Date) JoinSelectivityDetails(org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails) Test(org.junit.Test)

Example 12 with RyaStreamsDetails

use of org.apache.rya.api.instance.RyaDetails.RyaStreamsDetails in project incubator-rya by apache.

the class RyaStreamsCommandsTest method printRyaStreamsDetails_configured.

@Test
public void printRyaStreamsDetails_configured() throws Exception {
    // Mock the object that performs the configure operation.
    final RyaClient mockCommands = mock(RyaClient.class);
    final GetInstanceDetails getDetails = mock(GetInstanceDetails.class);
    when(mockCommands.getGetInstanceDetails()).thenReturn(getDetails);
    // When getting the instance details, ensure they do have RyaStreamsDetails to print.
    final RyaDetails details = mock(RyaDetails.class);
    when(details.getRyaStreamsDetails()).thenReturn(Optional.of(new RyaStreamsDetails("localhost", 6)));
    when(getDetails.getDetails(eq("unitTest"))).thenReturn(Optional.of(details));
    // Mock a shell state and connect it to a Rya instance.
    final SharedShellState state = new SharedShellState();
    state.connectedToAccumulo(mock(AccumuloConnectionDetails.class), mockCommands);
    state.connectedToInstance("unitTest");
    // Execute the command.
    final RyaStreamsCommands commands = new RyaStreamsCommands(state, mock(SparqlPrompt.class), mock(ConsolePrinter.class));
    final String message = commands.printRyaStreamsDetails();
    final String expected = "Kafka Hostname: localhost, Kafka Port: 6";
    assertEquals(expected, message);
}
Also used : RyaStreamsDetails(org.apache.rya.api.instance.RyaDetails.RyaStreamsDetails) ConsolePrinter(org.apache.rya.shell.util.ConsolePrinter) AccumuloConnectionDetails(org.apache.rya.api.client.accumulo.AccumuloConnectionDetails) SparqlPrompt(org.apache.rya.shell.util.SparqlPrompt) GetInstanceDetails(org.apache.rya.api.client.GetInstanceDetails) RyaDetails(org.apache.rya.api.instance.RyaDetails) RyaClient(org.apache.rya.api.client.RyaClient) Test(org.junit.Test)

Example 13 with RyaStreamsDetails

use of org.apache.rya.api.instance.RyaDetails.RyaStreamsDetails in project incubator-rya by apache.

the class RyaDetailsTest method hashcode.

@Test
public void hashcode() {
    final RyaDetails.Builder builder = RyaDetails.builder();
    builder.setRyaInstanceName("test_instance").setRyaVersion("1.2.3.4").setEntityCentricIndexDetails(new EntityCentricIndexDetails(true)).setTemporalIndexDetails(new TemporalIndexDetails(true)).setFreeTextDetails(new FreeTextIndexDetails(true)).setPCJIndexDetails(PCJIndexDetails.builder().setEnabled(true).setFluoDetails(new FluoDetails("test_instance_rya_pcj_updater")).addPCJDetails(PCJDetails.builder().setId("pcj 1").setUpdateStrategy(PCJUpdateStrategy.BATCH).setLastUpdateTime(new Date())).addPCJDetails(PCJDetails.builder().setId("pcj 2").setUpdateStrategy(PCJUpdateStrategy.INCREMENTAL))).setProspectorDetails(new ProspectorDetails(Optional.of(new Date()))).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.of(new Date()))).setRyaStreamsDetails(new RyaStreamsDetails("localhost", 5));
    final RyaDetails details1 = builder.build();
    final RyaDetails details2 = builder.build();
    assertEquals(details1.hashCode(), details2.hashCode());
}
Also used : ProspectorDetails(org.apache.rya.api.instance.RyaDetails.ProspectorDetails) EntityCentricIndexDetails(org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails) RyaStreamsDetails(org.apache.rya.api.instance.RyaDetails.RyaStreamsDetails) TemporalIndexDetails(org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails) FreeTextIndexDetails(org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails) FluoDetails(org.apache.rya.api.instance.RyaDetails.PCJIndexDetails.FluoDetails) Date(java.util.Date) JoinSelectivityDetails(org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails) Test(org.junit.Test)

Example 14 with RyaStreamsDetails

use of org.apache.rya.api.instance.RyaDetails.RyaStreamsDetails 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 RyaStreamsDetails

use of org.apache.rya.api.instance.RyaDetails.RyaStreamsDetails in project incubator-rya by apache.

the class MongoDetailsAdapterTest method mongoToRyaDetailsTest.

@Test
public void mongoToRyaDetailsTest() throws MalformedRyaDetailsException {
    // Convert the Mongo object into a RyaDetails.
    final BasicDBObject mongo = (BasicDBObject) JSON.parse("{ " + "instanceName : \"test\"," + "version : \"1\"," + "entityCentricDetails : true," + // RYA-215            + "geoDetails : true,"
    "pcjDetails : {" + "enabled : true ," + "fluoName : \"fluo\"," + "pcjs : [ " + "{" + "id : \"pcj_0\"," + "updateStrategy : \"BATCH\"," + "lastUpdate : { $date : \"1970-01-01T00:00:00.000Z\"}" + "}," + "{" + "id : \"pcj_1\"," + "updateStrategy : \"BATCH\"," + "lastUpdate : { $date : \"1970-01-01T00:00:00.001Z\"}" + "}]" + "}," + "temporalDetails : true," + "freeTextDetails : true," + "prospectorDetails : { $date : \"1970-01-01T00:00:00.000Z\"}," + "joinSelectivitiyDetails : { $date : \"1970-01-01T00:00:00.001Z\"}," + "ryaStreamsDetails : { hostname : \"localhost\" , port : 6}" + "}");
    final RyaDetails actual = MongoDetailsAdapter.toRyaDetails(mongo);
    // Ensure it matches the expected object.
    final RyaDetails expected = RyaDetails.builder().setRyaInstanceName("test").setRyaVersion("1").setEntityCentricIndexDetails(new EntityCentricIndexDetails(true)).setPCJIndexDetails(PCJIndexDetails.builder().setEnabled(true).addPCJDetails(PCJDetails.builder().setId("pcj_0").setUpdateStrategy(PCJUpdateStrategy.BATCH).setLastUpdateTime(new Date(0L))).addPCJDetails(PCJDetails.builder().setId("pcj_1").setUpdateStrategy(PCJUpdateStrategy.BATCH).setLastUpdateTime(new Date(1L)))).setTemporalIndexDetails(new TemporalIndexDetails(true)).setFreeTextDetails(new FreeTextIndexDetails(true)).setProspectorDetails(new ProspectorDetails(Optional.<Date>fromNullable(new Date(0L)))).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.<Date>fromNullable(new Date(1L)))).setRyaStreamsDetails(new RyaStreamsDetails("localhost", 6)).build();
    assertEquals(expected, actual);
}
Also used : ProspectorDetails(org.apache.rya.api.instance.RyaDetails.ProspectorDetails) BasicDBObject(com.mongodb.BasicDBObject) EntityCentricIndexDetails(org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails) RyaStreamsDetails(org.apache.rya.api.instance.RyaDetails.RyaStreamsDetails) TemporalIndexDetails(org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails) FreeTextIndexDetails(org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails) RyaDetails(org.apache.rya.api.instance.RyaDetails) Date(java.util.Date) JoinSelectivityDetails(org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails) Test(org.junit.Test)

Aggregations

RyaStreamsDetails (org.apache.rya.api.instance.RyaDetails.RyaStreamsDetails)16 Test (org.junit.Test)11 RyaClient (org.apache.rya.api.client.RyaClient)9 Date (java.util.Date)6 RyaDetails (org.apache.rya.api.instance.RyaDetails)6 EntityCentricIndexDetails (org.apache.rya.api.instance.RyaDetails.EntityCentricIndexDetails)6 FreeTextIndexDetails (org.apache.rya.api.instance.RyaDetails.FreeTextIndexDetails)6 JoinSelectivityDetails (org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails)6 ProspectorDetails (org.apache.rya.api.instance.RyaDetails.ProspectorDetails)6 TemporalIndexDetails (org.apache.rya.api.instance.RyaDetails.TemporalIndexDetails)6 BasicDBObject (com.mongodb.BasicDBObject)4 FluoDetails (org.apache.rya.api.instance.RyaDetails.PCJIndexDetails.FluoDetails)4 RyaClientException (org.apache.rya.api.client.RyaClientException)3 CliCommand (org.springframework.shell.core.annotation.CliCommand)3 DBObject (com.mongodb.DBObject)2 Install (org.apache.rya.api.client.Install)2 InstallConfiguration (org.apache.rya.api.client.Install.InstallConfiguration)2 AccumuloConnectionDetails (org.apache.rya.api.client.accumulo.AccumuloConnectionDetails)2 ConsolePrinter (org.apache.rya.shell.util.ConsolePrinter)2 SparqlPrompt (org.apache.rya.shell.util.SparqlPrompt)2