/** * Get the singleton {@link DerbyEmbeddedDatabaseConfigurer} instance. * @return the configurer instance */ public static synchronized DerbyEmbeddedDatabaseConfigurer getInstance() { if (instance == null) { // disable log file System.setProperty("derby.stream.error.method", OutputStreamFactory.class.getName() + ".getNoopOutputStream"); instance = new DerbyEmbeddedDatabaseConfigurer(); } return instance; }
/** * Return a configurer instance for the given embedded database type. * @param type the embedded database type (HSQL, H2 or Derby) * @return the configurer instance * @throws IllegalStateException if the driver for the specified database type is not available */ public static EmbeddedDatabaseConfigurer getConfigurer(EmbeddedDatabaseType type) throws IllegalStateException { Assert.notNull(type, "EmbeddedDatabaseType is required"); try { switch (type) { case HSQL: return HsqlEmbeddedDatabaseConfigurer.getInstance(); case H2: return H2EmbeddedDatabaseConfigurer.getInstance(); case DERBY: return DerbyEmbeddedDatabaseConfigurer.getInstance(); default: throw new UnsupportedOperationException("Embedded database type [" + type + "] is not supported"); } } catch (ClassNotFoundException | NoClassDefFoundError ex) { throw new IllegalStateException("Driver for test database type [" + type + "] is not available", ex); } }
/** * Get the singleton {@link DerbyEmbeddedDatabaseConfigurer} instance. * @return the configurer instance */ public static synchronized DerbyEmbeddedDatabaseConfigurer getInstance() { if (instance == null) { // disable log file System.setProperty("derby.stream.error.method", OutputStreamFactory.class.getName() + ".getNoopOutputStream"); instance = new DerbyEmbeddedDatabaseConfigurer(); } return instance; }
/** * Return a configurer instance for the given embedded database type. * @param type the embedded database type (HSQL, H2 or Derby) * @return the configurer instance * @throws IllegalStateException if the driver for the specified database type is not available */ public static EmbeddedDatabaseConfigurer getConfigurer(EmbeddedDatabaseType type) throws IllegalStateException { Assert.notNull(type, "EmbeddedDatabaseType is required"); try { switch (type) { case HSQL: return HsqlEmbeddedDatabaseConfigurer.getInstance(); case H2: return H2EmbeddedDatabaseConfigurer.getInstance(); case DERBY: return DerbyEmbeddedDatabaseConfigurer.getInstance(); default: throw new UnsupportedOperationException("Embedded database type [" + type + "] is not supported"); } } catch (ClassNotFoundException | NoClassDefFoundError ex) { throw new IllegalStateException("Driver for test database type [" + type + "] is not available", ex); } }
/** * Get the singleton {@link DerbyEmbeddedDatabaseConfigurer} instance. * @return the configurer * @throws ClassNotFoundException if Derby is not on the classpath */ public static synchronized DerbyEmbeddedDatabaseConfigurer getInstance() throws ClassNotFoundException { if (INSTANCE == null) { // disable log file System.setProperty("derby.stream.error.method", OutputStreamFactory.class.getName() + ".getNoopOutputStream"); INSTANCE = new DerbyEmbeddedDatabaseConfigurer(); } return INSTANCE; }
public static EmbeddedDatabaseConfigurer getConfigurer(EmbeddedDatabaseType type) throws IllegalStateException { Assert.notNull(type, "EmbeddedDatabaseType is required"); try { switch (type) { case HSQL: return HsqlEmbeddedDatabaseConfigurer.getInstance(); case H2: return H2EmbeddedDatabaseConfigurer.getInstance(); case DERBY: return DerbyEmbeddedDatabaseConfigurer.getInstance(); default: throw new UnsupportedOperationException("Other embedded database types not yet supported"); } } catch (ClassNotFoundException ex) { throw new IllegalStateException("Driver for test database type [" + type + "] is not available in the classpath", ex); } }