Jervis,
It looks like the issue is in JAXRSUtils.findTargetMethod:
if (ori.isSubResourceLocator()) {
return ori;
} else if (ori.getHttpMethod() != null &&
ori.getHttpMethod().equalsIgnoreCase(httpMethod)) {
return ori;
}
In some cases, it's finding the getBook method first which
ori.isSubResoruceLocator() returns true. In other cases, it finds the
proper deleteBook call which triggers the other if. (the order of the
ori objects returned from getOperationResourceInfos() would be undefined
as it's just the keyset of a Map) I guess this method needs to be
updated to check those with exact httpMethods set first, then check
the others? I'm not really sure as I'm really not familiar with this
code.
Dan
On Friday 14 December 2007, Daniel Kulp wrote:
> I'm seeing this periodically as well. Not sure why. Is there a
> Map of some sort that is being used where a particular order is
> expected?
>
> FYI: it fails "randomly" from the maven command line for me.
> However, it seems to always fail in eclipse.
>
> Dan
>
> On Thursday 13 December 2007, Benson Margulies wrote:
> > I don't think I have any outstanding changes at all.
> >
> >
> > Running org.apache.cxf.jaxrs.JAXRSServiceFactoryBeanTest
> > Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
> > 0.152 sec
> > Running org.apache.cxf.jaxrs.provider.ProviderFactoryImplTest
> > Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
> > 0.068 sec
> > Running org.apache.cxf.jaxrs.JAXRSUtilsTest
> > Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed:
> > 0.025 sec <<< FAILURE!
> > testFindTargetResourceClassWithSubResource(org.apache.cxf.jaxrs.JAXR
> >SU tilsTest) Time elapsed: 0.011 sec <<< FAILURE!
> > org.junit.ComparisonFailure: expected:<[delete]Book> but
> > was:<[get]Book> at org.junit.Assert.assertEquals(Assert.java:96)
> > at org.junit.Assert.assertEquals(Assert.java:116)
> > at
> > org.apache.cxf.jaxrs.JAXRSUtilsTest.testFindTargetResourceClassWithS
> >ub Resource(JAXRSUtilsTest.java:95) at
> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
> >.j ava:39) at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
> >ss orImpl.java:25) at
> > java.lang.reflect.Method.invoke(Method.java:585) at
> > org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMe
> >th odRunner.java:99) at
> > org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMetho
> >dR unner.java:81) at
> > org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeA
> >nd AfterRunner.java:34) at
> > org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunn
> >er .java:75) at
> > org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.jav
> >a: 45) at
> > org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(T
> >es tClassMethodsRunner.java:66) at
> > org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMetho
> >ds Runner.java:35) at org.junit.internal.runners.TestClassRunner
> > $1.runUnprotected(TestClassRunner.java:42)
> > at
> > org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeA
> >nd AfterRunner.java:34) at
> > org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:
> >52 ) at
> > org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet
> >.j ava:62) at
> > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTe
> >st Set(AbstractDirectoryTestSuite.java:138) at
> > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(A
> >bs tractDirectoryTestSuite.java:125) at
> > org.apache.maven.surefire.Surefire.run(Surefire.java:132) at
> > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl
> >.j ava:39) at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcce
> >ss orImpl.java:25) at
> > java.lang.reflect.Method.invoke(Method.java:585) at
> > org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(S
> >ur efireBooter.java:290) at
> > org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.
> >ja va:818)
> >
> > Running org.apache.cxf.jaxrs.model.URITemplateTest
> > Tests run: 5, Failures: 0, Errors: 0, Skipped: 0, Time elapsed:
> > 0.028 sec
> >
> > Results :
> >
> > Failed tests:
> >
> > testFindTargetResourceClassWithSubResource(org.apache.cxf.jaxrs.JAXR
> >SU tilsTest)
> >
> > Tests run: 13, Failures: 1, Errors: 0, Skipped: 0
> >
> > [INFO]
> > --------------------------------------------------------------------
> >-- -- [ERROR] BUILD FAILURE
> > [INFO]
> > --------------------------------------------------------------------
> >-- -- [INFO] There are test failures.
> > [INFO]
> > --------------------------------------------------------------------
> >-- -- [INFO] For more information, run Maven with the -e switch
> > [INFO]
> > --------------------------------------------------------------------
> >-- -- [INFO] Total time: 13 minutes 19 seconds
> > [INFO] Finished at: Thu Dec 13 17:45:39 GMT-05:00 2007
> > [INFO] Final Memory: 58M/131M
> > [INFO]
> > --------------------------------------------------------------------
> >-- -- bim-1330% svn up
> > At revision 604057.
> > bim-1330%
--
J. Daniel Kulp
Principal Engineer, IONA
[EMAIL PROTECTED]
http://www.dankulp.com/blog