Search in sources :

Example 1 with MongoIndexingConfiguration

use of org.apache.rya.indexing.mongodb.MongoIndexingConfiguration in project incubator-rya by apache.

the class MongoIndexingConfigurationTest method testBuilderFromProperties.

@Test
public void testBuilderFromProperties() throws FileNotFoundException, IOException {
    String prefix = "prefix_";
    String auth = "U";
    String visibility = "U";
    String user = "user";
    String password = "password";
    boolean useMock = true;
    boolean useInference = true;
    boolean displayPlan = false;
    Properties props = new Properties();
    props.load(new FileInputStream("src/test/resources/mongo_rya_indexing.properties"));
    MongoIndexingConfiguration conf = MongoIndexingConfiguration.fromProperties(props);
    assertEquals(conf.getTablePrefix(), prefix);
    assertTrue(Arrays.equals(conf.getAuths(), new String[] { auth }));
    assertEquals(conf.getCv(), visibility);
    assertEquals(conf.isInfer(), useInference);
    assertEquals(conf.isDisplayQueryPlan(), displayPlan);
    assertEquals(conf.getMongoHostname(), "host");
    assertEquals(conf.getBoolean(".useMockInstance", false), useMock);
    assertEquals(conf.getMongoPort(), "1000");
    assertEquals(conf.getMongoDBName(), "dbname");
    assertEquals(conf.getRyaInstanceName(), "prefix_");
    assertEquals(conf.get(MongoDBRdfConfiguration.MONGO_USER), user);
    assertEquals(conf.get(MongoDBRdfConfiguration.MONGO_USER_PASSWORD), password);
    assertTrue(Arrays.equals(conf.getMongoFreeTextPredicates(), new String[] { "http://pred1", "http://pred2" }));
    assertTrue(Arrays.equals(conf.getMongoTemporalPredicates(), new String[] { "http://pred3", "http://pred4" }));
}
Also used : MongoIndexingConfiguration(org.apache.rya.indexing.mongodb.MongoIndexingConfiguration) Properties(java.util.Properties) FileInputStream(java.io.FileInputStream) Test(org.junit.Test)

Example 2 with MongoIndexingConfiguration

use of org.apache.rya.indexing.mongodb.MongoIndexingConfiguration in project incubator-rya by apache.

the class MongoIndexingConfigurationTest method testBuilder.

@Test
public void testBuilder() {
    String prefix = "prefix_";
    String auth = "U,V,W";
    String visibility = "U,W";
    String user = "user";
    String password = "password";
    boolean useMock = true;
    boolean useInference = true;
    boolean displayPlan = false;
    MongoIndexingConfiguration conf = MongoIndexingConfiguration.builder().setVisibilities(visibility).setUseInference(useInference).setDisplayQueryPlan(displayPlan).setUseMockMongo(useMock).setMongoCollectionPrefix(prefix).setMongoDBName("dbname").setMongoHost("host").setMongoPort("1000").setAuths(auth).setMongoUser(user).setMongoPassword(password).setUseMongoEntityIndex(true).setUseMongoFreetextIndex(true).setUseMongoTemporalIndex(true).setMongoFreeTextPredicates("http://pred1", "http://pred2").setMongoTemporalPredicates("http://pred3", "http://pred4").build();
    assertEquals(conf.getTablePrefix(), prefix);
    assertTrue(Arrays.equals(conf.getAuths(), new String[] { "U", "V", "W" }));
    assertEquals(conf.getCv(), visibility);
    assertEquals(conf.isInfer(), useInference);
    assertEquals(conf.isDisplayQueryPlan(), displayPlan);
    assertEquals(conf.getMongoHostname(), "host");
    assertEquals(conf.getBoolean(".useMockInstance", false), useMock);
    assertEquals(conf.getMongoPort(), "1000");
    assertEquals(conf.getMongoDBName(), "dbname");
    assertEquals(conf.getRyaInstanceName(), "prefix_");
    assertEquals(conf.get(MongoDBRdfConfiguration.MONGO_USER), user);
    assertEquals(conf.get(MongoDBRdfConfiguration.MONGO_USER_PASSWORD), password);
    assertTrue(Arrays.equals(conf.getMongoFreeTextPredicates(), new String[] { "http://pred1", "http://pred2" }));
    assertTrue(Arrays.equals(conf.getMongoTemporalPredicates(), new String[] { "http://pred3", "http://pred4" }));
}
Also used : MongoIndexingConfiguration(org.apache.rya.indexing.mongodb.MongoIndexingConfiguration) Test(org.junit.Test)

Aggregations

MongoIndexingConfiguration (org.apache.rya.indexing.mongodb.MongoIndexingConfiguration)2 Test (org.junit.Test)2 FileInputStream (java.io.FileInputStream)1 Properties (java.util.Properties)1