hlship 2004/11/04 06:32:33
Modified: framework/src/java/org/apache/hivemind/impl
ErrorLogImpl.java JavaTypeUtils.java
ServiceImplementationFactoryParametersImpl.java
framework/src/test/hivemind/test/services
AutowireTarget.java
framework/src/java/org/apache/hivemind/parse
BaseAnnotationHolder.java AnnotationHolder.java
framework/src/test/org/apache/hivemind/service/impl
TestClassFab.java
framework/src/test/org/apache/hivemind TestDefense.java
TestApplicationRuntimeException.java
framework/src/java/org/apache/hivemind
ServiceImplementationFactoryParameters.java
ErrorLog.java Defense.java
framework/src/java/org/apache/hivemind/service/impl
BuilderErrorLogFacet.java MethodFabImpl.java
framework/src/java/org/apache/hivemind/ant
RegistrySerializer.java
framework/src/test/org/apache/hivemind/impl
TestJavaTypeUtils.java
Added: framework/src/test/org/apache/hivemind/service/impl
Nasty.java
Log:
Add tests to validate behavior of ClassFabImpl.toString().
Revision Changes Path
1.2 +14 -0
jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ErrorLogImpl.java
Index: ErrorLogImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ErrorLogImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ErrorLogImpl.java 2 Nov 2004 17:46:09 -0000 1.1
+++ ErrorLogImpl.java 4 Nov 2004 14:32:32 -0000 1.2
@@ -1,3 +1,17 @@
+// Copyright 2004 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package org.apache.hivemind.impl;
import org.apache.commons.logging.Log;
1.2 +1 -1
jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/JavaTypeUtils.java
Index: JavaTypeUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/JavaTypeUtils.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JavaTypeUtils.java 1 Nov 2004 01:55:47 -0000 1.1
+++ JavaTypeUtils.java 4 Nov 2004 14:32:32 -0000 1.2
@@ -1,4 +1,4 @@
-// Copyright 2004 The Apache Software Foundation
+// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
1.2 +14 -0
jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ServiceImplementationFactoryParametersImpl.java
Index: ServiceImplementationFactoryParametersImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/impl/ServiceImplementationFactoryParametersImpl.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ServiceImplementationFactoryParametersImpl.java 2 Nov 2004 17:46:09
-0000 1.1
+++ ServiceImplementationFactoryParametersImpl.java 4 Nov 2004 14:32:32
-0000 1.2
@@ -1,3 +1,17 @@
+// Copyright 2004 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package org.apache.hivemind.impl;
import java.util.List;
1.4 +1 -1
jakarta-hivemind/framework/src/test/hivemind/test/services/AutowireTarget.java
Index: AutowireTarget.java
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/services/AutowireTarget.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AutowireTarget.java 2 Nov 2004 17:46:10 -0000 1.3
+++ AutowireTarget.java 4 Nov 2004 14:32:32 -0000 1.4
@@ -1,4 +1,4 @@
-// Copyright 2004 The Apache Software Foundation
+// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
1.2 +1 -1
jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/BaseAnnotationHolder.java
Index: BaseAnnotationHolder.java
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/BaseAnnotationHolder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BaseAnnotationHolder.java 14 Oct 2004 14:31:30 -0000 1.1
+++ BaseAnnotationHolder.java 4 Nov 2004 14:32:32 -0000 1.2
@@ -1,4 +1,4 @@
-//Copyright 2004 The Apache Software Foundation
+// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
1.2 +1 -1
jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/AnnotationHolder.java
Index: AnnotationHolder.java
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/parse/AnnotationHolder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AnnotationHolder.java 14 Oct 2004 14:31:31 -0000 1.1
+++ AnnotationHolder.java 4 Nov 2004 14:32:32 -0000 1.2
@@ -1,4 +1,4 @@
-//Copyright 2004 The Apache Software Foundation
+// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
1.4 +61 -0
jakarta-hivemind/framework/src/test/org/apache/hivemind/service/impl/TestClassFab.java
Index: TestClassFab.java
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/framework/src/test/org/apache/hivemind/service/impl/TestClassFab.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- TestClassFab.java 2 Nov 2004 22:32:16 -0000 1.3
+++ TestClassFab.java 4 Nov 2004 14:32:32 -0000 1.4
@@ -19,13 +19,18 @@
import hivemind.test.services.SimpleService;
import java.io.IOException;
+import java.io.Serializable;
import java.lang.reflect.Constructor;
import java.lang.reflect.Modifier;
import java.util.List;
+import java.util.Map;
+import java.util.zip.DataFormatException;
import javassist.CtClass;
+import junit.framework.AssertionFailedError;
import org.apache.hivemind.ApplicationRuntimeException;
+import org.apache.hivemind.impl.BaseLocatable;
import org.apache.hivemind.service.ClassFab;
import org.apache.hivemind.service.MethodFab;
import org.apache.hivemind.service.MethodSignature;
@@ -386,4 +391,60 @@
// fail.
}
+ /** @since 1.1 */
+ public void testToString() throws Exception
+ {
+ ClassFab cf = newClassFab("FredRunnable", BaseLocatable.class);
+
+ cf.addInterface(Runnable.class);
+ cf.addInterface(Serializable.class);
+
+ cf.addField("_map", Map.class);
+
+ cf.addConstructor(new Class[]
+ { Map.class, Runnable.class }, new Class[]
+ { IllegalArgumentException.class, DataFormatException.class }, "{
_map = $1; }");
+
+ MethodSignature sig = new MethodSignature(Map.class, "doTheNasty",
new Class[]
+ { int.class, String.class }, new Class[]
+ { InstantiationException.class, IllegalAccessException.class });
+
+ MethodFab mf = cf.addMethod(
+ Modifier.PUBLIC + Modifier.FINAL + Modifier.SYNCHRONIZED,
+ sig,
+ "{ return _map; }");
+
+ mf.addCatch(NullPointerException.class, "return null;");
+ mf.extend("_map.clear();", true);
+
+ String toString = cf.toString();
+
+ contains(
+ toString,
+ "public class FredRunnable extends
org.apache.hivemind.impl.BaseLocatable\n"
+ + " implements java.lang.Runnable,
java.io.Serializable");
+
+ contains(toString, "private java.util.Map _map;");
+
+ contains(
+ toString,
+ "public FredRunnable(java.util.Map $1, java.lang.Runnable
$2)\n"
+ + " throws java.lang.IllegalArgumentException,
java.util.zip.DataFormatException\n"
+ + "{ _map = $1; }");
+
+ contains(
+ toString,
+ "public final synchronized java.util.Map doTheNasty(int $1,
java.lang.String $2)\n"
+ + " throws java.lang.InstantiationException,
java.lang.IllegalAccessException\n"
+ + "{ return _map; }\n" +
"catch(java.lang.NullPointerException $e)\n"
+ + "return null;\n" + "finally\n" + "_map.clear();");
+
+ }
+
+ /** @since 1.1 */
+ private void contains(String actual, String expected)
+ {
+ if (actual.indexOf(expected) < 0)
+ throw new AssertionFailedError("Missing substring: " + expected);
+ }
}
1.1
jakarta-hivemind/framework/src/test/org/apache/hivemind/service/impl/Nasty.java
Index: Nasty.java
===================================================================
// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package org.apache.hivemind.service.impl;
import java.util.Map;
/**
* Used just for testing [EMAIL PROTECTED]
org.apache.hivemind.service.impl.ClassFabImpl#toString()}.
*
* @author Howard M. Lewis Ship
* @since 1.1
*/
public interface Nasty
{
public Map doTheNasty(int count, String name) throws
InstantiationException,
IllegalAccessException;
}
1.2 +1 -1
jakarta-hivemind/framework/src/test/org/apache/hivemind/TestDefense.java
Index: TestDefense.java
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/framework/src/test/org/apache/hivemind/TestDefense.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestDefense.java 2 Nov 2004 17:46:11 -0000 1.1
+++ TestDefense.java 4 Nov 2004 14:32:33 -0000 1.2
@@ -1,4 +1,4 @@
-// Copyright 2004 The Apache Software Foundation
+// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
1.2 +1 -1
jakarta-hivemind/framework/src/test/org/apache/hivemind/TestApplicationRuntimeException.java
Index: TestApplicationRuntimeException.java
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/framework/src/test/org/apache/hivemind/TestApplicationRuntimeException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestApplicationRuntimeException.java 1 Nov 2004 16:38:03 -0000
1.1
+++ TestApplicationRuntimeException.java 4 Nov 2004 14:32:33 -0000
1.2
@@ -1,4 +1,4 @@
-//Copyright 2004 The Apache Software Foundation
+// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
1.2 +14 -0
jakarta-hivemind/framework/src/java/org/apache/hivemind/ServiceImplementationFactoryParameters.java
Index: ServiceImplementationFactoryParameters.java
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/ServiceImplementationFactoryParameters.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ServiceImplementationFactoryParameters.java 2 Nov 2004 17:46:09
-0000 1.1
+++ ServiceImplementationFactoryParameters.java 4 Nov 2004 14:32:33
-0000 1.2
@@ -1,3 +1,17 @@
+// Copyright 2004 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package org.apache.hivemind;
import java.util.List;
1.2 +14 -0
jakarta-hivemind/framework/src/java/org/apache/hivemind/ErrorLog.java
Index: ErrorLog.java
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/ErrorLog.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ErrorLog.java 2 Nov 2004 17:46:09 -0000 1.1
+++ ErrorLog.java 4 Nov 2004 14:32:33 -0000 1.2
@@ -1,3 +1,17 @@
+// Copyright 2004 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package org.apache.hivemind;
/**
1.2 +1 -1
jakarta-hivemind/framework/src/java/org/apache/hivemind/Defense.java
Index: Defense.java
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/Defense.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Defense.java 2 Nov 2004 17:46:09 -0000 1.1
+++ Defense.java 4 Nov 2004 14:32:33 -0000 1.2
@@ -1,4 +1,4 @@
-// Copyright 2004 The Apache Software Foundation
+// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
1.2 +14 -0
jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/BuilderErrorLogFacet.java
Index: BuilderErrorLogFacet.java
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/BuilderErrorLogFacet.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BuilderErrorLogFacet.java 2 Nov 2004 17:46:09 -0000 1.1
+++ BuilderErrorLogFacet.java 4 Nov 2004 14:32:33 -0000 1.2
@@ -1,3 +1,17 @@
+// Copyright 2004 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package org.apache.hivemind.service.impl;
import org.apache.hivemind.ErrorHandler;
1.6 +1 -1
jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/MethodFabImpl.java
Index: MethodFabImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/MethodFabImpl.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- MethodFabImpl.java 4 Nov 2004 03:19:20 -0000 1.5
+++ MethodFabImpl.java 4 Nov 2004 14:32:33 -0000 1.6
@@ -87,7 +87,7 @@
for (int i = 0; i < exceptions.length; i++)
{
if (i == 0)
- buffer.append("\n throws ");
+ buffer.append("\n throws ");
else
buffer.append(", ");
1.3 +1 -1
jakarta-hivemind/framework/src/java/org/apache/hivemind/ant/RegistrySerializer.java
Index: RegistrySerializer.java
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/ant/RegistrySerializer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- RegistrySerializer.java 14 Oct 2004 15:37:18 -0000 1.2
+++ RegistrySerializer.java 4 Nov 2004 14:32:33 -0000 1.3
@@ -1,4 +1,4 @@
-// Copyright 2004 The Apache Software Foundation
+// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
1.2 +1 -1
jakarta-hivemind/framework/src/test/org/apache/hivemind/impl/TestJavaTypeUtils.java
Index: TestJavaTypeUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/framework/src/test/org/apache/hivemind/impl/TestJavaTypeUtils.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestJavaTypeUtils.java 1 Nov 2004 01:55:47 -0000 1.1
+++ TestJavaTypeUtils.java 4 Nov 2004 14:32:33 -0000 1.2
@@ -1,4 +1,4 @@
-// Copyright 2004 The Apache Software Foundation
+// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]