cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <u....@cbim.it>
Subject ResolverImpl test case broken again?
Date Wed, 08 Oct 2003 23:34:19 GMT
I'm a bit confused. First of all, I don't give a damn about 
ResolverImpl. It's deprecated and some time ago David Crossley proposed 
to remove the ResolverImplTestCase, because it caused the build to fail 
if deprecated classes were not compiled.

But now Carsten has fixed the problem 
(http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20096) and the build 
should run fine even without deprecated classes (but does it? See below).

The problem is that the test itself fails:

Testcase: testCatalogPropertiesAvailable took 0.009 sec
         Caused an ERROR
null
java.lang.ClassCastException
         at 
org.apache.cocoon.components.resolver.test.ResolverImplTestCase.setUp(ResolverImplTestCase.java:282)

I find it strange that nobody else noticed the problem, so maybe it has 
to do with some problem local to my machine (or maybe nobody ever runs 
the test suite). So I run "build test" on the 2.1.2 release and lo and 
behold ... it fails as well!

Did we really release with a broken test suite? I find it hard to 
believe and I'm asking confirmation from someone else before I file an 
issue in bugzilla.

 From what I can understand, the bug is due to a mismatch between the 
source:

282:        resolverImpl = (DefaultEntityResolver) manager.lookup(role);

and the ResolverImplTestCase.xtest file:

<role name="org.apache.excalibur.xml.EntityResolver"
   shorthand="entity-resolver"
   default-class="org.apache.cocoon.components.resolver.ResolverImpl">
</role>

Well, of course ResolverImpl implements EntityResolver but does not 
extend DefaultEntityResolver, thus the ClassCastException.

Let's see what if I can do a quick fix (actually I'm writing this mail 
non post-facto, but as a kind of loud reasoning while I'm working on the 
problem) ... a few seconds later:

./build.sh test
...
BUILD SUCCESSFUL
Total time: 1 minute 54 seconds

OK, cool. Let's see if it runs without deprecated classes:

./build.sh test
...
java.lang.ClassNotFoundException: 
org.apache.cocoon.components.resolver.ResolverImpl
...
BUILD FAILED

Oh, shit! Let's try this on the 2.1.2 release ... same error! I'm 
baffled. Did bug 20096 rear its ugly head again? Was closing it a 
side-effect of Belgian beers? ;-).

So, to recapitulate:

- Bug #20096 is to be reopened.
- The test suite is broken, but we have a fix for that (patch is 
attached below).

[Of course it's entirely possible that I'm missing something obvious, 
being 1:23PM and maybe I'm still under the influence of the above 
mentioned beers.]

In the end, do we keep ResolverImplTestCase and try to fix bug #20096 
again, or do we drop it and go on? In my case, going on means writing 
some tests for Woody before I try to implement a feature I have in mind. 
I was just preparing to do this when I stumbled upon 
ResolverImplTestCase, so I'm inclined to say "kill the bastard and just 
go on".

What do you think?

	Ugo

P.S.: patch follows:

Index: ResolverImplTestCase.java
===================================================================
RCS file: 
/home/cvs/cocoon-2.1/src/test/org/apache/cocoon/components/resolver/test/ResolverImplTestCase.java,v
retrieving revision 1.7
diff -u -r1.7 ResolverImplTestCase.java
--- ResolverImplTestCase.java	30 Sep 2003 13:36:33 -0000	1.7
+++ ResolverImplTestCase.java	8 Oct 2003 23:33:03 -0000
@@ -59,10 +59,10 @@
  import org.apache.avalon.excalibur.testcase.ExcaliburTestCase;
  import org.apache.avalon.framework.activity.Disposable;
  import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.component.Component;
  import org.apache.avalon.framework.context.DefaultContext;
  import org.apache.cocoon.Constants;
  import org.apache.excalibur.xml.EntityResolver;
-import org.apache.excalibur.xml.DefaultEntityResolver;
  import org.apache.cocoon.environment.commandline.CommandLineContext;
  import org.apache.cocoon.util.IOUtils;
  import org.xml.sax.InputSource;
@@ -231,7 +231,7 @@
          "<!ENTITY shy    \"&#173;\" ><!--=soft hyphen-->\n" +
          "";
      private DefaultContext context;
-    private DefaultEntityResolver resolverImpl;
+    private EntityResolver resolverImpl;
      private File workDir;
      private File commandlineContextDir;

@@ -279,7 +279,7 @@
          super.setUp();

          String role = EntityResolver.ROLE;
-        resolverImpl = (DefaultEntityResolver) manager.lookup(role);
+        resolverImpl = (EntityResolver) manager.lookup(role);
          assertNotNull("ResolverImpl is null", resolverImpl);
      }

@@ -346,7 +346,7 @@
          super.tearDown();

          if (resolverImpl != null) {
-            manager.release(resolverImpl);
+            manager.release((Component) resolverImpl);
              resolverImpl = null;
          }
      }



Mime
View raw message