use of org.apache.rya.api.instance.RyaDetails in project incubator-rya by apache.
the class MongoGetInstanceDetailsIT method getDetails_instanceDoesNotHaveDetails.
@Test
public void getDetails_instanceDoesNotHaveDetails() throws MongoException, TableExistsException, RyaClientException {
// Mimic a pre-details rya install.
final String instanceName = "instance_name";
getMongoClient().getDatabase(instanceName).createCollection("rya_triples");
// Verify that the operation returns empty.
final RyaClient ryaClient = MongoRyaClientFactory.build(getConnectionDetails(), getMongoClient());
final GetInstanceDetails getInstanceDetails = ryaClient.getGetInstanceDetails();
final Optional<RyaDetails> details = getInstanceDetails.getDetails(instanceName);
assertFalse(details.isPresent());
}
use of org.apache.rya.api.instance.RyaDetails in project incubator-rya by apache.
the class MongoRyaDetailsRepositoryIT method initialize_alreadyInitialized.
@Test(expected = AlreadyInitializedException.class)
public void initialize_alreadyInitialized() 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).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"))).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, instanceName);
// Initialize the repository
repo.initialize(details);
// Initialize it again.
repo.initialize(details);
}
use of org.apache.rya.api.instance.RyaDetails in project incubator-rya by apache.
the class MongoRyaDetailsRepositoryIT method update_outOfDate.
@Test(expected = ConcurrentUpdateException.class)
public void update_outOfDate() 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).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"))).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 wrongOriginal = new RyaDetails.Builder(details).setTemporalIndexDetails(new TemporalIndexDetails(false)).build();
final RyaDetails updated = new RyaDetails.Builder(details).setEntityCentricIndexDetails(new EntityCentricIndexDetails(false)).build();
// Try to execute the update where the old state is not the currently stored state.
repo.update(wrongOriginal, updated);
}
use of org.apache.rya.api.instance.RyaDetails in project incubator-rya by apache.
the class MongoRyaDetailsRepositoryIT method initializeAndGet.
@Test
public void initializeAndGet() 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, instanceName);
// Initialize the repository
repo.initialize(details);
// Fetch the stored details.
final RyaDetails stored = repo.getRyaInstanceDetails();
// Ensure the fetched object is equivalent to what was stored.
assertEquals(details, stored);
}
use of org.apache.rya.api.instance.RyaDetails in project incubator-rya by apache.
the class MongoRyaDetailsRepositoryIT method isInitialized_true.
@Test
public void isInitialized_true() 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).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"))).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);
// Ensure the repository reports that it has been initialized.
assertTrue(repo.isInitialized());
}
Aggregations