You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2010/01/31 21:25:47 UTC

svn commit: r905114 - in /ofbiz/trunk/framework/base: build.xml src/org/ofbiz/base/test/BaseUnitTests.java

Author: adrianc
Date: Sun Jan 31 20:25:46 2010
New Revision: 905114

URL: http://svn.apache.org/viewvc?rev=905114&view=rev
Log:
Added a unit test for StringUtil.java. I commented out the new webslinger tests which seem to fail every time.

Modified:
    ofbiz/trunk/framework/base/build.xml
    ofbiz/trunk/framework/base/src/org/ofbiz/base/test/BaseUnitTests.java

Modified: ofbiz/trunk/framework/base/build.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/build.xml?rev=905114&r1=905113&r2=905114&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/build.xml (original)
+++ ofbiz/trunk/framework/base/build.xml Sun Jan 31 20:25:46 2010
@@ -40,8 +40,10 @@
     <filelist id="test.classes" dir="${src.dir}">
         <file name="org/ofbiz/base/test/BaseUnitTests.java"/>
         <file name="org/ofbiz/base/util/collections/test/GenericMapTest.java"/>
-	<file name="org/ofbiz/base/concurrent/test/SyncTTLObjectTest.java"/>
-	<file name="org/ofbiz/base/concurrent/test/AsyncTTLObjectTest.java"/>
+    	<!--
+	    <file name="org/ofbiz/base/concurrent/test/SyncTTLObjectTest.java"/>
+	    <file name="org/ofbiz/base/concurrent/test/AsyncTTLObjectTest.java"/>
+	    -->
     </filelist>
 
     <target name="init">

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/test/BaseUnitTests.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/test/BaseUnitTests.java?rev=905114&r1=905113&r2=905114&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/test/BaseUnitTests.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/test/BaseUnitTests.java Sun Jan 31 20:25:46 2010
@@ -22,15 +22,19 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+
 import junit.framework.TestCase;
 
-import org.ofbiz.base.conversion.*;
+import org.ofbiz.base.conversion.ConversionException;
+import org.ofbiz.base.conversion.Converter;
+import org.ofbiz.base.conversion.DateTimeConverters;
 import org.ofbiz.base.util.ComparableRange;
 import org.ofbiz.base.util.Debug;
+import org.ofbiz.base.util.StringUtil;
 import org.ofbiz.base.util.UtilFormatOut;
 import org.ofbiz.base.util.UtilValidate;
-import org.ofbiz.base.util.string.FlexibleStringExpander;
 import org.ofbiz.base.util.collections.FlexibleMapAccessor;
+import org.ofbiz.base.util.string.FlexibleStringExpander;
 
 public class BaseUnitTests extends TestCase {
 
@@ -147,7 +151,6 @@
         fma.put(testMap, "World");
         fse = FlexibleStringExpander.getInstance("Hello ${parameters.someList[0]}!");
         assertTrue("UEL auto-vivify List " + fse.expandString(testMap), compare.equals(fse.expandString(testMap)));
-
     }
 
     public void testDateTimeConverters() {
@@ -206,4 +209,11 @@
             fail(e.getMessage());
         }
     }
+
+    public void testStringUtil() {
+        byte[] testArray = {-1};
+        byte[] result = StringUtil.fromHexString(StringUtil.toHexString(testArray));
+        assertEquals("Hex onversions", testArray[0], result[0]);
+    }
+
 }



Re: svn commit: r905114 - in /ofbiz/trunk/framework/base: build.xml src/org/ofbiz/base/test/BaseUnitTests.java

Posted by Adrian Crum <ad...@yahoo.com>.
--- On Sun, 1/31/10, Adam Heath <do...@brainfood.com> wrote:
> Subject: Re: svn commit: r905114 - in /ofbiz/trunk/framework/base: build.xml src/org/ofbiz/base/test/BaseUnitTests.java
> To: dev@ofbiz.apache.org
> Date: Sunday, January 31, 2010, 9:47 PM
> Adrian Crum wrote:
> > --- On Sun, 1/31/10, Adam Heath <do...@brainfood.com>
> wrote:
> >> Subject: Re: svn commit: r905114 - in
> /ofbiz/trunk/framework/base: build.xml
> src/org/ofbiz/base/test/BaseUnitTests.java
> >> To: dev@ofbiz.apache.org
> >> Date: Sunday, January 31, 2010, 3:48 PM
> >> Adrian Crum wrote:
> >>> --- On Sun, 1/31/10, Adam Heath <do...@brainfood.com>
> >> wrote:
> >>>> Subject: Re: svn commit: r905114 - in
> >> /ofbiz/trunk/framework/base: build.xml
> >> src/org/ofbiz/base/test/BaseUnitTests.java
> >>>> To: dev@ofbiz.apache.org
> >>>> Date: Sunday, January 31, 2010, 1:05 PM
> >>>> adrianc@apache.org
> >>>> wrote:
> >>>>> Author: adrianc
> >>>>> Date: Sun Jan 31 20:25:46 2010
> >>>>> New Revision: 905114
> >>>>>
> >>>>> URL: http://svn.apache.org/viewvc?rev=905114&view=rev
> >>>>> Log:
> >>>>> Added a unit test for StringUtil.java.
> I
> >> commented out
> >>>> the new webslinger tests which seem to
> fail every
> >> time.
> >>>> Bad commit, 2 things done that are
> unrelated.
> >>>>
> >>>> What do you mean the TTLObject tests fail?
> 
> >> Care to
> >>>> show what fails?
> >>>> Before I committed this code, I did
> extensive
> >> testing to be
> >>>> sure that
> >>>> the tests always worked(before I added to
> ofbiz,
> >> they were
> >>>> a little
> >>>> racy, and would sometimes fail).
> >>>>
> >>>> I just ran just my 2 new test suites in a
> loop of
> >> 50, and
> >>>> they didn't
> >>>> fail.  I'm using sun java 1.6(not
> openjdk),
> >> and a
> >>>> system installed ant.
> >>> I think the difference is I'm running the
> tests from
> >> within the component, not from the main build
> file. I have
> >> my local copy set to run the base component tests
> every time
> >> I compile. It would be helpful if we could keep it
> that way.
> >> If not, then I'll uncomment it and keep my local
> copy
> >> patched.
> >>
> >> Of course, that's what I do.  You'll notice
> that I
> >> purposefully didn't
> >>  add them to testdef, they are only runnable
> from
> >> framework/base.
> >> What exception do you get?
> > 
> >    [junit] Testsuite:
> org.ofbiz.base.concurrent.test.SyncTTLObjectTest
> >     [junit] Tests run: 3,
> Failures: 1, Errors: 0, Time elapsed: 7.281 sec
> >     [junit] Testcase: testRefresh
> took 0 sec
> >     [junit] Testcase: testGetTTL
> took 0 sec
> >     [junit] Testcase: testGet took
> 7.281 sec
> >     [junit]    
> FAILED
> >     [junit] Auto-refresh: data
> expected:<2> but was:<1>
> >     [junit]
> junit.framework.ComparisonFailure: Auto-refresh: data
> expected:<2> but was:<1>
> >     [junit]     at
> org.ofbiz.base.test.GenericTestCaseBase.assertEquals(GenericTestCaseBase.java:194)
> >     [junit]     at
> org.ofbiz.base.concurrent.test.TTLObjectTest.assertGetObject(TTLObjectTest.java:80)
> >     [junit]     at
> org.ofbiz.base.concurrent.test.SyncTTLObjectTest.testGet(SyncTTLObjectTest.java:125)
> 
> What is wrong with your machine?
>     [junit] Testsuite:
> org.ofbiz.base.concurrent.test.SyncTTLObjectTest
>     [junit] Tests run: 5, Failures: 0, Errors: 0,
> Time elapsed: 3.688 sec
>     [junit]
>     [junit] Testcase: testRefresh took 0.012 sec
>     [junit] Testcase: testGetTTL took 0.004 sec
>     [junit] Testcase: testGet took 2.114 sec
>     [junit] Testcase: testSetGetAbort took 0.336
> sec
>     [junit] Testcase: testThrowException took
> 1.211 sec
>     [junit] Testsuite:
> org.ofbiz.base.concurrent.test.AsyncTTLObjectTest
>     [junit] Tests run: 4, Failures: 0, Errors: 0,
> Time elapsed: 7.193 sec
>     [junit]
>     [junit] Testcase: testGet took 4.266 sec
>     [junit] Testcase: testSetGetAbort took 0.304
> sec
>     [junit] Testcase: testThrowException took
> 1.313 sec
>     [junit] Testcase: testSet took 1.302 sec
> 
> Note that there are 5 tests in SyncTTLObjectTest, whereas
> yours only
> lists 4.  Plus, a successful run is sync:testGet is
> supposed to be
> under 3 seconds, but yours is more than 7.
> 
> > 
> > BUILD FAILED
> > C:\ofbiz\common.xml:110: Tests failed
> > 
> > Total time: 9 seconds
> > 
> > Windows XP, Java EE SDK v 6, latest Eclipse.
> > 
> > Also, I found a bad dependency. Run ant clean-all on
> the main build file, then try to run tests from
> framework/base. It fails. It seems the test target is
> expecting something to be compiled already? Something about
> crypto. I wish I could be more more help, but I'm just a
> grasshopper.
> 
> Um, yes, duh.  Running the tests in any component
> requires all other
> components that come before it to be built.  This
> means
> framework/start has to be built.  This is obvious, as
> framework/base
> compiles against things in start.
> 
> Then, when compiling framework/start, it complains about a
> missing
> org.ofbiz.tools.ant.IfTask.  You can get that by going
> to the top and
> running ant ofbiz-init.

Ah, I didn't think of that. I always pictured base being stand-alone, the bottom (or root) of the dependency.



      

Re: svn commit: r905114 - in /ofbiz/trunk/framework/base: build.xml src/org/ofbiz/base/test/BaseUnitTests.java

Posted by Adam Heath <do...@brainfood.com>.
Adrian Crum wrote:
> --- On Sun, 1/31/10, Adam Heath <do...@brainfood.com> wrote:
>> Subject: Re: svn commit: r905114 - in /ofbiz/trunk/framework/base: build.xml src/org/ofbiz/base/test/BaseUnitTests.java
>> To: dev@ofbiz.apache.org
>> Date: Sunday, January 31, 2010, 3:48 PM
>> Adrian Crum wrote:
>>> --- On Sun, 1/31/10, Adam Heath <do...@brainfood.com>
>> wrote:
>>>> Subject: Re: svn commit: r905114 - in
>> /ofbiz/trunk/framework/base: build.xml
>> src/org/ofbiz/base/test/BaseUnitTests.java
>>>> To: dev@ofbiz.apache.org
>>>> Date: Sunday, January 31, 2010, 1:05 PM
>>>> adrianc@apache.org
>>>> wrote:
>>>>> Author: adrianc
>>>>> Date: Sun Jan 31 20:25:46 2010
>>>>> New Revision: 905114
>>>>>
>>>>> URL: http://svn.apache.org/viewvc?rev=905114&view=rev
>>>>> Log:
>>>>> Added a unit test for StringUtil.java. I
>> commented out
>>>> the new webslinger tests which seem to fail every
>> time.
>>>> Bad commit, 2 things done that are unrelated.
>>>>
>>>> What do you mean the TTLObject tests fail? 
>> Care to
>>>> show what fails?
>>>> Before I committed this code, I did extensive
>> testing to be
>>>> sure that
>>>> the tests always worked(before I added to ofbiz,
>> they were
>>>> a little
>>>> racy, and would sometimes fail).
>>>>
>>>> I just ran just my 2 new test suites in a loop of
>> 50, and
>>>> they didn't
>>>> fail.  I'm using sun java 1.6(not openjdk),
>> and a
>>>> system installed ant.
>>> I think the difference is I'm running the tests from
>> within the component, not from the main build file. I have
>> my local copy set to run the base component tests every time
>> I compile. It would be helpful if we could keep it that way.
>> If not, then I'll uncomment it and keep my local copy
>> patched.
>>
>> Of course, that's what I do.  You'll notice that I
>> purposefully didn't
>>  add them to testdef, they are only runnable from
>> framework/base.
>> What exception do you get?
> 
>    [junit] Testsuite: org.ofbiz.base.concurrent.test.SyncTTLObjectTest
>     [junit] Tests run: 3, Failures: 1, Errors: 0, Time elapsed: 7.281 sec
>     [junit] Testcase: testRefresh took 0 sec
>     [junit] Testcase: testGetTTL took 0 sec
>     [junit] Testcase: testGet took 7.281 sec
>     [junit] 	FAILED
>     [junit] Auto-refresh: data expected:<2> but was:<1>
>     [junit] junit.framework.ComparisonFailure: Auto-refresh: data expected:<2> but was:<1>
>     [junit] 	at org.ofbiz.base.test.GenericTestCaseBase.assertEquals(GenericTestCaseBase.java:194)
>     [junit] 	at org.ofbiz.base.concurrent.test.TTLObjectTest.assertGetObject(TTLObjectTest.java:80)
>     [junit] 	at org.ofbiz.base.concurrent.test.SyncTTLObjectTest.testGet(SyncTTLObjectTest.java:125)

What is wrong with your machine?
    [junit] Testsuite: org.ofbiz.base.concurrent.test.SyncTTLObjectTest
    [junit] Tests run: 5, Failures: 0, Errors: 0, Time elapsed: 3.688 sec
    [junit]
    [junit] Testcase: testRefresh took 0.012 sec
    [junit] Testcase: testGetTTL took 0.004 sec
    [junit] Testcase: testGet took 2.114 sec
    [junit] Testcase: testSetGetAbort took 0.336 sec
    [junit] Testcase: testThrowException took 1.211 sec
    [junit] Testsuite: org.ofbiz.base.concurrent.test.AsyncTTLObjectTest
    [junit] Tests run: 4, Failures: 0, Errors: 0, Time elapsed: 7.193 sec
    [junit]
    [junit] Testcase: testGet took 4.266 sec
    [junit] Testcase: testSetGetAbort took 0.304 sec
    [junit] Testcase: testThrowException took 1.313 sec
    [junit] Testcase: testSet took 1.302 sec

Note that there are 5 tests in SyncTTLObjectTest, whereas yours only
lists 4.  Plus, a successful run is sync:testGet is supposed to be
under 3 seconds, but yours is more than 7.

> 
> BUILD FAILED
> C:\ofbiz\common.xml:110: Tests failed
> 
> Total time: 9 seconds
> 
> Windows XP, Java EE SDK v 6, latest Eclipse.
> 
> Also, I found a bad dependency. Run ant clean-all on the main build file, then try to run tests from framework/base. It fails. It seems the test target is expecting something to be compiled already? Something about crypto. I wish I could be more more help, but I'm just a grasshopper.

Um, yes, duh.  Running the tests in any component requires all other
components that come before it to be built.  This means
framework/start has to be built.  This is obvious, as framework/base
compiles against things in start.

Then, when compiling framework/start, it complains about a missing
org.ofbiz.tools.ant.IfTask.  You can get that by going to the top and
running ant ofbiz-init.


Re: svn commit: r905114 - in /ofbiz/trunk/framework/base: build.xml src/org/ofbiz/base/test/BaseUnitTests.java

Posted by Adrian Crum <ad...@yahoo.com>.
--- On Sun, 1/31/10, Adam Heath <do...@brainfood.com> wrote:
> Subject: Re: svn commit: r905114 - in /ofbiz/trunk/framework/base: build.xml src/org/ofbiz/base/test/BaseUnitTests.java
> To: dev@ofbiz.apache.org
> Date: Sunday, January 31, 2010, 3:48 PM
> Adrian Crum wrote:
> > --- On Sun, 1/31/10, Adam Heath <do...@brainfood.com>
> wrote:
> >> Subject: Re: svn commit: r905114 - in
> /ofbiz/trunk/framework/base: build.xml
> src/org/ofbiz/base/test/BaseUnitTests.java
> >> To: dev@ofbiz.apache.org
> >> Date: Sunday, January 31, 2010, 1:05 PM
> >> adrianc@apache.org
> >> wrote:
> >>> Author: adrianc
> >>> Date: Sun Jan 31 20:25:46 2010
> >>> New Revision: 905114
> >>>
> >>> URL: http://svn.apache.org/viewvc?rev=905114&view=rev
> >>> Log:
> >>> Added a unit test for StringUtil.java. I
> commented out
> >> the new webslinger tests which seem to fail every
> time.
> >>
> >> Bad commit, 2 things done that are unrelated.
> >>
> >> What do you mean the TTLObject tests fail? 
> Care to
> >> show what fails?
> >> Before I committed this code, I did extensive
> testing to be
> >> sure that
> >> the tests always worked(before I added to ofbiz,
> they were
> >> a little
> >> racy, and would sometimes fail).
> >>
> >> I just ran just my 2 new test suites in a loop of
> 50, and
> >> they didn't
> >> fail.  I'm using sun java 1.6(not openjdk),
> and a
> >> system installed ant.
> > 
> > I think the difference is I'm running the tests from
> within the component, not from the main build file. I have
> my local copy set to run the base component tests every time
> I compile. It would be helpful if we could keep it that way.
> If not, then I'll uncomment it and keep my local copy
> patched.
> 
> Of course, that's what I do.  You'll notice that I
> purposefully didn't
>  add them to testdef, they are only runnable from
> framework/base.
> What exception do you get?

   [junit] Testsuite: org.ofbiz.base.concurrent.test.SyncTTLObjectTest
    [junit] Tests run: 3, Failures: 1, Errors: 0, Time elapsed: 7.281 sec
    [junit] Testcase: testRefresh took 0 sec
    [junit] Testcase: testGetTTL took 0 sec
    [junit] Testcase: testGet took 7.281 sec
    [junit] 	FAILED
    [junit] Auto-refresh: data expected:<2> but was:<1>
    [junit] junit.framework.ComparisonFailure: Auto-refresh: data expected:<2> but was:<1>
    [junit] 	at org.ofbiz.base.test.GenericTestCaseBase.assertEquals(GenericTestCaseBase.java:194)
    [junit] 	at org.ofbiz.base.concurrent.test.TTLObjectTest.assertGetObject(TTLObjectTest.java:80)
    [junit] 	at org.ofbiz.base.concurrent.test.SyncTTLObjectTest.testGet(SyncTTLObjectTest.java:125)

BUILD FAILED
C:\ofbiz\common.xml:110: Tests failed

Total time: 9 seconds

Windows XP, Java EE SDK v 6, latest Eclipse.

Also, I found a bad dependency. Run ant clean-all on the main build file, then try to run tests from framework/base. It fails. It seems the test target is expecting something to be compiled already? Something about crypto. I wish I could be more more help, but I'm just a grasshopper.




      

Re: svn commit: r905114 - in /ofbiz/trunk/framework/base: build.xml src/org/ofbiz/base/test/BaseUnitTests.java

Posted by Adam Heath <do...@brainfood.com>.
Adrian Crum wrote:
> --- On Sun, 1/31/10, Adam Heath <do...@brainfood.com> wrote:
>> Subject: Re: svn commit: r905114 - in /ofbiz/trunk/framework/base: build.xml src/org/ofbiz/base/test/BaseUnitTests.java
>> To: dev@ofbiz.apache.org
>> Date: Sunday, January 31, 2010, 1:05 PM
>> adrianc@apache.org
>> wrote:
>>> Author: adrianc
>>> Date: Sun Jan 31 20:25:46 2010
>>> New Revision: 905114
>>>
>>> URL: http://svn.apache.org/viewvc?rev=905114&view=rev
>>> Log:
>>> Added a unit test for StringUtil.java. I commented out
>> the new webslinger tests which seem to fail every time.
>>
>> Bad commit, 2 things done that are unrelated.
>>
>> What do you mean the TTLObject tests fail?  Care to
>> show what fails?
>> Before I committed this code, I did extensive testing to be
>> sure that
>> the tests always worked(before I added to ofbiz, they were
>> a little
>> racy, and would sometimes fail).
>>
>> I just ran just my 2 new test suites in a loop of 50, and
>> they didn't
>> fail.  I'm using sun java 1.6(not openjdk), and a
>> system installed ant.
> 
> I think the difference is I'm running the tests from within the component, not from the main build file. I have my local copy set to run the base component tests every time I compile. It would be helpful if we could keep it that way. If not, then I'll uncomment it and keep my local copy patched.

Of course, that's what I do.  You'll notice that I purposefully didn't
 add them to testdef, they are only runnable from framework/base.
What exception do you get?

Re: svn commit: r905114 - in /ofbiz/trunk/framework/base: build.xml src/org/ofbiz/base/test/BaseUnitTests.java

Posted by Adrian Crum <ad...@yahoo.com>.
--- On Sun, 1/31/10, Adam Heath <do...@brainfood.com> wrote:
> Subject: Re: svn commit: r905114 - in /ofbiz/trunk/framework/base: build.xml src/org/ofbiz/base/test/BaseUnitTests.java
> To: dev@ofbiz.apache.org
> Date: Sunday, January 31, 2010, 1:05 PM
> adrianc@apache.org
> wrote:
> > Author: adrianc
> > Date: Sun Jan 31 20:25:46 2010
> > New Revision: 905114
> > 
> > URL: http://svn.apache.org/viewvc?rev=905114&view=rev
> > Log:
> > Added a unit test for StringUtil.java. I commented out
> the new webslinger tests which seem to fail every time.
> 
> Bad commit, 2 things done that are unrelated.
> 
> What do you mean the TTLObject tests fail?  Care to
> show what fails?
> Before I committed this code, I did extensive testing to be
> sure that
> the tests always worked(before I added to ofbiz, they were
> a little
> racy, and would sometimes fail).
> 
> I just ran just my 2 new test suites in a loop of 50, and
> they didn't
> fail.  I'm using sun java 1.6(not openjdk), and a
> system installed ant.

I think the difference is I'm running the tests from within the component, not from the main build file. I have my local copy set to run the base component tests every time I compile. It would be helpful if we could keep it that way. If not, then I'll uncomment it and keep my local copy patched.



      

Re: svn commit: r905114 - in /ofbiz/trunk/framework/base: build.xml src/org/ofbiz/base/test/BaseUnitTests.java

Posted by Adam Heath <do...@brainfood.com>.
adrianc@apache.org wrote:
> Author: adrianc
> Date: Sun Jan 31 20:25:46 2010
> New Revision: 905114
> 
> URL: http://svn.apache.org/viewvc?rev=905114&view=rev
> Log:
> Added a unit test for StringUtil.java. I commented out the new webslinger tests which seem to fail every time.

Bad commit, 2 things done that are unrelated.

What do you mean the TTLObject tests fail?  Care to show what fails?
Before I committed this code, I did extensive testing to be sure that
the tests always worked(before I added to ofbiz, they were a little
racy, and would sometimes fail).

I just ran just my 2 new test suites in a loop of 50, and they didn't
fail.  I'm using sun java 1.6(not openjdk), and a system installed ant.