abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Duncan" <stephen.dun...@gmail.com>
Subject Re: Unit Tests in Maven
Date Sat, 17 Jun 2006 00:46:21 GMT
Ok, nevermind.  I know why the NullPointerException's are happening
when building clean from Maven.  The xml files in src/test/java should
be moved to src/test/resources.

-Stephen

On 6/16/06, Stephen Duncan <stephen.duncan@gmail.com> wrote:
> Ok.  I just found where it does exist in ibiblio.  So no problems
> there.   The dependency should be:
>
>     <dependency>
>         <groupId>woodstox</groupId>
>         <artifactId>wstx-asl</artifactId>
>         <version>2.0.5</version>
>         <scope>runtime</scope>
>     </dependency>
>
> However, I just noticed that the tests only run properly if I compile
> with Eclipse.   If I compile with Maven, then NullPointerExceptions
> are thrown:
>
> -------------------------------------------------------------------------------
> Test set: org.apache.abdera.test.parser.stax.FOMTest
> -------------------------------------------------------------------------------
> Tests run: 7, Failures: 0, Errors: 5, Skipped: 0, Time elapsed: 0.102
> sec <<< FAILURE!
> testParser(org.apache.abdera.test.parser.stax.FOMTest)  Time elapsed:
> 0.001 sec  <<< ERROR!
> org.apache.abdera.parser.ParseException: java.lang.NullPointerException
>         at org.apache.abdera.parser.stax.FOMParser.parse(FOMParser.java:56)
>         at org.apache.abdera.util.AbstractParser.parse(AbstractParser.java:40)
>         at org.apache.abdera.test.parser.stax.FOMTest.testParser(FOMTest.java:51)
>
> testWhiteListParseFilter(org.apache.abdera.test.parser.stax.FOMTest)
> Time elapsed: 0.002 sec  <<< ERROR!
> java.lang.NullPointerException
>         at org.apache.abdera.test.parser.stax.FOMTest.testWhiteListParseFilter(FOMTest.java:122)
>
> testBlackListParseFilter(org.apache.abdera.test.parser.stax.FOMTest)
> Time elapsed: 0.001 sec  <<< ERROR!
> java.lang.NullPointerException
>         at org.apache.abdera.test.parser.stax.FOMTest.testBlackListParseFilter(FOMTest.java:153)
>
> testTextFilter(org.apache.abdera.test.parser.stax.FOMTest)  Time
> elapsed: 0.001 sec  <<< ERROR!
> java.lang.NullPointerException
>         at org.apache.abdera.test.parser.stax.FOMTest.testTextFilter(FOMTest.java:198)
>
> testXPath(org.apache.abdera.test.parser.stax.FOMTest)  Time elapsed:
> 0.002 sec  <<< ERROR!
> org.apache.abdera.parser.ParseException: java.lang.NullPointerException
>         at org.apache.abdera.parser.stax.FOMParser.parse(FOMParser.java:56)
>         at org.apache.abdera.util.AbstractParser.parse(AbstractParser.java:40)
>         at org.apache.abdera.test.parser.stax.FOMTest.testXPath(FOMTest.java:224)
>
>
> Any ideas on what might cause that?
>
> -Stephen
>
> On 6/16/06, James M Snell <jasnell@gmail.com> wrote:
> > Yes, that's the version we need.  Eventually, I would much prefer to get
> > away from Woodstox completely.  If there are other Stax implementations
> > available with compatible licenses, we should explore those as well.
> >
> > I'm looking into the class cast exception.
> >
> > - James
> >
> > Stephen Duncan wrote:
> > > "If that's the case" -> "If this jar is the one we must use"
> > >
> > > -Stephen
> > >
> > > On 6/16/06, Stephen Duncan <stephen.duncan@gmail.com> wrote:
> > >> Ok, I guess the wstx jar in the Maven repository isn't the right
> > >> version, or doesn't have enough.
> > >>
> > >> I installed the one downloaded by the ant build with the following
> > >> command (within the dependencies directory):
> > >>
> > >> mvn install:install-file -DgroupId=wstx -DartifactId=wstx-asl
> > >> -Dversion=2.0.5 -Dpackaging=jar -Dfile=wstx-asl-2.0.5.jar
> > >>
> > >> Then modified the dependency to be:
> > >>
> > >>    <dependency>
> > >>        <groupId>wstx</groupId>
> > >>        <artifactId>wstx-asl</artifactId>
> > >>        <version>2.0.5</version>
> > >>        <scope>runtime</scope>
> > >>    </dependency>
> > >>
> > >> And am now down to the one class cast exception:
> > >>
> > >> org.apache.axiom.om.OMException: java.lang.ClassCastException:
> > >> org.apache.abdera.parser.stax.FOMDocument
> > >>         at
> > >> org.apache.abdera.parser.stax.FOMBuilder.next(FOMBuilder.java:315)
> > >>         at
> > >> org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:552)
> > >>
> > >>         at
> > >> org.apache.axiom.om.impl.llom.OMElementImpl.getFirstOMChild(OMElementImpl.java:562)
> > >>
> > >>         at
> > >> org.apache.axiom.om.impl.llom.OMElementImpl.getFirstChildWithName(OMElementImpl.java:218)
> > >>
> > >>         at
> > >> org.apache.abdera.parser.stax.FOMElement.getTextElement(FOMElement.java:368)
> > >>
> > >>         at
> > >> org.apache.abdera.parser.stax.FOMElement.getText(FOMElement.java:433)
> > >>         at
> > >> org.apache.abdera.parser.stax.FOMSource.getTitle(FOMSource.java:417)
> > >>         at
> > >> org.apache.abdera.test.parser.stax.FOMTest.testTextFilter(FOMTest.java:202)
> > >>
> > >>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > >>         at
> > >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> > >>
> > >>         at
> > >> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> > >>
> > >>         at java.lang.reflect.Method.invoke(Method.java:585)
> > >>         at junit.framework.TestCase.runTest(TestCase.java:164)
> > >>         at junit.framework.TestCase.runBare(TestCase.java:130)
> > >>         at junit.framework.TestResult$1.protect(TestResult.java:106)
> > >>         at junit.framework.TestResult.runProtected(TestResult.java:124)
> > >>         at junit.framework.TestResult.run(TestResult.java:109)
> > >>         at junit.framework.TestCase.run(TestCase.java:120)
> > >>         at junit.framework.TestSuite.runTest(TestSuite.java:230)
> > >>         at junit.framework.TestSuite.run(TestSuite.java:225)
> > >>         at
> > >> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
> > >>
> > >>         at
> > >> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
> > >>
> > >>         at
> > >> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
> > >>
> > >>         at
> > >> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
> > >>
> > >>         at
> > >> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
> > >>
> > >>         at
> > >> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> > >>
> > >> Caused by: java.lang.ClassCastException:
> > >> org.apache.abdera.parser.stax.FOMDocument
> > >>         at
> > >> org.apache.abdera.test.parser.stax.FOMTest$1.filterText(FOMTest.java:184)
> > >>         at
> > >> org.apache.abdera.parser.stax.FOMBuilder.applyTextFilter(FOMBuilder.java:219)
> > >>
> > >>         at
> > >> org.apache.abdera.parser.stax.FOMBuilder.next(FOMBuilder.java:281)
> > >>         ... 25 more
> > >>
> > >> If that's the case, we need to look into trying to get the
> > >> wstx-asl-2.0.5.jar into the Maven repository.
> > >>
> > >> -Stephen
> > >>
> > >>
> > >> On 6/16/06, Stephen Duncan <stephen.duncan@gmail.com> wrote:
> > >> > I tried adding a runtime dependency on wstx (assuming that's woodstox):
> > >> >
> > >> >     <dependency>
> > >> >         <groupId>wstx</groupId>
> > >> >         <artifactId>wstx</artifactId>
> > >> >         <version>1.0</version>
> > >> >         <scope>runtime</scope>
> > >> >     </dependency>
> > >> >
> > >> > but I got a TON of new errors.  Could you try adding that to the
> > >> > parser pom.xml dependencies, running it, and see if you understand
> > >> > what might be going on?
> > >> >
> > >> > I assume all this is caused by magic decisions on which xml library
to
> > >> > use based on availability?
> > >> >
> > >> > -Stephen
> > >> >
> > >> > On 6/16/06, James M Snell <jasnell@gmail.com> wrote:
> > >> > > Two pieces: Axiom and Stax (axiom-impl, axiom-api, stax, woodstox).
> > >> > > Woodstox won't show up in the build dependency graph but is
> > >> required at
> > >> > > run time.
> > >> > >
> > >> > > - James
> > >> > >
> > >> > > Stephen Duncan wrote:
> > >> > > > Here's the dependency graph reported by Maven (from the
site
> > >> generated
> > >> > > > when running "mv n site".  The first level (stax, etc.)
are direct
> > >> > > > dependencies, levels below that are transitive dependencies.
> > >> > > >
> > >> > > >    * org.apache.abdera:abdera-parser:jar
> > >> > > >          o stax:stax-api:jar
> > >> > > >          o stax:stax:jar
> > >> > > >          o ws-commons:axiom-impl:jar
> > >> > > >          o junit:junit:jar
> > >> > > >          o jaxen:jaxen:jar
> > >> > > >                + dom4j:dom4j:jar
> > >> > > >                      # pull-parser:pull-parser:jar
> > >> > > >                      # jaxme:jaxme-api:jar
> > >> > > >                      # xml-apis:xml-apis:jar
> > >> > > >                      # msv:xsdlib:jar
> > >> > > >                      # xpp3:xpp3:jar
> > >> > > >                + jdom:jdom:jar
> > >> > > >                + xom:xom:jar
> > >> > > >                      # org.ccil.cowan.tagsoup:tagsoup:jar
> > >> > > >                      # xalan:xalan:jar
> > >> > > >                      # com.ibm.icu:icu4j:jar
> > >> > > >                + xerces:xmlParserAPIs:jar
> > >> > > >                + xerces:xercesImpl:jar
> > >> > > >          o org.apache.abdera:abdera-core:jar
> > >> > > >                + geronimo:geronimo-activation:jar
> > >> > > >                      #
> > >> > > > org.apache.geronimo.specs:geronimo-activation_1.0.2_spec:jar
> > >> > > >                      #
> > >> > > > org.apache.geronimo.specs:geronimo-javamail_1.3.1_spec:jar
> > >> > > >                      #
> > >> commons-jelly:commons-jelly-tags-velocity:jar
> > >> > > >                      # velocity:velocity:jar
> > >> > > >                            * velocity:velocity-dep:jar
> > >> > > >          o commons-logging:commons-logging:jar
> > >> > > >          o ws-commons:axiom-api:jar
> > >> > > >
> > >> > > > And here's the chart of the transitive dependencies including
> > >> versions
> > >> > > > (sorry for the formatting):
> > >> > > >
> > >> > > > compile
> > >> > > >
> > >> > > > The following is a list of compile dependencies for this
project.
> > >> > > > These dependencies are required to compile and run the application:
> > >> > > > GroupId    ArtifactId    Version    Classifier    Type 
  Optional
> > >> > > > com.ibm.icu    icu4j    2.6.1    -    jar
> > >> > > > commons-jelly    commons-jelly-tags-velocity    1.0    -
   jar
> > >> > > > dom4j    dom4j    1.5.2    -    jar
> > >> > > > geronimo    geronimo-activation    1.0    -    jar
> > >> > > > jaxme    jaxme-api    0.3    -    jar
> > >> > > > jdom    jdom    1.0    -    jar
> > >> > > > msv    xsdlib    20030807    -    jar
> > >> > > > org.apache.geronimo.specs    geronimo-activation_1.0.2_spec
   1.0
> > >> > > > -    jar
> > >> > > > org.apache.geronimo.specs    geronimo-javamail_1.3.1_spec
> > >> 1.0    -
> > >> > > > jar
> > >> > > > org.ccil.cowan.tagsoup    tagsoup    0.9.7    -    jar
> > >> > > > pull-parser    pull-parser    2    -    jar
> > >> > > > velocity    velocity    1.4    -    jar
> > >> > > > xalan    xalan    2.6.0    -    jar
> > >> > > > xerces    xercesImpl    2.8.0    -    jar
> > >> > > > xerces    xmlParserAPIs    2.6.2    -    jar
> > >> > > > xml-apis    xml-apis    1.0.b2    -    jar
> > >> > > > xom    xom    1.0b3    -    jar
> > >> > > > xpp3    xpp3    1.1.3.3    -    jar
> > >> > > > runtime
> > >> > > >
> > >> > > > The following is a list of runtime dependencies for this
project.
> > >> > > > These dependencies are required to run the application:
> > >> > > > GroupId    ArtifactId    Version    Classifier    Type 
  Optional
> > >> > > > velocity    velocity-dep    1.4    -    jar
> > >> > > >
> > >> > > > Any ideas on what I should look at as being responsible
for the
> > >> > > > different XML output?
> > >> > > >
> > >> > > > -Stephen
> > >> > > >
> > >> > > > On 6/16/06, Stephen Duncan <stephen.duncan@gmail.com>
wrote:
> > >> > > >> There seem to now be two failures.  When I first checked
out
> > >> the code,
> > >> > > >> there were some null pointer exceptions (consistent
with a
> > >> snapshot
> > >> > > >> from James' website that I was troubleshooting &
 posting on his
> > >> > > >> blog), but after updating again to the latest, those
went away...
> > >> > > >>
> > >> > > >> WIth the Ant build not running the tests, I don't have
anything to
> > >> > > >> compare to to see what is Maven's fault.
> > >> > > >>
> > >> > > >> Here are the failures.  THe first one has happened for
a while:
> > >> spaces
> > >> > > >> are included in the output, but weren't when using Ant.
 Most
> > >> likely
> > >> > > >> I'll have to analyze what dependencies are different
in Maven from
> > >> > > >> Ant.  Note that when running the tests in Eclipse (set
up using
> > >> > > >> Maven), these same failures still happen.  The second
error
> > >> > > >> (ClassCastException) is new...
> > >> > > >>
> > >> > > >> -Stephen
> > >> > > >>
> > >> > > >>
> > >> -------------------------------------------------------------------------------
> > >>
> > >> > > >>
> > >> > > >> Test set: org.apache.abdera.test.parser.stax.FOMTest
> > >> > > >>
> > >> -------------------------------------------------------------------------------
> > >>
> > >> > > >>
> > >> > > >> Tests run: 7, Failures: 1, Errors: 1, Skipped: 0, Time
elapsed:
> > >> 0.196
> > >> > > >> sec <<< FAILURE!
> > >> > > >> testCreate(org.apache.abdera.test.parser.stax.FOMTest)
 Time
> > >> elapsed:
> > >> > > >> 0.023 sec  <<< FAILURE!
> > >> > > >> junit.framework.ComparisonFailure:
> > >> > > >> expected:<...http://example.org/"[/><a:author><a:name>John
> > >> > > >>
> > >> Doe</a:name></a:author><a:id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0
> > >> > > >> af6</a:id><a:contributor><a:name>Bob
> > >> > > >> Jones</a:name></a:contributor><a:category
> > >> > > >> term="example"/><a:entry><a:title type="text">re:
Atom-Powered
> > >> Robots
> > >> > > >> Run Amok</a:titl
> > >> > > >> e><a:link
> > >> > > >>
> > >> href="/2003/12/13/atom03/1"/><a:id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80cb323feb5b</a:id><a:summary
> > >>
> > >> > > >>
> > >> > > >> type="text">A response</a:summary><thr:in-reply-to
xmlns:
> > >> > > >> thr="http://purl.org/syndication/thread/1.0"
> > >> > > >> href="http://example.org/2003/12/13/atom03"
> > >> > > >>
> > >> ref="urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a"/></a:entry><a:entry><a:t
> > >>
> > >> > > >>
> > >> > > >> itle type="text">Atom-Powered Robots Run Amok</a:title><a:link
> > >> > > >>
> > >> href="http://example.org/2003/12/13/atom03"]/><a:id>urn:uuid:122...>
> > >> > > >> but was:<...http://example.org/"[
> > >> > > >>  /><a:author><a:name>John
> > >> > > >>
> > >> Doe</a:name></a:author><a:id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</a:id><a:contributor><a:name>Bob
> > >>
> > >> > > >>
> > >> > > >> Jones</a:name></a:contributor><
> > >> > > >> a:category term="example" /><a:entry><a:title
type="text">re:
> > >> > > >> Atom-Powered Robots Run Amok</a:title><a:link
> > >> > > >> href="/2003/12/13/atom03/1" /><a:id>urn:uuid:1225c695-cfb
> > >> > > >> 8-4ebb-aaaa-80cb323feb5b</a:id><a:summary type="text">A
> > >> > > >> response</a:summary><thr:in-reply-to
> > >> > > >> xmlns:thr="http://purl.org/syndication/thread/1.0"
> > >> > > >> href="http://example.
> > >> > > >> org/2003/12/13/atom03"
> > >> > > >> ref="urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a"
> > >> > > >> /></a:entry><a:entry><a:title type="text">Atom-Powered
Robots Run
> > >> > > >> Amok</a:title><a:link hr
> > >> > > >> ef="http://example.org/2003/12/13/atom03"
> > >> ]/><a:id>urn:uuid:122...>
> > >> > > >>         at junit.framework.Assert.assertEquals(Assert.java:81)
> > >> > > >>         at junit.framework.Assert.assertEquals(Assert.java:87)
> > >> > > >>         at
> > >> > > >>
> > >> org.apache.abdera.test.parser.stax.FOMTest.testCreate(FOMTest.java:104)
> > >> > > >>
> > >> > > >> testTextFilter(org.apache.abdera.test.parser.stax.FOMTest)
 Time
> > >> > > >> elapsed: 0.003 sec  <<< ERROR!
> > >> > > >> org.apache.axiom.om.OMException: java.lang.ClassCastException:
> > >> > > >> org.apache.abdera.parser.stax.FOMDocument
> > >> > > >>         at
> > >> > > >> org.apache.abdera.parser.stax.FOMBuilder.next(FOMBuilder.java:315)
> > >> > > >>         at
> > >> > > >>
> > >> org.apache.axiom.om.impl.llom.OMElementImpl.buildNext(OMElementImpl.java:552)
> > >>
> > >> > > >>
> > >> > > >>         at
> > >> > > >>
> > >> org.apache.axiom.om.impl.llom.OMElementImpl.getFirstOMChild(OMElementImpl.java:562)
> > >>
> > >> > > >>
> > >> > > >>         at
> > >> > > >>
> > >> org.apache.axiom.om.impl.llom.OMElementImpl.getFirstChildWithName(OMElementImpl.java:218)
> > >>
> > >> > > >>
> > >> > > >>         at
> > >> > > >>
> > >> org.apache.abdera.parser.stax.FOMElement.getTextElement(FOMElement.java:368)
> > >>
> > >> > > >>
> > >> > > >>         at
> > >> > > >>
> > >> org.apache.abdera.parser.stax.FOMElement.getText(FOMElement.java:433)
> > >> > > >>         at
> > >> > > >>
> > >> org.apache.abdera.parser.stax.FOMSource.getTitle(FOMSource.java:417)
> > >> > > >>
> > >> > > >>
> > >> > > >> --
> > >> > > >> Stephen Duncan Jr
> > >> > > >> www.stephenduncanjr.com
> > >> > > >>
> > >> > > >
> > >> > > >
> > >> > >
> > >> >
> > >> >
> > >> > --
> > >> > Stephen Duncan Jr
> > >> > www.stephenduncanjr.com
> > >> >
> > >>
> > >>
> > >> --
> > >> Stephen Duncan Jr
> > >> www.stephenduncanjr.com
> > >>
> > >
> > >
> >
>
>
> --
> Stephen Duncan Jr
> www.stephenduncanjr.com
>


-- 
Stephen Duncan Jr
www.stephenduncanjr.com

Mime
View raw message