ConfigurationRegistry { public Configuration getConfiguration(final PersistenceUnitDescriptor descriptor) { for (final ConfigurationFactory factory : CONFIG_FACTORIES) { if (factory.isSupported(descriptor)) { return factory.createConfiguration(descriptor); } } throw new JpaUnitException("Unsupported JPA provider"); }  boolean hasConfiguration(final PersistenceUnitDescriptor descriptor); Configuration getConfiguration(final PersistenceUnitDescriptor descriptor);  }
@Test public void testHibernateOgmMongoDbConfigurationCanBeAccessed() { final Map<String, Object> properties = new HashMap<>(); when(descriptor.getProperties()).thenReturn(properties); properties.put("hibernate.ogm.datastore.provider", "org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider"); properties.put("hibernate.ogm.datastore.database", "foo"); properties.put("hibernate.ogm.datastore.host", "www.example.com"); final Configuration configuration = registry.getConfiguration(descriptor); assertThat(configuration, notNullValue()); }
@Test public void testEclipseLinkMongoDbConfigurationCanBeAccessed() { final Map<String, Object> properties = new HashMap<>(); when(descriptor.getProperties()).thenReturn(properties); properties.put("eclipselink.target-database", "org.eclipse.persistence.nosql.adapters.mongo.MongoPlatform"); properties.put("eclipselink.nosql.property.mongo.db", "foo"); properties.put("eclipselink.nosql.property.mongo.host", "www.example.com"); final Configuration configuration = registry.getConfiguration(descriptor); assertThat(configuration, notNullValue()); }
@Test public void testDataNucleusMongoDbConfigurationCanBeAccessed() { final Map<String, Object> properties = new HashMap<>(); when(descriptor.getProperties()).thenReturn(properties); properties.put("datanucleus.ConnectionURL", "mongodb:/foo"); final Configuration configuration = registry.getConfiguration(descriptor); assertThat(configuration, notNullValue()); }
@Test public void testKunderaMongoDbConfigurationCanBeAccessed() { final Map<String, Object> properties = new HashMap<>(); when(descriptor.getProperties()).thenReturn(properties); properties.put("kundera.dialect", "mongodb"); properties.put("kundera.keyspace", "foo"); properties.put("kundera.nodes", "www.example.com"); final Configuration configuration = registry.getConfiguration(descriptor); assertThat(configuration, notNullValue()); }
@Test public void testHibernateOgmNeo4jConfigurationCanBeAccessed() { final Map<String, Object> properties = new HashMap<>(); when(descriptor.getProperties()).thenReturn(properties); properties.put(HibernateOgmConfiguration.HIBERNATE_OGM_DATASTORE_PROVIDER, "neo4j_http"); properties.put(HibernateOgmConfiguration.HIBERNATE_OGM_DATASTORE_HOST, "www.example.com"); final Configuration configuration = registry.getConfiguration(descriptor); assertThat(configuration, notNullValue()); }
@Test(expected = JpaUnitException.class) public void testNonHibernateOgmNeo4jConfigurationCanBeAccessed() { final Map<String, Object> properties = new HashMap<>(); when(descriptor.getProperties()).thenReturn(properties); properties.put(HibernateOgmConfiguration.HIBERNATE_OGM_DATASTORE_PROVIDER, "foo"); registry.getConfiguration(descriptor); }