ConfigurationRegistry { public boolean hasConfiguration(final PersistenceUnitDescriptor descriptor) { for (final ConfigurationFactory factory : CONFIG_FACTORIES) { if (factory.isSupported(descriptor)) { return true; } } return false; }  boolean hasConfiguration(final PersistenceUnitDescriptor descriptor); Configuration getConfiguration(final PersistenceUnitDescriptor descriptor);  }
@Test public void testHibernateOgmMongoDbConfigurationIsAvailable() { 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"); final boolean hasConfiguration = registry.hasConfiguration(descriptor); assertTrue(hasConfiguration); }
@Test public void testEclipseLinkMongoDbConfigurationIsAvailable() { final Map<String, Object> properties = new HashMap<>(); when(descriptor.getProperties()).thenReturn(properties); properties.put("eclipselink.target-database", "org.eclipse.persistence.nosql.adapters.mongo.MongoPlatform"); final boolean hasConfiguration = registry.hasConfiguration(descriptor); assertTrue(hasConfiguration); }
@Test public void testDataNucleusMongoDbConfigurationIsAvailable() { final Map<String, Object> properties = new HashMap<>(); when(descriptor.getProperties()).thenReturn(properties); properties.put("datanucleus.ConnectionURL", "mongodb:/foo"); final boolean hasConfiguration = registry.hasConfiguration(descriptor); assertTrue(hasConfiguration); }
@Test public void testKunderaMongoDbConfigurationIsAvailable() { final Map<String, Object> properties = new HashMap<>(); when(descriptor.getProperties()).thenReturn(properties); properties.put("kundera.dialect", "mongodb"); final boolean hasConfiguration = registry.hasConfiguration(descriptor); assertTrue(hasConfiguration); }
@Test public void testHibernateOgmNeo4jDbConfigurationIsAvailable() { final Map<String, Object> properties = new HashMap<>(); when(descriptor.getProperties()).thenReturn(properties); properties.put(HibernateOgmConfiguration.HIBERNATE_OGM_DATASTORE_PROVIDER, "neo4j_bolt"); final boolean hasConfiguration = registry.hasConfiguration(descriptor); assertTrue(hasConfiguration); }
@Test public void testNonHibernateOgmNeo4jDbConfigurationIsAvailable() { final Map<String, Object> properties = new HashMap<>(); when(descriptor.getProperties()).thenReturn(properties); properties.put(HibernateOgmConfiguration.HIBERNATE_OGM_DATASTORE_PROVIDER, "foo"); final boolean hasConfiguration = registry.hasConfiguration(descriptor); assertFalse(hasConfiguration); }