Author: ghuber
Date: Tue Jan 7 16:31:02 2014
New Revision: 1556265
URL: http://svn.apache.org/r1556265
Log:
Make testing on eclipse fun, at the moment its not.
Added:
roller/trunk/docs/testing/roller-junit.properties
Removed:
roller/trunk/docs/testing/roller-custom.properties
Modified:
roller/trunk/app/src/main/java/org/apache/roller/weblogger/config/WebloggerConfig.java
roller/trunk/docs/testing/junit-cleartables-mysql.sql
Modified:
roller/trunk/app/src/main/java/org/apache/roller/weblogger/config/WebloggerConfig.java
URL:
http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/config/WebloggerConfig.java?rev=1556265&r1=1556264&r2=1556265&view=diff
==============================================================================
---
roller/trunk/app/src/main/java/org/apache/roller/weblogger/config/WebloggerConfig.java
(original)
+++
roller/trunk/app/src/main/java/org/apache/roller/weblogger/config/WebloggerConfig.java
Tue Jan 7 16:31:02 2014
@@ -36,6 +36,7 @@ public class WebloggerConfig {
private static String default_config =
"/org/apache/roller/weblogger/config/roller.properties";
private static String custom_config = "/roller-custom.properties";
+ private static String junit_config = "/roller-junit.properties";
private static String custom_jvm_param = "roller.custom.config";
private static File custom_config_file = null;
@@ -59,14 +60,35 @@ public class WebloggerConfig {
// first, lets load our default properties
InputStream is = configClass.getResourceAsStream(default_config);
config.load(is);
+
+ // first, see if we can find our junit testing config
+ is = configClass.getResourceAsStream(junit_config);
+ if (is != null) {
- // now, see if we can find our custom config
- is = configClass.getResourceAsStream(custom_config);
- if(is != null) {
config.load(is);
- System.out.println("Roller Weblogger: Successfully loaded
custom properties file from classpath");
+ System.out
+ .println("Roller Weblogger: Successfully loaded junit
properties file from classpath");
+ System.out.println("File path : "
+ + configClass.getResource(junit_config).getFile());
+
} else {
- System.out.println("Roller Weblogger: No custom properties
file found in classpath");
+
+ // now, see if we can find our custom config
+ is = configClass.getResourceAsStream(custom_config);
+
+ if (is != null) {
+ config.load(is);
+ System.out
+ .println("Roller Weblogger: Successfully loaded
custom properties file from classpath");
+ System.out.println("File path : "
+ +
configClass.getResource(custom_config).getFile());
+ } else {
+ System.out
+ .println("Roller Weblogger: No custom properties
file found in classpath");
+ }
+
+ System.out
+ .println("(To run eclipse junit local tests see
docs/testing/roller-junit.properties)");
}
// finally, check for an external config file
Modified: roller/trunk/docs/testing/junit-cleartables-mysql.sql
URL:
http://svn.apache.org/viewvc/roller/trunk/docs/testing/junit-cleartables-mysql.sql?rev=1556265&r1=1556264&r2=1556265&view=diff
==============================================================================
--- roller/trunk/docs/testing/junit-cleartables-mysql.sql (original)
+++ roller/trunk/docs/testing/junit-cleartables-mysql.sql Tue Jan 7 16:31:02
2014
@@ -14,8 +14,14 @@
-- copyright in this work, please see the NOTICE file in the top level
-- directory of this distribution.
+-- Running local tests in eclipse.
+
-- Script is used to clear old data prior to running local tests
+-- Copy this file to
app/src/test/resources/dbscripts/junit-cleartables-mysql.sql
+
+-- Any changes here should also be in docs/testing/junit-cleartables-mysql.sql.
+
delete mt from website w, roller_mediafile mf, roller_mediafiletag mt where
w.id = mf.weblogid and mt.mediafile_id = mf.id and w.creator like 'junit_%';
delete mf from website w, roller_mediafile mf where w.id = mf.weblogid and
w.creator like 'junit_%';
delete md from website w, roller_mediafiledir md where w.id = md.websiteid and
w.creator like 'junit_%';
Added: roller/trunk/docs/testing/roller-junit.properties
URL:
http://svn.apache.org/viewvc/roller/trunk/docs/testing/roller-junit.properties?rev=1556265&view=auto
==============================================================================
--- roller/trunk/docs/testing/roller-junit.properties (added)
+++ roller/trunk/docs/testing/roller-junit.properties Tue Jan 7 16:31:02 2014
@@ -0,0 +1,69 @@
+## Eclipse/MySql junit custom properties for running local tests
+
+## Copy this file to app/src/test/resource (the ${testThemesDir} etc will be
populated by the builder).
+
+## Copy file junit-cleartables-mysql.sql to
app/src/test/resources/dbscripts/junit-cleartables-mysql.sql
+
+## Note: running local tests will execute
dbscripts/junit-cleartables-mysql.sql and will
+## clear files, so check before running or create an additional database with
the details below
+
+database.configurationType=jdbc
+database.jdbc.driverClass=com.mysql.jdbc.Driver
+database.jdbc.connectionURL=jdbc:mysql://localhost:3306/rollerdb?autoReconnect=true&useUnicode=true&characterEncoding=utf-8&mysqlEncoding=utf8
+database.jdbc.username=testuser
+database.jdbc.password=testuser
+
+hibernate.dialect=org.hibernate.dialect.MySQLDialect
+hibernate.transaction.factory_class=org.hibernate.transaction.JDBCTransactionFactory
+
+## Run junit-cleartables-mysql.sql to reset data
+junit.testdata.reset=true
+
+# turn off transaction manager during JUnit testing (TODO: find way to
activate for JUnit tests)
+# use CMA authentication to work around Spring init issues in UI tests
+authentication.cma.enabled=true
+
+# use plain text passwords in testing
+passwds.encryption.enabled=false
+
+# we don't want to start with any folders/bookmarks for testing
+newuser.blogroll=
+
+# we don't want to start with any weblog categories for testing
+newuser.categories=
+
+# put directories in ${build.tests}
+themes.dir=${testThemesDir}
+search.index.dir=${testIndexDir}
+uploads.dir=${testUploadsDir}
+mediafiles.storage.dir=${testMediaDir}
+
+# don't auto migrate during tests
+uploads.migrate.auto=false
+
+# override tasks.enabled so we can add a test task
+tasks.enabled=TestTask
+
+# test task
+tasks.TestTask.class=org.apache.roller.weblogger.business.TestTask
+tasks.TestTask.startTime=immediate
+tasks.TestTask.interval=1800
+tasks.TestTask.leaseTime=300
+
+# logging
+log4j.rootCategory=INFO, roller
+log4j.appender.roller.File=${project.build.directory}/roller.log
+log4j.category.org.apache.roller=INFO
+log4j.category.net.java.roller=ERROR
+
+log4j.category.org.apache.struts=DEBUG
+#log4j.category.org.apache.roller.planet.business.jpa.JPAPropertiesManagerImpl=DEBUG
+#log4j.category.org.apache.roller.weblogger.business.jpa.JPAPropertiesManagerImpl=DEBUG
+#log4j.category.org.apache.roller.weblogger.business=DEBUG
+
+#log4j.category.org.apache.roller.planet.config.PlanetConfig=DEBUG
+#log4j.category.org.apache.roller.weblogger.config.WebloggerConfig=DEBUG
+
+#log4j.category.org.apache.roller.weblogger.planet.tasks=DEBUG
+#log4j.category.org.apache.roller.planet.business=DEBUG
+#log4j.category.org.apache.roller.weblogger.planet.business=DEBUG