Author: boisvert
Date: Wed Dec 24 08:05:05 2008
New Revision: 729326
URL: http://svn.apache.org/viewvc?rev=729326&view=rev
Log:
ODE-463: Apply 2nd patch
Modified:
ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/Axis2TestBase.java
ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/EndpointConfigurationTest.java
ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanTestBase.java
ode/branches/APACHE_ODE_1.X/settings.rb.example
ode/branches/APACHE_ODE_1.X/tasks/nativedb.rake
Modified:
ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/Axis2TestBase.java
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/Axis2TestBase.java?rev=729326&r1=729325&r2=729326&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/Axis2TestBase.java
(original)
+++
ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/Axis2TestBase.java
Wed Dec 24 08:05:05 2008
@@ -49,26 +49,30 @@
protected String config;
- private static final String DO_NOT_OVERRIDE_CONFIG =
"<DO_NOT_OVERRIDE_CONFIG>";
+ protected static final String DO_NOT_OVERRIDE_CONFIG =
"<DO_NOT_OVERRIDE_CONFIG>";
+ private static String originalOdePersistence =
System.getProperty("ode.persistence");
+ private static String originalOdeConfigDir =
System.getProperty("org.apache.ode.configDir");
+
@DataProvider(name = "configs")
protected Iterator<Object[]> createConfigData() {
List<String> configDirList = new ArrayList<String>();
if( !(this instanceof ODEConfigDirAware) ||
((ODEConfigDirAware)this).getODEConfigDir().contains("hib")) {
- addToConfigDirList(configDirList,
"org.apache.ode.jpadbs");
+ addToConfigDirList(configDirList,
"org.apache.ode.hibdbs");
}
if( !(this instanceof ODEConfigDirAware) ||
!((ODEConfigDirAware)this).getODEConfigDir().contains("hib")) {
- addToConfigDirList(configDirList,
"org.apache.ode.hibdbs");
+ addToConfigDirList(configDirList,
"org.apache.ode.jpadbs");
}
if( configDirList.isEmpty() ) {
// if no system property is set, fall back to default
- System.out.println("WARNING: No Java system properties
have been set to override ode configuration, using default.");
if( this instanceof ODEConfigDirAware ) {
configDirList.add(((ODEConfigDirAware)this).getODEConfigDir());
} else {
configDirList.add(DO_NOT_OVERRIDE_CONFIG);
}
+ } else {
+ System.out.println("Java system properties have been
set to override ode configuration: " + configDirList);
}
final Iterator<String> itr = configDirList.iterator();
@@ -118,10 +122,39 @@
@BeforeMethod
protected void setUp() throws Exception {
+ /**
+ * 1. If no settings are given from buildr, the test runs with the
default config directory.
+ * 2. If no settings are given from buildr and if the test implements
ODEConfigDirAware, the test runs with
+ * the config directory from the interface.
+ * 3. If settings are given from buildr and if it's derby and openJPA,
test falls back to the above 1 or 2.
+ * 4. If settings are given from buildr and if it's derby and
hibernate, test falls back to the above 2 or
+ * uses -Dode.persistence=hibernate.
+ */
if( config == null || DO_NOT_OVERRIDE_CONFIG.equals(config) ) {
- System.out.println("Using default config.");
+ System.out.println("Test config: default.");
+ } else if("<jpa>".equals(config)) {
+ if( this instanceof ODEConfigDirAware ) {
+ config =
((ODEConfigDirAware)this).getODEConfigDir();
+ System.out.println("Test config: " + config + ".");
+ System.setProperty("org.apache.ode.configDir", config);
+ } else {
+ System.out.println("Test config: default.");
+ }
+ } else if("<hib>".equals(config)) {
+ if( this instanceof ODEConfigDirAware ) {
+ config =
((ODEConfigDirAware)this).getODEConfigDir();
+ System.out.println("Test config: " + config + ".");
+ System.setProperty("org.apache.ode.configDir", config);
+ } else {
+ // why does this not work?
+// System.out.println("Test config:
-Dode.persistence=hibernate");
+// System.setProperty("ode.persistence", "hibernate");
+ config =
getClass().getClassLoader().getResource("webapp").getFile() +
"/WEB-INF/conf.hib-derby";
+ System.out.println("Test config: " + config + ".");
+ System.setProperty("org.apache.ode.configDir", config);
+ }
} else {
- System.out.println("Using config: " + config + ".");
+ System.out.println("Test config: " + config + ".");
System.setProperty("org.apache.ode.configDir", config);
}
@@ -131,6 +164,17 @@
@AfterMethod
protected void tearDown() throws Exception {
stopServer();
+
+ if( originalOdeConfigDir != null ) {
+ System.setProperty("org.apache.ode.configDir",
originalOdeConfigDir);
+ } else {
+ System.clearProperty("org.apache.ode.configDir");
+ }
+ if( originalOdeConfigDir != null ) {
+ System.setProperty("ode.persistence", originalOdePersistence);
+ } else {
+ System.clearProperty("ode.persistence");
+ }
}
protected class ODEAxis2Server extends AxisServer {
Modified:
ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/EndpointConfigurationTest.java
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/EndpointConfigurationTest.java?rev=729326&r1=729325&r2=729326&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/EndpointConfigurationTest.java
(original)
+++
ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/EndpointConfigurationTest.java
Wed Dec 24 08:05:05 2008
@@ -33,7 +33,7 @@
*
*/
public class EndpointConfigurationTest extends Axis2TestBase {
- @Test(dataProvider="configs")
+ @Test
public void testEndpointProperties() throws Exception {
executeProcess();
}
@@ -66,7 +66,7 @@
* Redo the exact same test but with Basic Authentication activated on the
external service
* @throws Exception
*/
- @Test(dataProvider="configs")
+ @Test
public void testHttpAuthentication() throws Exception {
ContextHandler securedEchoContext;
{
Modified:
ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanTestBase.java
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanTestBase.java?rev=729326&r1=729325&r2=729326&view=diff
==============================================================================
---
ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanTestBase.java
(original)
+++
ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/instancecleanup/CleanTestBase.java
Wed Dec 24 08:05:05 2008
@@ -33,7 +33,7 @@
if( txm != null ) {
try {
txm.commit();
- } catch( Exception e ) {
+ } catch( Exception e ) {
//ignore
}
}
@@ -59,7 +59,14 @@
}
protected Database getDatabase() throws Exception {
- File configFile = new File(getODEConfigDir());
+ String odeConfigDir = getODEConfigDir();
+ if( config == null || DO_NOT_OVERRIDE_CONFIG.equals(config) ||
"<jpa>".equals(config) || "<hib>".equals(config) ) {
+ System.out.println("Profiling config, default: " +
odeConfigDir);
+ } else {
+ System.out.println("Profiling config: " + config + ".");
+ odeConfigDir = config;
+ }
+ File configFile = new File(odeConfigDir);
ODEConfigProperties odeProps = new
ODEConfigProperties(configFile);
odeProps.load();
Database db = new Database(odeProps);
@@ -74,8 +81,9 @@
}
protected ProcessDAO assertInstanceCleanup(int instances, int
activityRecoveries, int correlationSets, int faults, int exchanges, int routes,
int messsages, int partnerLinks, int scopes, int variables, int events, int
largeData) throws Exception {
- initTM();
+ initTM();
ProcessInstanceProfileDAO profile =
daoConn.createProcessInstanceProfile(getInstance());
+
assertEquals("Number of instances", instances,
profile.findInstancesByProcess().size());
assertEquals("Number of activity recoveries",
activityRecoveries, profile.findActivityRecoveriesByInstance().size());
assertEquals("Number of correlation sets", correlationSets,
profile.findCorrelationSetsByInstance().size());
Modified: ode/branches/APACHE_ODE_1.X/settings.rb.example
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/settings.rb.example?rev=729326&r1=729325&r2=729326&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/settings.rb.example (original)
+++ ode/branches/APACHE_ODE_1.X/settings.rb.example Wed Dec 24 08:05:05 2008
@@ -5,6 +5,16 @@
REQUIRES = [MYSQL, SYBASE, DB2]
def settings
+ jpa_derby = {
+ :db=>"derby",
+ :dao=>"org.apache.ode.axis2.instancecleanup.JpaDaoConnectionFactoryImpl"
+ }
+
+ hib_derby = {
+ :db=>"derby",
+ :dao=>"org.apache.ode.axis2.instancecleanup.HibDaoConnectionFactoryImpl"
+ }
+
local_hib_mysql = {
:integr_branch=>"5.2.x",
:db=>"mysql",
@@ -50,8 +60,10 @@
}
{
-# "hib-mysql"=>local_hib_mysql,
+ "jpa-derby"=>jpa_derby,
+ "hib-derby"=>hib_derby
# "jpa-mysql"=>local_jpa_mysql,
+# "hib-mysql"=>local_hib_mysql
# "hib-db2"=>pxetest_hib_db2_95,
# "hib-sybase"=>pxetest_hib_sybase_12
}
Modified: ode/branches/APACHE_ODE_1.X/tasks/nativedb.rake
URL:
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/tasks/nativedb.rake?rev=729326&r1=729325&r2=729326&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/tasks/nativedb.rake (original)
+++ ode/branches/APACHE_ODE_1.X/tasks/nativedb.rake Wed Dec 24 08:05:05 2008
@@ -31,8 +31,10 @@
require SETTINGS
settings().each do |name, dbprops|
- buildr.build create_hib_db(name, "#{base}/target/#{name}"=>dbprops)
if orm == :hib and dbprops[:dao].downcase.include? "hib"
- buildr.build create_jpa_db(base, name,
"#{base}/target/#{name}"=>dbprops) if orm == :jpa and
!dbprops[:dao].downcase.include? "hib"
+ if dbprops[:db] != "derby"
+ buildr.build create_hib_db(name,
"#{base}/target/#{name}"=>dbprops) if orm == :hib and
dbprops[:dao].downcase.include? "hib"
+ buildr.build create_jpa_db(base, name,
"#{base}/target/#{name}"=>dbprops) if orm == :jpa and
!dbprops[:dao].downcase.include? "hib"
+ end
end
end
end
@@ -109,13 +111,17 @@
hibdbs = ""
jpadbs = ""
settings().each do |name, dbprops|
- test.with REQUIRES
-
- prepare_config(name, dbprops, "#{base}/target/conf.#{name}",
"#{base}/src/main/webapp/WEB-INF/conf.template")
- dbs = jpadbs
- dbs = hibdbs if dbprops[:dao].downcase.include? "hib"
- dbs <<= ", " if dbs.length > 0
- dbs <<= "#{base}/target/conf.#{name}"
+ dbs = (dbprops[:dao].downcase.include? "hib") ? hibdbs : jpadbs
+ if dbprops[:db] == "derby"
+ dbs <<= ", " if dbs.length > 0
+ dbs <<= (dbs == jpadbs ? "<jpa>" : "<hib>")
+ else
+ test.with REQUIRES
+
+ prepare_config(name, dbprops, "#{base}/target/conf.#{name}",
"#{base}/src/main/webapp/WEB-INF/conf.template")
+ dbs <<= ", " if dbs.length > 0
+ dbs <<= "#{base}/target/conf.#{name}"
+ end
end
test.using :properties=>{ "org.apache.ode.hibdbs"=>hibdbs,
"org.apache.ode.jpadbs"=>jpadbs }