mirror of https://github.com/apache/openjpa.git
OPENJPA-1374 Enable junits to be executed against an in-memory Derby 10.5.3.0 db. Moved common Derby profiles to the parent POM. Added new Derby props in o-p-j which knocked 2 mins off build time. Added a test-derbymem profile to use Derby 10.5.3.0 as in-memory DB, which reduced build time by 5 mins.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@901374 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
531df90e41
commit
2b2ede1e38
|
@ -99,77 +99,6 @@
|
|||
</build>
|
||||
</profile>
|
||||
|
||||
<!-- Default profile for testing with embedded Apache Derby -->
|
||||
<profile>
|
||||
<!--
|
||||
Optionally, you can override the following properties:
|
||||
-Dderby.version=10.2.2.0
|
||||
-->
|
||||
<id>test-derby</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
<property>
|
||||
<name>test-derby</name>
|
||||
</property>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derby</artifactId>
|
||||
<version>${derby.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<connection.driver.name>org.apache.derby.jdbc.EmbeddedDriver</connection.driver.name>
|
||||
<connection.url>jdbc:derby:target/database/openjpa-derby-database;create=true</connection.url>
|
||||
<connection.username />
|
||||
<connection.password />
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<!-- Profile for testing with Apache Derby network server -->
|
||||
<profile>
|
||||
<!--
|
||||
Example Derby Network Server profile.
|
||||
You must manually start a Derby network server instance and
|
||||
also set the following properties:
|
||||
-Dopenjpa.derbynet.url=jdbc:derby://<HOST>:<PORT>/<DBNAME>;\
|
||||
create=true
|
||||
|
||||
Optionally, you can override the following properties:
|
||||
-Dopenjpa.derbynet.driver=org.apache.derby.jdbc.ClientXADataSource
|
||||
-Dopenjpa.derbynet.username=
|
||||
-Dopenjpa.derbynet.password=
|
||||
-Dderby.version=10.2.2.0
|
||||
-->
|
||||
<id>test-derbynet</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>test-derbynet</name>
|
||||
</property>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derbyclient</artifactId>
|
||||
<version>${derby.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<openjpa.derbynet.url>jdbc:derby://localhost:1527/openjpa20;create=true;traceDirectory=target;traceFile=derby.log</openjpa.derbynet.url>
|
||||
<openjpa.derbynet.driver>org.apache.derby.jdbc.ClientDriver</openjpa.derbynet.driver>
|
||||
<!-- Note: commons-dbcp requires dummy values for uid/pwd -->
|
||||
<openjpa.derbynet.username>uid</openjpa.derbynet.username>
|
||||
<openjpa.derbynet.password>pwd</openjpa.derbynet.password>
|
||||
<connection.driver.name>${openjpa.derbynet.driver}</connection.driver.name>
|
||||
<connection.url>${openjpa.derbynet.url}</connection.url>
|
||||
<connection.username>${openjpa.derbynet.username}</connection.username>
|
||||
<connection.password>${openjpa.derbynet.password}</connection.password>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<!-- Profile for testing with HSQL DB -->
|
||||
<profile>
|
||||
<id>test-hsqldb</id>
|
||||
|
@ -1062,6 +991,14 @@
|
|||
<name>derby.locks.waitTimeout</name>
|
||||
<value>${derby.locks.waitTimeout}</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>derby.storage.pageCacheSize</name>
|
||||
<value>10000</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>derby.storage.initialPages</name>
|
||||
<value>10</value>
|
||||
</property>
|
||||
<property>
|
||||
<name>openjpa.ConnectionProperties</name>
|
||||
<value>DriverClassName=${connection.driver.name},Url=${connection.url},Username=${connection.username},Password=${connection.password},${dbcp.args}</value>
|
||||
|
|
|
@ -101,77 +101,6 @@
|
|||
</build>
|
||||
</profile>
|
||||
|
||||
<!-- Default profile for testing with embedded Apache Derby -->
|
||||
<profile>
|
||||
<!--
|
||||
Optionally, you can override the following properties:
|
||||
-Dderby.version=10.2.2.0
|
||||
-->
|
||||
<id>test-derby</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
<property>
|
||||
<name>test-derby</name>
|
||||
</property>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derby</artifactId>
|
||||
<version>${derby.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<connection.driver.name>org.apache.derby.jdbc.EmbeddedDriver</connection.driver.name>
|
||||
<connection.url>jdbc:derby:target/database/openjpa-derby-database;create=true</connection.url>
|
||||
<connection.username />
|
||||
<connection.password />
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<!-- Profile for testing with Apache Derby network server -->
|
||||
<profile>
|
||||
<!--
|
||||
Example Derby Network Server profile.
|
||||
You must manually start a Derby network server instance and
|
||||
also set the following properties:
|
||||
-Dopenjpa.derbynet.url=jdbc:derby://<HOST>:<PORT>/<DBNAME>;\
|
||||
create=true
|
||||
|
||||
Optionally, you can override the following properties:
|
||||
-Dopenjpa.derbynet.driver=org.apache.derby.jdbc.ClientXADataSource
|
||||
-Dopenjpa.derbynet.username=
|
||||
-Dopenjpa.derbynet.password=
|
||||
-Dderby.version=10.2.2.0
|
||||
-->
|
||||
<id>test-derbynet</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>test-derbynet</name>
|
||||
</property>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derbyclient</artifactId>
|
||||
<version>${derby.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<openjpa.derbynet.url>jdbc:derby://localhost:1527/openjpa20;create=true;traceDirectory=target;traceFile=derby.log</openjpa.derbynet.url>
|
||||
<openjpa.derbynet.driver>org.apache.derby.jdbc.ClientDriver</openjpa.derbynet.driver>
|
||||
<!-- Note: commons-dbcp requires dummy values for uid/pwd -->
|
||||
<openjpa.derbynet.username>uid</openjpa.derbynet.username>
|
||||
<openjpa.derbynet.password>pwd</openjpa.derbynet.password>
|
||||
<connection.driver.name>${openjpa.derbynet.driver}</connection.driver.name>
|
||||
<connection.url>${openjpa.derbynet.url}</connection.url>
|
||||
<connection.username>${openjpa.derbynet.username}</connection.username>
|
||||
<connection.password>${openjpa.derbynet.password}</connection.password>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
<!-- Profile for testing with HSQL DB -->
|
||||
<profile>
|
||||
<id>test-hsqldb</id>
|
||||
|
|
|
@ -93,12 +93,17 @@ public class PersistenceProviderImpl
|
|||
_log = conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);
|
||||
pd.checkPuNameCollisions(_log,name);
|
||||
|
||||
loadAgent(_log, conf);
|
||||
// add enhancer
|
||||
loadAgent(factory);
|
||||
|
||||
// TODO - Can this be moved back to BrokerImpl.initialize()?
|
||||
// Create appropriate LifecycleEventManager
|
||||
loadValidator(_log, conf);
|
||||
loadValidator(factory);
|
||||
|
||||
// We need to wait to preload until after we get back a fully configured/instantiated
|
||||
// BrokerFactory. This is because it is possible that someone has extended OpenJPA
|
||||
// functions and they need to be allowed time to configure themselves before we go off and
|
||||
// start instanting configurable objects (ie:openjpa.MetaDataRepository). Don't catch
|
||||
// any exceptions here because we want to fail-fast.
|
||||
preloadMetaDataRepository(factory);
|
||||
|
||||
return JPAFacadeHelper.toEntityManagerFactory(factory);
|
||||
|
@ -181,18 +186,17 @@ public class PersistenceProviderImpl
|
|||
log.warn(_loc.get("transformer-registration-error", pui));
|
||||
}
|
||||
}
|
||||
|
||||
// Create appropriate LifecycleEventManager
|
||||
OpenJPAConfiguration conf = factory.getConfiguration();
|
||||
conf.setPersistenceUnitRootUrl(pui.getPersistenceUnitRootUrl());
|
||||
_log = conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);
|
||||
loadValidator(_log, conf);
|
||||
loadValidator(factory);
|
||||
|
||||
// We need to wait to preload until after we get back a fully configured/instantiated
|
||||
// BrokerFactory. This is because it is possible that someone has extended OpenJPA
|
||||
// functions and they need to be allowed time to configure themselves before we go off and
|
||||
// start instanting configurable objects (ie:openjpa.MetaDataRepository). Don't catch
|
||||
// any exceptions here because we want to fail-fast.
|
||||
preloadMetaDataRepository(factory);
|
||||
preloadMetaDataRepository(factory);
|
||||
|
||||
return JPAFacadeHelper.toEntityManagerFactory(factory);
|
||||
} catch (Exception e) {
|
||||
throw PersistenceExceptions.toPersistenceException(e);
|
||||
|
@ -234,7 +238,7 @@ public class PersistenceProviderImpl
|
|||
// We need to wait to preload until after we get back a fully configured/instantiated
|
||||
// BrokerFactory. This is because it is possible that someone has extended OpenJPA
|
||||
// functions and they need to be allowed time to configure themselves before we go off and
|
||||
// start instanting configurable objects (ie:openjpa.MetaDataRepository). Don't catch
|
||||
// start instantiating configurable objects (ie:openjpa.MetaDataRepository). Don't catch
|
||||
// any exceptions here because we want to fail-fast.
|
||||
OpenJPAConfiguration conf = factory.getConfiguration();
|
||||
Options o = Configurations.parseProperties(Configurations.getProperties(conf.getMetaDataRepository()));
|
||||
|
@ -285,11 +289,14 @@ public class PersistenceProviderImpl
|
|||
/**
|
||||
* This private worker method will attempt load the PCEnhancerAgent.
|
||||
*/
|
||||
private void loadAgent(Log log, OpenJPAConfiguration conf) {
|
||||
private void loadAgent(BrokerFactory factory) {
|
||||
OpenJPAConfiguration conf = factory.getConfiguration();
|
||||
Log log = conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);
|
||||
|
||||
if (conf.getDynamicEnhancementAgent() == true) {
|
||||
boolean res = PCEnhancerAgent.loadDynamicAgent(log);
|
||||
if(_log.isInfoEnabled() && res == true ){
|
||||
_log.info(_loc.get("dynamic-agent"));
|
||||
if (log.isInfoEnabled() && res == true ){
|
||||
log.info(_loc.get("dynamic-agent"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -302,10 +309,13 @@ public class PersistenceProviderImpl
|
|||
* @param conf
|
||||
* @throws if validation setup failed and was required by the config
|
||||
*/
|
||||
private void loadValidator(Log log, OpenJPAConfiguration conf) {
|
||||
private void loadValidator(BrokerFactory factory) {
|
||||
OpenJPAConfiguration conf = factory.getConfiguration();
|
||||
Log log = conf.getLog(OpenJPAConfiguration.LOG_RUNTIME);
|
||||
|
||||
if ((ValidationUtils.setupValidation(conf) == true) &&
|
||||
_log.isInfoEnabled()) {
|
||||
_log.info(_loc.get("vlem-creation-info"));
|
||||
log.isInfoEnabled()) {
|
||||
log.info(_loc.get("vlem-creation-info"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,29 +63,8 @@
|
|||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<!-- Profile for testing with Apache Derby -->
|
||||
<profile>
|
||||
<id>test-derby</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
<property>
|
||||
<name>test-derby</name>
|
||||
</property>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derby</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<connection.driver.name> org.apache.derby.jdbc.EmbeddedDriver </connection.driver.name>
|
||||
<connection.url> jdbc:derby:target/database/slice-derby-One;create=true </connection.url>
|
||||
<connection.username />
|
||||
<connection.password />
|
||||
</properties>
|
||||
</profile>
|
||||
<!-- Default is to test with Embedded Derby, which is setup in
|
||||
persistence.xml to create the required slices -->
|
||||
|
||||
<!-- Sample profile for testing with MySQL DB -->
|
||||
<profile>
|
||||
|
|
106
pom.xml
106
pom.xml
|
@ -111,7 +111,113 @@
|
|||
<module>openjpa-integration</module>
|
||||
<module>openjpa-all</module>
|
||||
</modules>
|
||||
|
||||
<profiles>
|
||||
<!-- =============== -->
|
||||
<!-- Test Profiles -->
|
||||
<!-- =============== -->
|
||||
<!-- Default profile for testing with an embedded Apache Derby DB -->
|
||||
<profile>
|
||||
<!--
|
||||
Optionally, you can override the following properties:
|
||||
-Dderby.version=10.2.2.0
|
||||
-->
|
||||
<id>test-derby</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
<property>
|
||||
<name>test-derby</name>
|
||||
</property>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derby</artifactId>
|
||||
<version>${derby.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<connection.driver.name>org.apache.derby.jdbc.EmbeddedDriver</connection.driver.name>
|
||||
<connection.url>jdbc:derby:target/database/openjpa-derby-database;create=true</connection.url>
|
||||
<connection.username />
|
||||
<connection.password />
|
||||
</properties>
|
||||
</profile>
|
||||
<!-- Profile for testing with an In-Memory Apache Derby DB -->
|
||||
<profile>
|
||||
<!--
|
||||
Optionally, you can override the following properties:
|
||||
-Dderby.version=10.5.3.0_1
|
||||
-->
|
||||
<id>test-derbymem</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>test-derbymem</name>
|
||||
</property>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derby</artifactId>
|
||||
<version>${derby.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<derby.version>10.5.3.0_1</derby.version>
|
||||
<connection.driver.name>org.apache.derby.jdbc.EmbeddedDriver</connection.driver.name>
|
||||
<connection.url>jdbc:derby:memory:openjpa-derby-inmem-database;create=true</connection.url>
|
||||
<connection.username />
|
||||
<connection.password />
|
||||
</properties>
|
||||
</profile>
|
||||
<!-- Profile for testing with Apache Derby DB network server -->
|
||||
<profile>
|
||||
<!--
|
||||
Example Derby Network Server profile.
|
||||
You must manually start a Derby network server instance and
|
||||
also set the following properties:
|
||||
-Dopenjpa.derbynet.url=jdbc:derby://<HOST>:<PORT>/<DBNAME>;\
|
||||
create=true
|
||||
|
||||
Optionally, you can override the following properties:
|
||||
-Dopenjpa.derbynet.driver=org.apache.derby.jdbc.ClientXADataSource
|
||||
-Dopenjpa.derbynet.username=
|
||||
-Dopenjpa.derbynet.password=
|
||||
-Dderby.version=10.2.2.0
|
||||
-->
|
||||
<id>test-derbynet</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>test-derbynet</name>
|
||||
</property>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derbyclient</artifactId>
|
||||
<version>${derby.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<openjpa.derbynet.url>jdbc:derby://localhost:1527/openjpa20;create=true;traceDirectory=target;traceFile=derby.log</openjpa.derbynet.url>
|
||||
<openjpa.derbynet.driver>org.apache.derby.jdbc.ClientDriver</openjpa.derbynet.driver>
|
||||
<!-- Note: commons-dbcp requires dummy values for uid/pwd -->
|
||||
<openjpa.derbynet.username>uid</openjpa.derbynet.username>
|
||||
<openjpa.derbynet.password>pwd</openjpa.derbynet.password>
|
||||
<connection.driver.name>${openjpa.derbynet.driver}</connection.driver.name>
|
||||
<connection.url>${openjpa.derbynet.url}</connection.url>
|
||||
<connection.username>${openjpa.derbynet.username}</connection.username>
|
||||
<connection.password>${openjpa.derbynet.password}</connection.password>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
|
||||
<!-- ================ -->
|
||||
<!-- Build Profiles -->
|
||||
<!-- ================ -->
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<activation>
|
||||
|
|
Loading…
Reference in New Issue