You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@roller.apache.org by Glen Mazza <gl...@gmail.com> on 2013/07/31 14:52:30 UTC

Re: svn commit: r1508837 - /roller/trunk/app/src/main/java/org/apache/roller/weblogger/TestUtils.java

BTW, this new functionality you put in, how do we use it/where does it help?

Glen

On 07/31/2013 08:50 AM, ghuber@apache.org wrote:
> Author: ghuber
> Date: Wed Jul 31 12:50:42 2013
> New Revision: 1508837
>
> URL: http://svn.apache.org/r1508837
> Log:
> Make tests easier to run locally.
>
> Modified:
>      roller/trunk/app/src/main/java/org/apache/roller/weblogger/TestUtils.java
>
> Modified: roller/trunk/app/src/main/java/org/apache/roller/weblogger/TestUtils.java
> URL: http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/TestUtils.java?rev=1508837&r1=1508836&r2=1508837&view=diff
> ==============================================================================
> --- roller/trunk/app/src/main/java/org/apache/roller/weblogger/TestUtils.java (original)
> +++ roller/trunk/app/src/main/java/org/apache/roller/weblogger/TestUtils.java Wed Jul 31 12:50:42 2013
> @@ -150,7 +150,7 @@ public final class TestUtils {
>           ClasspathDatabaseScriptProvider scriptProvider = new ClasspathDatabaseScriptProvider();
>   
>           InputStream script = scriptProvider
> -                .getAbsoluteDatabaseScript("junit-cleartables-" + dbname
> +                .getAbsoluteDatabaseScript("sql/junit-cleartables-" + dbname
>                           + ".sql");
>   
>           try {
>
>


Re: svn commit: r1508837 - /roller/trunk/app/src/main/java/org/apache/roller/weblogger/TestUtils.java

Posted by Greg Huber <gr...@gmail.com>.
Glen,

The mods are just to clear the files prior to running a test class again.
The user names are prefixed with junit_

Using eclipse, to run Junit launches.

Basically I have two projects in eclipse one where m2e mucks about with a
standard non maven webapp project.  With eclipse you just have to work the
way its designed.  Maven in eclipse is too unproductive, and the m2e
builders are a waste of xxxx time. (Designed by hourly paid contractors who
have time to wait for the class path to rebuild after a mvn clean.)

1. Create a custom folder on the build path and copy in the
test/resources/roller-custom.properties. If you place the custom folder
above java/resources so its found first and eclipse only copies the first
one found).

2. Change to msql:

database.configurationType=jdbc
database.jdbc.driverClass=com.mysql.jdbc.Driver
database.jdbc.connectionURL=jdbc:mysql://localhost:3306/rollerdev?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=utf-8&amp;mysqlEncoding=utf8
database.jdbc.username=testuser
database.jdbc.password=testuser

2. Update the entries to where you want the stuff to go.

themes.dir=${testThemesDir}
search.index.dir=${testIndexDir}
uploads.dir=${testUploadsDir}
mediafiles.storage.dir=${testMediaDir}

themes.dir=app/src/main/webapp/themes
search.index.dir=target/build/index
uploads.dir=target/build/uploadsdir
mediafiles.storage.dir=target/build/mediafiles

3. Then on the test class do a run as Junit test.  It will launch and run
the tests.  It will then leave all the test data in the file.  So to run it
again, edit the launch and add -Droller.tests.reset=true to the JVM
runtime.  This will get TestUtils to call the SQL script and remove all the
old data so the test can run again.

You have to make sure it has all its dependencies etc.

The sql/junit-cleartables-mysql.sql is still work in progress, and when
doing more debugging with the tests we can update what needs to be cleared.

btw you were correct, maven from the command line works best.

Cheers Greg.

On 31 July 2013 13:52, Glen Mazza <gl...@gmail.com> wrote:

> BTW, this new functionality you put in, how do we use it/where does it
> help?
>
> Glen
>
> On 07/31/2013 08:50 AM, ghuber@apache.org wrote:
>
>> Author: ghuber
>> Date: Wed Jul 31 12:50:42 2013
>> New Revision: 1508837
>>
>> URL: http://svn.apache.org/r1508837
>> Log:
>> Make tests easier to run locally.
>>
>> Modified:
>>      roller/trunk/app/src/main/**java/org/apache/roller/**
>> weblogger/TestUtils.java
>>
>> Modified: roller/trunk/app/src/main/**java/org/apache/roller/**
>> weblogger/TestUtils.java
>> URL: http://svn.apache.org/viewvc/**roller/trunk/app/src/main/**
>> java/org/apache/roller/**weblogger/TestUtils.java?rev=**
>> 1508837&r1=1508836&r2=1508837&**view=diff<http://svn.apache.org/viewvc/roller/trunk/app/src/main/java/org/apache/roller/weblogger/TestUtils.java?rev=1508837&r1=1508836&r2=1508837&view=diff>
>> ==============================**==============================**
>> ==================
>> --- roller/trunk/app/src/main/**java/org/apache/roller/**weblogger/TestUtils.java
>> (original)
>> +++ roller/trunk/app/src/main/**java/org/apache/roller/**weblogger/TestUtils.java
>> Wed Jul 31 12:50:42 2013
>> @@ -150,7 +150,7 @@ public final class TestUtils {
>>           ClasspathDatabaseScriptProvide**r scriptProvider = new
>> ClasspathDatabaseScriptProvide**r();
>>             InputStream script = scriptProvider
>> -                .getAbsoluteDatabaseScript("**junit-cleartables-" +
>> dbname
>> +                .getAbsoluteDatabaseScript("**sql/junit-cleartables-" +
>> dbname
>>                           + ".sql");
>>             try {
>>
>>
>>
>