use of org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails 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());
}
use of org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails in project incubator-rya by apache.
the class RyaDetailsUpdaterTest method update.
@Test
public void update() throws RyaDetailsRepositoryException, CouldNotApplyMutationException {
// Setup initial details and mock a repository that returns them.
final RyaDetails originalDetails = RyaDetails.builder().setRyaInstanceName("instanceName").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.<Date>absent())).setProspectorDetails(new ProspectorDetails(Optional.<Date>absent())).build();
final RyaDetailsRepository detailsRepo = mock(RyaDetailsRepository.class);
when(detailsRepo.getRyaInstanceDetails()).thenReturn(originalDetails);
// Use an updater to change the Rya version number.
new RyaDetailsUpdater(detailsRepo).update(new RyaDetailsMutator() {
@Override
public RyaDetails mutate(final RyaDetails old) {
return RyaDetails.builder(old).setRyaVersion("1.1.1.1").build();
}
});
// Verify the repository was asked to update the details.
final RyaDetails mutatedDetails = RyaDetails.builder(originalDetails).setRyaVersion("1.1.1.1").build();
verify(detailsRepo, times(1)).update(eq(originalDetails), eq(mutatedDetails));
}
use of org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails in project incubator-rya by apache.
the class RyaDetailsToConfigurationTest method populateConfigTest.
@Test
public void populateConfigTest() {
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(false)).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())));
final Configuration conf = new Configuration();
RyaDetailsToConfiguration.addRyaDetailsToConfiguration(builder.build(), conf);
// defaults are set to cause the assert to fail
assertTrue(conf.getBoolean(USE_ENTITY, false));
assertFalse(conf.getBoolean(USE_FREETEXT, true));
// RYA-215assertTrue(conf.getBoolean(USE_GEO, false));
assertTrue(conf.getBoolean(USE_TEMPORAL, false));
assertTrue(conf.getBoolean(USE_PCJ_UPDATER, false));
}
use of org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails in project incubator-rya by apache.
the class AccumuloIndexSetColumnVisibilityTest method initRyaDetails.
private static void initRyaDetails() throws AlreadyInitializedException, RyaDetailsRepositoryException {
// Initialize the Rya Details for the instance.
final RyaDetailsRepository detailsRepo = new AccumuloRyaInstanceDetailsRepository(accCon, 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.<Date>absent())).setProspectorDetails(new ProspectorDetails(Optional.<Date>absent())).build();
detailsRepo.initialize(details);
}
use of org.apache.rya.api.instance.RyaDetails.JoinSelectivityDetails in project incubator-rya by apache.
the class MongoRyaDetailsRepositoryIT method update.
@Test
public void update() throws AlreadyInitializedException, RyaDetailsRepositoryException {
final String instanceName = "testInstance";
// Create the metadata object the repository will be initialized with.
final RyaDetails details = RyaDetails.builder().setRyaInstanceName(instanceName).setRyaVersion("1.2.3.4").setEntityCentricIndexDetails(new EntityCentricIndexDetails(true)).setTemporalIndexDetails(new TemporalIndexDetails(true)).setFreeTextDetails(new FreeTextIndexDetails(true)).setPCJIndexDetails(PCJIndexDetails.builder().setEnabled(true).addPCJDetails(PCJDetails.builder().setId("pcj 1").setUpdateStrategy(PCJUpdateStrategy.BATCH).setLastUpdateTime(new Date())).addPCJDetails(PCJDetails.builder().setId("pcj 2"))).setProspectorDetails(new ProspectorDetails(Optional.of(new Date()))).setJoinSelectivityDetails(new JoinSelectivityDetails(Optional.of(new Date()))).build();
// Setup the repository that will be tested using a mock instance of MongoDB.
final RyaDetailsRepository repo = new MongoRyaInstanceDetailsRepository(client, "testInstance");
// Initialize the repository
repo.initialize(details);
// Create a new state for the details.
final RyaDetails updated = new RyaDetails.Builder(details).setEntityCentricIndexDetails(new EntityCentricIndexDetails(false)).build();
// Execute the update.
repo.update(details, updated);
// Show the new state that is stored matches the updated state.
final RyaDetails fetched = repo.getRyaInstanceDetails();
assertEquals(updated, fetched);
}
Aggregations