Return-Path: Delivered-To: apmail-jakarta-hivemind-cvs-archive@www.apache.org Received: (qmail 17432 invoked from network); 1 Aug 2004 17:40:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 1 Aug 2004 17:40:40 -0000 Received: (qmail 10945 invoked by uid 500); 1 Aug 2004 17:40:40 -0000 Delivered-To: apmail-jakarta-hivemind-cvs-archive@jakarta.apache.org Received: (qmail 10926 invoked by uid 500); 1 Aug 2004 17:40:40 -0000 Mailing-List: contact hivemind-cvs-help@jakarta.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: hivemind-dev@jakarta.apache.org Delivered-To: mailing list hivemind-cvs@jakarta.apache.org Received: (qmail 10912 invoked by uid 99); 1 Aug 2004 17:40:39 -0000 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.27.1) with SMTP; Sun, 01 Aug 2004 10:40:38 -0700 Received: (qmail 17424 invoked by uid 1616); 1 Aug 2004 17:40:37 -0000 Date: 1 Aug 2004 17:40:37 -0000 Message-ID: <20040801174037.17423.qmail@minotaur.apache.org> From: hlship@apache.org To: jakarta-hivemind-cvs@apache.org Subject: cvs commit: jakarta-hivemind/library/src/java/org/apache/hivemind/lib/pipeline FilterMethodAnalyzer.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N hlship 2004/08/01 10:40:37 Modified: . .classpath status.xml framework/src/test/org/apache/hivemind/methodmatch TestMethodMatcher.java AbstractMethodTestCase.java framework/src/test/hivemind/test/ant TestConstructRegistry.java framework/src/java/org/apache/hivemind/schema/rules InstanceTranslator.java RulesMessages.java RulesStrings.properties library build.xml framework/src/java/org/apache/hivemind/test HiveMindTestCase.java framework/src/test/hivemind/test/rules TestObjectTranslator.java src/documentation/content/xdocs dependencies.xml framework/src/test/hivemind/test/services EventProducer.java TestMethodSignature.java framework/src/test/hivemind/test TestRegistryBuilder.java library/src/java/org/apache/hivemind/lib/pipeline FilterMethodAnalyzer.java Added: framework/src/test-data TestRegistryBuilder.jar Log: HIVEMIND-35: Ensure JDK 1.3 compatibility. Revision Changes Path 1.35 +1 -1 jakarta-hivemind/.classpath Index: .classpath =================================================================== RCS file: /home/cvs/jakarta-hivemind/.classpath,v retrieving revision 1.34 retrieving revision 1.35 diff -u -r1.34 -r1.35 --- .classpath 28 Jul 2004 19:19:35 -0000 1.34 +++ .classpath 1 Aug 2004 17:40:36 -0000 1.35 @@ -25,8 +25,8 @@ - + 1.34 +3 -0 jakarta-hivemind/status.xml Index: status.xml =================================================================== RCS file: /home/cvs/jakarta-hivemind/status.xml,v retrieving revision 1.33 retrieving revision 1.34 diff -u -r1.33 -r1.34 --- status.xml 29 Jul 2004 13:18:26 -0000 1.33 +++ status.xml 1 Aug 2004 17:40:36 -0000 1.34 @@ -89,6 +89,9 @@ Typo in jar-module.xml causes broken build if junit library is missing + + Made a number of changes to ensure HiveMind compatibility with JDK 1.3. + 1.4 +3 -2 jakarta-hivemind/framework/src/test/org/apache/hivemind/methodmatch/TestMethodMatcher.java Index: TestMethodMatcher.java =================================================================== RCS file: /home/cvs/jakarta-hivemind/framework/src/test/org/apache/hivemind/methodmatch/TestMethodMatcher.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- TestMethodMatcher.java 29 Jul 2004 13:18:52 -0000 1.3 +++ TestMethodMatcher.java 1 Aug 2004 17:40:36 -0000 1.4 @@ -75,7 +75,7 @@ } } - public void testParseExceptionWithLocation() + public void testParseExceptionWithLocation() throws Exception { Resource r = getResource("MethodSubject.class"); Location l = new LocationImpl(r, 3); @@ -95,7 +95,8 @@ String message = ex.getMessage(); boolean matchesPattern = - message.matches( + matches( + message, "Exception at .*?, line 3: Method pattern '\\*\\(' contains an invalid parameters pattern\\."); assertEquals(true, matchesPattern); 1.3 +3 -1 jakarta-hivemind/framework/src/test/org/apache/hivemind/methodmatch/AbstractMethodTestCase.java Index: AbstractMethodTestCase.java =================================================================== RCS file: /home/cvs/jakarta-hivemind/framework/src/test/org/apache/hivemind/methodmatch/AbstractMethodTestCase.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- AbstractMethodTestCase.java 17 Jun 2004 15:16:13 -0000 1.2 +++ AbstractMethodTestCase.java 1 Aug 2004 17:40:36 -0000 1.3 @@ -16,6 +16,8 @@ import java.lang.reflect.Method; +import junit.framework.AssertionFailedError; + import org.apache.hivemind.service.MethodSignature; import org.apache.hivemind.test.HiveMindTestCase; @@ -36,7 +38,7 @@ return new MethodSignature(methods[i]); } - throw new AssertionError( + throw new AssertionFailedError( "Class " + target.getName() + " does not contain a method named: '" + name + "'."); } 1.10 +50 -29 jakarta-hivemind/framework/src/test/hivemind/test/ant/TestConstructRegistry.java Index: TestConstructRegistry.java =================================================================== RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/ant/TestConstructRegistry.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- TestConstructRegistry.java 25 Jun 2004 20:19:58 -0000 1.9 +++ TestConstructRegistry.java 1 Aug 2004 17:40:36 -0000 1.10 @@ -37,11 +37,17 @@ *

An earlier version of this suite built using the real hivemodule.xml (in src/META-INF) * but that caused issues because it was constantly changing, so we * use a copy (src/test-data/TestConstructRegistry/master.sdl). + * + *

+ * These tests are *VERY* dependent on JDK version (really, on the version of the + * XML parser provided with the JDK). Therefore, we skip the tests for JDK 1.3. * * @author Howard Lewis Ship */ public class TestConstructRegistry extends FrameworkTestCase { + private static final boolean JDK1_3 = System.getProperty("java.version").startsWith("1.3."); + protected Project _project = new Project(); protected ConstructRegistry create() @@ -91,11 +97,14 @@ assertExceptionSubstring(ex, "You must specify a set of module descriptors"); } - f.delete(); + f.delete(); } public void testBasic() throws Exception { + if (JDK1_3) + return; + ConstructRegistry cr = create(); Path p = cr.createDescriptors(); @@ -116,38 +125,44 @@ cr.execute(); compare(output, getFrameworkPath("src/test-data/TestConstructRegistry/testBasic.xml")); - - output.delete(); + + output.delete(); } - public void testSDL() throws Exception - { - ConstructRegistry cr = create(); + public void testSDL() throws Exception + { + if (JDK1_3) + return; - Path p = cr.createDescriptors(); + ConstructRegistry cr = create(); - p.createPath().setLocation( - new File(getFrameworkPath("src/test-data/TestConstructRegistry/master.sdl"))); - p.createPath().setLocation( - new File(getFrameworkPath("src/test-data/TestConstructRegistry/Symbols.sdl"))); + Path p = cr.createDescriptors(); - File output = File.createTempFile("testSDL-", ".xml"); + p.createPath().setLocation( + new File(getFrameworkPath("src/test-data/TestConstructRegistry/master.sdl"))); + p.createPath().setLocation( + new File(getFrameworkPath("src/test-data/TestConstructRegistry/Symbols.sdl"))); - // Delete the file, to force the task to re-create it. + File output = File.createTempFile("testSDL-", ".xml"); - output.delete(); + // Delete the file, to force the task to re-create it. - cr.setOutput(output); + output.delete(); + + cr.setOutput(output); - cr.execute(); + cr.execute(); - compare(output, getFrameworkPath("src/test-data/TestConstructRegistry/testSDL.xml")); + compare(output, getFrameworkPath("src/test-data/TestConstructRegistry/testSDL.xml")); - output.delete(); - } + output.delete(); + } public void testLocalRefs() throws Exception { + if (JDK1_3) + return; + ConstructRegistry cr = create(); Path p = cr.createDescriptors(); @@ -166,12 +181,15 @@ cr.execute(); compare(output, getFrameworkPath("src/test-data/TestConstructRegistry/testLocalRefs.xml")); - - output.delete(); + + output.delete(); } public void testUptoDate() throws Exception { + if (JDK1_3) + return; + ConstructRegistry cr = create(); Path p = cr.createDescriptors(); @@ -190,20 +208,23 @@ cr.setOutput(output); cr.execute(); - + compare(output, getFrameworkPath("src/test-data/TestConstructRegistry/testUptoDate.xml")); - - long stamp = output.lastModified(); - + + long stamp = output.lastModified(); + cr.execute(); assertEquals(stamp, output.lastModified()); - - output.delete(); + + output.delete(); } public void testJars() throws Exception { + if (JDK1_3) + return; + ConstructRegistry cr = create(); Path p = cr.createDescriptors(); @@ -224,8 +245,8 @@ cr.execute(); compare(output, getFrameworkPath("src/test-data/TestConstructRegistry/testJars.xml")); - - output.delete(); + + output.delete(); } protected void compare(File actual, String expectedPath) throws Exception 1.3 +7 -1 jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/InstanceTranslator.java Index: InstanceTranslator.java =================================================================== RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/InstanceTranslator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- InstanceTranslator.java 18 Jul 2004 14:43:11 -0000 1.2 +++ InstanceTranslator.java 1 Aug 2004 17:40:36 -0000 1.3 @@ -47,7 +47,13 @@ } catch (Exception ex) { - throw new ApplicationRuntimeException(ex.getMessage(), location, ex); + // JDK 1.4 produces a good message here, but JDK 1.3 does not, so we + // create our own. + + throw new ApplicationRuntimeException( + RulesMessages.unableToInstantiateInstanceOfClass(objectClass, ex), + location, + ex); } } 1.6 +5 -0 jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/RulesMessages.java Index: RulesMessages.java =================================================================== RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/RulesMessages.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- RulesMessages.java 18 Jun 2004 13:50:03 -0000 1.5 +++ RulesMessages.java 1 Aug 2004 17:40:36 -0000 1.6 @@ -178,4 +178,9 @@ propertyType.getName(), cause); } + + public static String unableToInstantiateInstanceOfClass(Class clazz, Throwable cause) + { + return _formatter.format("unable-to-instantiate-instance-of-class", clazz.getName(), cause); + } } 1.3 +3 -1 jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/RulesStrings.properties Index: RulesStrings.properties =================================================================== RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/schema/rules/RulesStrings.properties,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- RulesStrings.properties 15 Jun 2004 20:35:56 -0000 1.2 +++ RulesStrings.properties 1 Aug 2004 17:40:36 -0000 1.3 @@ -40,4 +40,6 @@ resource-localization-error=Unable to localize resource {0} for module {1}. invalid-initializer=Initializer string (''{0}'') is not in proper format (key=value[,key=value]*). no-property-editor=No property editor for {0}. -smart-translator-error=Unable to translate ''{0}'' to type {1}: {2} \ No newline at end of file +smart-translator-error=Unable to translate ''{0}'' to type {1}: {2} + +unable-to-instantiate-instance-of-class=Unable to instantiate instance of class {0}: {1} 1.10 +10 -1 jakarta-hivemind/library/build.xml Index: build.xml =================================================================== RCS file: /home/cvs/jakarta-hivemind/library/build.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- build.xml 11 Jul 2004 17:23:52 -0000 1.9 +++ build.xml 1 Aug 2004 17:40:36 -0000 1.10 @@ -25,7 +25,16 @@ - + + + + + + + + 1.9 +9 -0 jakarta-hivemind/framework/src/java/org/apache/hivemind/test/HiveMindTestCase.java Index: HiveMindTestCase.java =================================================================== RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/test/HiveMindTestCase.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- HiveMindTestCase.java 16 Jul 2004 23:15:40 -0000 1.8 +++ HiveMindTestCase.java 1 Aug 2004 17:40:36 -0000 1.9 @@ -443,4 +443,13 @@ return new LocationImpl(r, line); } + + protected boolean matches(String input, String pattern) throws Exception + { + setupMatcher(); + + Pattern compiled = _compiler.compile(pattern); + + return _matcher.matches(input, compiled); + } } 1.15 +1 -2 jakarta-hivemind/framework/src/test/hivemind/test/rules/TestObjectTranslator.java Index: TestObjectTranslator.java =================================================================== RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/rules/TestObjectTranslator.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- TestObjectTranslator.java 18 Jul 2004 14:43:11 -0000 1.14 +++ TestObjectTranslator.java 1 Aug 2004 17:40:36 -0000 1.15 @@ -97,8 +97,7 @@ { assertExceptionSubstring( ex, - "Class org.apache.hivemind.schema.rules.InstanceTranslator can not access a member " - + "of class hivemind.test.rules.PrivateObject"); + "Unable to instantiate instance of class hivemind.test.rules.PrivateObject"); } verifyControls(); 1.3 +5 -7 jakarta-hivemind/src/documentation/content/xdocs/dependencies.xml Index: dependencies.xml =================================================================== RCS file: /home/cvs/jakarta-hivemind/src/documentation/content/xdocs/dependencies.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- dependencies.xml 11 Jul 2004 17:23:52 -0000 1.2 +++ dependencies.xml 1 Aug 2004 17:40:37 -0000 1.3 @@ -50,17 +50,15 @@ EasyMock testing framework - Only needed by &api.HiveMindTestCase;, which exists as the basis of - your own tests. + Only needed by &api.HiveMindTestCase;, which exists as the basis of your own tests. - geronimo-spec-ejb-1.0-M1.jar + jboss-j2ee-3.2.1.jar - Geronimo J2EE Server + JBoss J2EE Server - Used by some services of the HiveMind library. No dependencies on - Geronimo itself, just on the javax.naming and - javax.ejb packages. + Used by some services of the HiveMind library. No dependencies on JBoss itself, just on the + javax.ejb package. javassist-2.6.jar 1.4 +6 -1 jakarta-hivemind/framework/src/test/hivemind/test/services/EventProducer.java Index: EventProducer.java =================================================================== RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/services/EventProducer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- EventProducer.java 25 Jun 2004 20:19:57 -0000 1.3 +++ EventProducer.java 1 Aug 2004 17:40:37 -0000 1.4 @@ -26,15 +26,20 @@ public class EventProducer { private PropertyChangeSupport _support = new PropertyChangeSupport(this); + private int _count = 0; public void addPropertyChangeListener(PropertyChangeListener listener) { _support.addPropertyChangeListener(listener); + + _count++; } public void removePropertyChangeListener(PropertyChangeListener listener) { _support.removePropertyChangeListener(listener); + + _count--; } public void fire(PropertyChangeEvent event) @@ -44,7 +49,7 @@ public int getListenerCount() { - return _support.getPropertyChangeListeners().length; + return _count; } public String toString() 1.3 +1 -1 jakarta-hivemind/framework/src/test/hivemind/test/services/TestMethodSignature.java Index: TestMethodSignature.java =================================================================== RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/services/TestMethodSignature.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- TestMethodSignature.java 12 Jun 2004 18:43:41 -0000 1.2 +++ TestMethodSignature.java 1 Aug 2004 17:40:37 -0000 1.3 @@ -36,7 +36,7 @@ { Method m = methods[i]; - if (m.getName() == methodName) + if (m.getName().equals(methodName)) return new MethodSignature(m); } 1.1 jakarta-hivemind/framework/src/test-data/TestRegistryBuilder.jar <> 1.14 +4 -1 jakarta-hivemind/framework/src/test/hivemind/test/TestRegistryBuilder.java Index: TestRegistryBuilder.java =================================================================== RCS file: /home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/TestRegistryBuilder.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- TestRegistryBuilder.java 29 Jul 2004 13:18:51 -0000 1.13 +++ TestRegistryBuilder.java 1 Aug 2004 17:40:37 -0000 1.14 @@ -43,7 +43,10 @@ public void testLookup() throws Exception { - File f = new File(getFrameworkPath("src/test-data/TestRegistryBuilder")); + // JDK 1.3 URLClassLoader doesn't seem to work properly for directories, so + // the contents of the TestRegistryBuilder folder are packaged inside this JAR. + + File f = new File(getFrameworkPath("src/test-data/TestRegistryBuilder.jar")); URL[] urls = new URL[] { f.toURL()}; 1.3 +1 -1 jakarta-hivemind/library/src/java/org/apache/hivemind/lib/pipeline/FilterMethodAnalyzer.java Index: FilterMethodAnalyzer.java =================================================================== RCS file: /home/cvs/jakarta-hivemind/library/src/java/org/apache/hivemind/lib/pipeline/FilterMethodAnalyzer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- FilterMethodAnalyzer.java 12 Jun 2004 18:43:41 -0000 1.2 +++ FilterMethodAnalyzer.java 1 Aug 2004 17:40:37 -0000 1.3 @@ -37,7 +37,7 @@ if (ms.getReturnType() != fms.getReturnType()) return -1; - if (ms.getName() != fms.getName()) + if (!ms.getName().equals(fms.getName())) return -1; Class[] filterParameters = fms.getParameterTypes(); --------------------------------------------------------------------- To unsubscribe, e-mail: hivemind-cvs-unsubscribe@jakarta.apache.org For additional commands, e-mail: hivemind-cvs-help@jakarta.apache.org