Search in sources :

Example 1 with FeatureStoreMongoDB

use of org.ff4j.store.FeatureStoreMongoDB in project ff4j by ff4j.

the class FeatureStoreMongoDBCore1Test method emptyListAttributes.

/**
 * LazyBSONObjectList vs BasicBSONObjectList
 */
@Test
@Ignore
public void emptyListAttributes() throws UnknownHostException {
    DBCollection features = getMongoClient().getDB("FF4J").getCollection("feature");
    // When
    FeatureStore mongoStore = new FeatureStoreMongoDB(features, "ff4j.xml");
    // Then (no error)
    Assert.assertTrue(mongoStore.readAll().keySet().size() > 0);
}
Also used : DBCollection(com.mongodb.DBCollection) FeatureStoreMongoDB(org.ff4j.store.FeatureStoreMongoDB) FeatureStore(org.ff4j.core.FeatureStore) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 2 with FeatureStoreMongoDB

use of org.ff4j.store.FeatureStoreMongoDB in project ff4j by ff4j.

the class FeatureStoreMongoDBCore1Test method testCreateSchema.

/**
 * Integration Test
 * @throws UnknownHostException
 */
@Test
@Ignore
public void testCreateSchema() throws UnknownHostException {
    // Given
    MongoClient client = new MongoClient(new ServerAddress("localhost", 27017));
    // Given
    Assert.assertFalse(client.getDatabaseNames().contains(FeatureStoreMongoConstants.DEFAULT_DBNAME));
    // When
    new FeatureStoreMongoDB(client).createSchema();
    new PropertyStoreMongoDB(client).createSchema();
    // Then
    Assert.assertTrue(client.getDatabaseNames().contains(FeatureStoreMongoConstants.DEFAULT_DBNAME));
    Assert.assertTrue(client.getDB(FeatureStoreMongoConstants.DEFAULT_DBNAME).collectionExists(FeatureStoreMongoConstants.DEFAULT_COLLECTIONAME_FEATURES));
    Assert.assertTrue(client.getDB(FeatureStoreMongoConstants.DEFAULT_DBNAME).collectionExists(FeatureStoreMongoConstants.DEFAULT_COLLECTIONAME_PROPERTIES));
}
Also used : MongoClient(com.mongodb.MongoClient) FeatureStoreMongoDB(org.ff4j.store.FeatureStoreMongoDB) ServerAddress(com.mongodb.ServerAddress) PropertyStoreMongoDB(org.ff4j.store.PropertyStoreMongoDB) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

FeatureStoreMongoDB (org.ff4j.store.FeatureStoreMongoDB)2 Ignore (org.junit.Ignore)2 Test (org.junit.Test)2 DBCollection (com.mongodb.DBCollection)1 MongoClient (com.mongodb.MongoClient)1 ServerAddress (com.mongodb.ServerAddress)1 FeatureStore (org.ff4j.core.FeatureStore)1 PropertyStoreMongoDB (org.ff4j.store.PropertyStoreMongoDB)1