Search in sources :

Example 1 with Provider

use of org.apache.cayenne.di.Provider in project cayenne by apache.

the class PerAdapterProviderTest method before.

@Before
public void before() {
    ResourceLocator locator = new ClassLoaderResourceLocator(new DefaultClassLoaderManager());
    RuntimeProperties runtimeProperties = mock(RuntimeProperties.class);
    ValueObjectTypeRegistry valueObjectTypeRegistry = mock(ValueObjectTypeRegistry.class);
    this.oracleAdapter = new OracleAdapter(runtimeProperties, Collections.<ExtendedType>emptyList(), Collections.<ExtendedType>emptyList(), Collections.<ExtendedTypeFactory>emptyList(), locator, valueObjectTypeRegistry);
    this.derbyAdapter = new DerbyAdapter(runtimeProperties, Collections.<ExtendedType>emptyList(), Collections.<ExtendedType>emptyList(), Collections.<ExtendedTypeFactory>emptyList(), locator, valueObjectTypeRegistry);
    this.autoDerbyAdapter = new AutoAdapter(new Provider<DbAdapter>() {

        @Override
        public DbAdapter get() throws DIRuntimeException {
            return derbyAdapter;
        }
    }, new Slf4jJdbcEventLogger(runtimeProperties));
}
Also used : OracleAdapter(org.apache.cayenne.dba.oracle.OracleAdapter) DerbyAdapter(org.apache.cayenne.dba.derby.DerbyAdapter) Slf4jJdbcEventLogger(org.apache.cayenne.log.Slf4jJdbcEventLogger) ExtendedTypeFactory(org.apache.cayenne.access.types.ExtendedTypeFactory) ClassLoaderResourceLocator(org.apache.cayenne.resource.ClassLoaderResourceLocator) ValueObjectTypeRegistry(org.apache.cayenne.access.types.ValueObjectTypeRegistry) ExtendedType(org.apache.cayenne.access.types.ExtendedType) DefaultClassLoaderManager(org.apache.cayenne.di.spi.DefaultClassLoaderManager) RuntimeProperties(org.apache.cayenne.configuration.RuntimeProperties) ResourceLocator(org.apache.cayenne.resource.ResourceLocator) ClassLoaderResourceLocator(org.apache.cayenne.resource.ClassLoaderResourceLocator) Provider(org.apache.cayenne.di.Provider) Before(org.junit.Before)

Aggregations

ExtendedType (org.apache.cayenne.access.types.ExtendedType)1 ExtendedTypeFactory (org.apache.cayenne.access.types.ExtendedTypeFactory)1 ValueObjectTypeRegistry (org.apache.cayenne.access.types.ValueObjectTypeRegistry)1 RuntimeProperties (org.apache.cayenne.configuration.RuntimeProperties)1 DerbyAdapter (org.apache.cayenne.dba.derby.DerbyAdapter)1 OracleAdapter (org.apache.cayenne.dba.oracle.OracleAdapter)1 Provider (org.apache.cayenne.di.Provider)1 DefaultClassLoaderManager (org.apache.cayenne.di.spi.DefaultClassLoaderManager)1 Slf4jJdbcEventLogger (org.apache.cayenne.log.Slf4jJdbcEventLogger)1 ClassLoaderResourceLocator (org.apache.cayenne.resource.ClassLoaderResourceLocator)1 ResourceLocator (org.apache.cayenne.resource.ResourceLocator)1 Before (org.junit.Before)1