use of org.apache.rya.api.instance.RyaDetails.ProspectorDetails in project incubator-rya by apache.
the class RyaTestInstanceRule method before.
@Override
protected void before() throws Throwable {
// Get the next Rya instance name.
ryaInstanceName = "testInstance_" + ryaInstanceNameCounter.getAndIncrement();
if (install) {
// Create Rya Details for the instance name.
final RyaDetailsRepository detailsRepo = new AccumuloRyaInstanceDetailsRepository(cluster.getConnector(), ryaInstanceName);
final RyaDetails details = RyaDetails.builder().setRyaInstanceName(ryaInstanceName).setRyaVersion("0.0.0.0").setFreeTextDetails(new FreeTextIndexDetails(true)).setEntityCentricIndexDetails(new EntityCentricIndexDetails(true)).setTemporalIndexDetails(new TemporalIndexDetails(true)).setPCJIndexDetails(PCJIndexDetails.builder().setEnabled(true)).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.absent())).setProspectorDetails(new ProspectorDetails(Optional.absent())).build();
detailsRepo.initialize(details);
}
}
use of org.apache.rya.api.instance.RyaDetails.ProspectorDetails in project incubator-rya by apache.
the class MongoDetailsAdapterTest method absentOptionalToMongoTest.
@Test
public void absentOptionalToMongoTest() {
// Convert the Details into a Mongo DB OBject.
final RyaDetails details = RyaDetails.builder().setRyaInstanceName("test").setRyaVersion("1").setEntityCentricIndexDetails(new EntityCentricIndexDetails(true)).setPCJIndexDetails(PCJIndexDetails.builder().setEnabled(true).setFluoDetails(new FluoDetails("fluo"))).setTemporalIndexDetails(new TemporalIndexDetails(false)).setFreeTextDetails(new FreeTextIndexDetails(true)).setProspectorDetails(new ProspectorDetails(Optional.<Date>absent())).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.<Date>absent())).build();
final DBObject actual = MongoDetailsAdapter.toDBObject(details);
// Ensure it matches the expected object.
final BasicDBObject expected = (BasicDBObject) JSON.parse("{ " + "instanceName : \"test\"," + "version : \"1\"," + "entityCentricDetails : true," + // RYA-215 + "geoDetails : false,"
"pcjDetails : {" + "enabled : true," + "pcjs : [ ]" + "}," + "temporalDetails : false," + "freeTextDetails : true" + "}");
assertEquals(expected, actual);
}
use of org.apache.rya.api.instance.RyaDetails.ProspectorDetails in project incubator-rya by apache.
the class MongoDetailsAdapterTest method absentOptionalToRyaDetailsTest.
@Test
public void absentOptionalToRyaDetailsTest() throws MalformedRyaDetailsException {
// Convert the Mongo object into a RyaDetails.
final BasicDBObject mongo = (BasicDBObject) JSON.parse("{ " + "instanceName : \"test\"," + "version : \"1\"," + "entityCentricDetails : true," + // RYA-215 + "geoDetails : false,"
"pcjDetails : {" + "enabled : false," + "pcjs : [ " + "{" + "id : \"pcj_1\"," + "}" + "]" + "}," + "temporalDetails : false," + "freeTextDetails : true," + "prospectorDetails : null," + "joinSelectivitiyDetails : null" + "}");
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(false)).setTemporalIndexDetails(new TemporalIndexDetails(false)).setFreeTextDetails(new FreeTextIndexDetails(true)).setProspectorDetails(new ProspectorDetails(Optional.<Date>absent())).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.<Date>absent())).build();
assertEquals(expected, actual);
}
use of org.apache.rya.api.instance.RyaDetails.ProspectorDetails 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);
}
use of org.apache.rya.api.instance.RyaDetails.ProspectorDetails in project incubator-rya by apache.
the class MongoDetailsAdapterTest method ryaDetailsToMongoTest.
@Test
public void ryaDetailsToMongoTest() {
// Convert the Details into a Mongo DB OBject.
final RyaDetails details = RyaDetails.builder().setRyaInstanceName("test").setRyaVersion("1").setEntityCentricIndexDetails(new EntityCentricIndexDetails(true)).setPCJIndexDetails(PCJIndexDetails.builder().setEnabled(true).setFluoDetails(new FluoDetails("fluo")).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.fromNullable(new Date(0L)))).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.fromNullable(new Date(1L)))).setRyaStreamsDetails(new RyaStreamsDetails("localhost", 6)).build();
final BasicDBObject actual = MongoDetailsAdapter.toDBObject(details);
// Ensure it matches the expected object.
final DBObject expected = (DBObject) JSON.parse("{ " + "instanceName : \"test\"," + "version : \"1\"," + "entityCentricDetails : true," + // RYA-215 + "geoDetails : true,"
"pcjDetails : {" + "enabled : true ," + "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}" + "}");
assertEquals(expected.toString(), actual.toString());
}
Aggregations