You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2007/05/01 07:09:48 UTC
svn commit: r533944 [3/4] - in /incubator/tuscany/java/sca/modules:
core-spring/src/main/java/org/apache/tuscany/implementation/java/bean/impl/
core/src/main/java/org/apache/tuscany/core/builder/
databinding-sdo/src/main/java/org/apache/tuscany/databin...
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ConstructorResourceTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ConstructorResourceTestCase.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ConstructorResourceTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ConstructorResourceTestCase.java Mon Apr 30 22:09:44 2007
@@ -22,28 +22,28 @@
import java.util.List;
import org.apache.tuscany.api.annotation.Resource;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
-import org.apache.tuscany.implementation.java.introspect.impl.DuplicateResourceException;
-import org.apache.tuscany.implementation.java.introspect.impl.InvalidConstructorException;
-import org.apache.tuscany.implementation.java.introspect.impl.InvalidResourceException;
+import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.DefaultJavaImplementationFactory;
/**
* @version $Rev$ $Date$
*/
public class ConstructorResourceTestCase extends AbstractProcessorTest {
+
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory(new DefaultAssemblyFactory());
public void testResource() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<Foo> ctor = Foo.class.getConstructor(String.class);
visitConstructor(ctor, type);
- org.apache.tuscany.implementation.java.impl.Resource resource = type.getResources().get("myResource");
+ org.apache.tuscany.implementation.java.impl.JavaResourceImpl resource = type.getResources().get("myResource");
assertFalse(resource.isOptional());
}
public void testTwoResourcesSameType() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
visitConstructor(ctor, type);
assertNotNull(type.getResources().get("myResource1"));
@@ -51,8 +51,7 @@
}
public void testDuplicateResource() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<BadFoo> ctor = BadFoo.class.getConstructor(String.class, String.class);
try {
visitConstructor(ctor, type);
@@ -63,8 +62,7 @@
}
public void testNoName() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<ConstructorResourceTestCase.BadFoo> ctor =
ConstructorResourceTestCase.BadFoo.class.getConstructor(String.class);
try {
@@ -76,16 +74,14 @@
}
public void testNamesOnConstructor() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<Foo> ctor = Foo.class.getConstructor(Integer.class);
visitConstructor(ctor, type);
assertNotNull(type.getResources().get("myResource"));
}
public void testInvalidNumberOfNames() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<ConstructorResourceTestCase.BadFoo> ctor =
ConstructorResourceTestCase.BadFoo.class.getConstructor(Integer.class, Integer.class);
try {
@@ -97,8 +93,7 @@
}
public void testNoMatchingNames() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<ConstructorResourceTestCase.BadFoo> ctor =
ConstructorResourceTestCase.BadFoo.class.getConstructor(List.class, List.class);
try {
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ContextProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ContextProcessorTestCase.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ContextProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ContextProcessorTestCase.java Mon Apr 30 22:09:44 2007
@@ -25,10 +25,9 @@
import org.apache.tuscany.assembly.Component;
import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
-import org.apache.tuscany.implementation.java.introspect.impl.ContextProcessor;
-import org.apache.tuscany.implementation.java.introspect.impl.IllegalContextException;
-import org.apache.tuscany.implementation.java.introspect.impl.UnknownContextTypeException;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.DefaultJavaImplementationFactory;
import org.easymock.EasyMock;
import org.osoa.sca.ComponentContext;
import org.osoa.sca.RequestContext;
@@ -40,6 +39,7 @@
public class ContextProcessorTestCase extends TestCase {
private ContextProcessor processor;
private Component composite;
+ private JavaImplementationFactory javaImplementationFactory;
// FIXME: resurrect to test ComponentContext injection
/*
@@ -65,24 +65,21 @@
public void testRequestContextMethod() throws Exception {
Method method = Foo.class.getMethod("setRequestContext", RequestContext.class);
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
processor.visitMethod(method, type);
assertNotNull(type.getResources().get("requestContext"));
}
public void testRequestContextField() throws Exception {
Field field = Foo.class.getDeclaredField("requestContext");
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
processor.visitField(field, type);
assertNotNull(type.getResources().get("requestContext"));
}
public void testInvalidParamType() throws Exception {
Method method = Foo.class.getMethod("setContext", String.class);
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
try {
processor.visitMethod(method, type);
fail();
@@ -93,8 +90,7 @@
public void testInvalidParamTypeField() throws Exception {
Field field = Foo.class.getDeclaredField("badContext");
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
try {
processor.visitField(field, type);
fail();
@@ -106,8 +102,7 @@
public void testInvalidParamNum() throws Exception {
Method method = Foo.class.getMethod("setContext", ComponentContext.class, String.class);
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
try {
processor.visitMethod(method, type);
fail();
@@ -118,8 +113,7 @@
public void testInvalidNoParams() throws Exception {
Method method = Foo.class.getMethod("setContext");
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
try {
processor.visitMethod(method, type);
fail();
@@ -130,22 +124,21 @@
public void testNoContext() throws Exception {
Method method = Foo.class.getMethod("noContext", ComponentContext.class);
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
processor.visitMethod(method, type);
assertEquals(0, type.getResources().size());
}
public void testNoContextField() throws Exception {
Field field = Foo.class.getDeclaredField("noContext");
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
processor.visitField(field, type);
assertEquals(0, type.getResources().size());
}
protected void setUp() throws Exception {
super.setUp();
+ javaImplementationFactory = new DefaultJavaImplementationFactory(new DefaultAssemblyFactory());
processor = new ContextProcessor(new DefaultAssemblyFactory());
// processor.setWorkContext(EasyMock.createNiceMock(WorkContext.class));
composite = EasyMock.createNiceMock(Component.class);
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ConversationProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ConversationProcessorTestCase.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ConversationProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ConversationProcessorTestCase.java Mon Apr 30 22:09:44 2007
@@ -24,7 +24,9 @@
import junit.framework.TestCase;
import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.DefaultJavaImplementationFactory;
import org.osoa.sca.annotations.ConversationAttributes;
import org.osoa.sca.annotations.ConversationID;
import org.osoa.sca.annotations.Scope;
@@ -34,26 +36,24 @@
*/
public class ConversationProcessorTestCase extends TestCase {
private ConversationProcessor processor = new ConversationProcessor(new DefaultAssemblyFactory());
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory(new DefaultAssemblyFactory());
public void testMaxIdleTime() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
processor.visitClass(FooMaxIdle.class, type);
assertEquals(10000L, type.getMaxIdleTime());
assertEquals(-1, type.getMaxAge());
}
public void testMaxAge() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
processor.visitClass(FooMaxAge.class, type);
assertEquals(10000L, type.getMaxAge());
assertEquals(-1, type.getMaxIdleTime());
}
public void testBadFooBoth() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
try {
processor.visitClass(BadFooBoth.class, type);
fail();
@@ -63,15 +63,13 @@
}
public void testImplicitScope() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
processor.visitClass(ImplicitFooScope.class, type);
- assertEquals(org.apache.tuscany.implementation.java.impl.Scope.CONVERSATION, type.getScope());
+ assertEquals(org.apache.tuscany.implementation.java.impl.JavaScopeImpl.CONVERSATION, type.getJavaScope());
}
public void testBadFooScope() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
try {
processor.visitClass(BadFooScope.class, type);
fail();
@@ -82,17 +80,15 @@
public void testJustConversation() throws Exception {
// TODO do we want these semantics
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
processor.visitClass(FooJustConversation.class, type);
- assertEquals(org.apache.tuscany.implementation.java.impl.Scope.CONVERSATION, type.getScope());
+ assertEquals(org.apache.tuscany.implementation.java.impl.JavaScopeImpl.CONVERSATION, type.getJavaScope());
assertEquals(-1, type.getMaxAge());
assertEquals(-1, type.getMaxIdleTime());
}
public void testSetConversationIDField() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Field field = FooWithConversationIDField.class.getDeclaredField("conversationID");
processor.visitField(field, type);
assertNotNull(type.getConversationIDMember());
@@ -100,8 +96,7 @@
}
public void testSetConversationIDMethod() throws Exception {
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Method method = FooWithConversationIDMethod.class.getDeclaredMethods()[0];
processor.visitMethod(method, type);
assertNotNull(type.getConversationIDMember());
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/DestroyProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/DestroyProcessorTestCase.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/DestroyProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/DestroyProcessorTestCase.java Mon Apr 30 22:09:44 2007
@@ -24,10 +24,9 @@
import org.apache.tuscany.assembly.AssemblyFactory;
import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
-import org.apache.tuscany.implementation.java.introspect.impl.DestroyProcessor;
-import org.apache.tuscany.implementation.java.introspect.impl.DuplicateDestructorException;
-import org.apache.tuscany.implementation.java.introspect.impl.IllegalDestructorException;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.DefaultJavaImplementationFactory;
import org.osoa.sca.annotations.Destroy;
/**
@@ -36,11 +35,11 @@
public class DestroyProcessorTestCase extends TestCase {
private AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory(new DefaultAssemblyFactory());
public void testDestroy() throws Exception {
DestroyProcessor processor = new DestroyProcessor(assemblyFactory);
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Method method = Foo.class.getMethod("destroy");
processor.visitMethod(method, type);
assertNotNull(type.getDestroyMethod());
@@ -48,8 +47,7 @@
public void testBadDestroy() throws Exception {
DestroyProcessor processor = new DestroyProcessor(assemblyFactory);
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Method method = Bar.class.getMethod("badDestroy", String.class);
try {
processor.visitMethod(method, type);
@@ -61,8 +59,7 @@
public void testTwoDestroy() throws Exception {
DestroyProcessor processor = new DestroyProcessor(assemblyFactory);
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Method method = Bar.class.getMethod("destroy");
Method method2 = Bar.class.getMethod("destroy2");
processor.visitMethod(method, type);
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/EagerInitProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/EagerInitProcessorTestCase.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/EagerInitProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/EagerInitProcessorTestCase.java Mon Apr 30 22:09:44 2007
@@ -22,9 +22,10 @@
import org.apache.tuscany.assembly.AssemblyFactory;
import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.DefaultJavaImplementationFactory;
import org.apache.tuscany.implementation.java.introspect.IntrospectionException;
-import org.apache.tuscany.implementation.java.introspect.impl.EagerInitProcessor;
import org.osoa.sca.annotations.EagerInit;
/**
@@ -33,18 +34,17 @@
public class EagerInitProcessorTestCase extends TestCase {
private AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
-
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory(new DefaultAssemblyFactory());
+
public void testNoLevel() throws IntrospectionException {
EagerInitProcessor processor = new EagerInitProcessor(assemblyFactory);
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
processor.visitClass(Level.class, type);
}
public void testSubclass() throws IntrospectionException {
EagerInitProcessor processor = new EagerInitProcessor(assemblyFactory);
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
processor.visitClass(SubClass.class, type);
}
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/HeuristicAndPropertyTestCase.java Mon Apr 30 22:09:44 2007
@@ -24,8 +24,10 @@
import org.apache.tuscany.assembly.AssemblyFactory;
import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.ConstructorDefinition;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.DefaultJavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.JavaConstructorImpl;
import org.apache.tuscany.interfacedef.java.impl.DefaultJavaFactory;
import org.apache.tuscany.interfacedef.java.introspect.DefaultJavaInterfaceIntrospector;
import org.osoa.sca.annotations.Property;
@@ -38,17 +40,17 @@
private PropertyProcessor propertyProcessor;
private HeuristicPojoProcessor heuristicProcessor;
private AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
-
+ private JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory(new DefaultAssemblyFactory());
/**
* Verifies the property and heuristic processors don't collide
*/
@SuppressWarnings("unchecked")
public void testPropertyProcessorWithHeuristicProcessor() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor ctor = Foo.class.getConstructor(String.class);
- type.setConstructorDefinition(new ConstructorDefinition(ctor));
- propertyProcessor.visitConstructorParameter(type.getConstructorDefinition().getParameters()[0], type);
+ type.setConstructor(new JavaConstructorImpl(ctor));
+ propertyProcessor.visitConstructorParameter(type.getConstructor().getParameters()[0], type);
heuristicProcessor.visitEnd(Foo.class, type);
assertEquals(1, type.getProperties().size());
assertEquals("foo", type.getProperties().get(0).getName());
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/HeuristicConstructorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/HeuristicConstructorTestCase.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/HeuristicConstructorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/HeuristicConstructorTestCase.java Mon Apr 30 22:09:44 2007
@@ -24,12 +24,11 @@
import org.apache.tuscany.assembly.AssemblyFactory;
import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.JavaElement;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.DefaultJavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.JavaElementImpl;
import org.apache.tuscany.implementation.java.introspect.IntrospectionException;
-import org.apache.tuscany.implementation.java.introspect.impl.AmbiguousConstructorException;
-import org.apache.tuscany.implementation.java.introspect.impl.HeuristicPojoProcessor;
-import org.apache.tuscany.implementation.java.introspect.impl.NoConstructorException;
import org.apache.tuscany.interfacedef.java.JavaFactory;
import org.apache.tuscany.interfacedef.java.impl.DefaultJavaFactory;
import org.apache.tuscany.interfacedef.java.introspect.DefaultJavaInterfaceIntrospector;
@@ -45,15 +44,17 @@
private AssemblyFactory factory;
private JavaFactory javaFactory;
private HeuristicPojoProcessor processor;
+ private JavaImplementationFactory javaImplementationFactory;
public HeuristicConstructorTestCase() {
factory = new DefaultAssemblyFactory();
javaFactory = new DefaultJavaFactory();
+ javaImplementationFactory = new DefaultJavaImplementationFactory(factory);
DefaultJavaInterfaceIntrospector introspector = new DefaultJavaInterfaceIntrospector(javaFactory);
processor = new HeuristicPojoProcessor(factory, javaFactory, introspector);
}
- private <T> void visitEnd(Class<T> clazz, JavaImplementationDefinition type) throws IntrospectionException {
+ private <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
for (Constructor<T> constructor : clazz.getConstructors()) {
visitConstructor(constructor, type);
}
@@ -64,30 +65,30 @@
* Verifies a single constructor is chosen with a parameter as the type
*/
public void testSingleConstructorWithParam() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
org.apache.tuscany.assembly.Property prop = factory.createProperty();
prop.setName("foo");
type.getProperties().add(prop);
// Hack to add a property member
- JavaElement element = new JavaElement("foo", String.class, null);
+ JavaElementImpl element = new JavaElementImpl("foo", String.class, null);
type.getPropertyMembers().put("foo", element);
visitEnd(Foo1.class, type);
- assertNotNull(type.getConstructorDefinition().getConstructor());
- assertEquals("foo", type.getConstructorDefinition().getParameters()[0].getName());
+ assertNotNull(type.getConstructor().getConstructor());
+ assertEquals("foo", type.getConstructor().getParameters()[0].getName());
}
/**
* Verifies a single constructor is chosen with a reference as the type
*/
public void testSingleConstructorWithRef() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
org.apache.tuscany.assembly.Reference ref = factory.createReference();
ref.setName("foo");
type.getReferences().add(ref);
- type.getReferenceMembers().put("foo", new JavaElement("foo", String.class, null));
+ type.getReferenceMembers().put("foo", new JavaElementImpl("foo", String.class, null));
visitEnd(Foo1.class, type);
- assertNotNull(type.getConstructorDefinition().getConstructor());
- assertEquals("foo", type.getConstructorDefinition().getParameters()[0].getName());
+ assertNotNull(type.getConstructor().getConstructor());
+ assertEquals("foo", type.getConstructor().getParameters()[0].getName());
}
/**
@@ -95,43 +96,43 @@
* as the type
*/
public void testSingleConstructorWithPropRef() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
org.apache.tuscany.assembly.Property prop = factory.createProperty();
prop.setName("foo");
type.getProperties().add(prop);
// Hack to add a property member
- JavaElement element = new JavaElement("foo", String.class, null);
+ JavaElementImpl element = new JavaElementImpl("foo", String.class, null);
type.getPropertyMembers().put("foo", element);
org.apache.tuscany.assembly.Reference ref = ModelHelper.createReference(factory, javaFactory, "ref", Foo1.class);
type.getReferences().add(ref);
- type.getReferenceMembers().put("ref", new JavaElement("ref", Foo1.class, null));
+ type.getReferenceMembers().put("ref", new JavaElementImpl("ref", Foo1.class, null));
visitEnd(Foo2.class, type);
- assertNotNull(type.getConstructorDefinition().getConstructor());
- assertEquals(2, type.getConstructorDefinition().getParameters().length);
+ assertNotNull(type.getConstructor().getConstructor());
+ assertEquals(2, type.getConstructor().getParameters().length);
}
public void testSingleConstructorResolvableParam() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
visitEnd(Foo5.class, type);
assertEquals(String.class, type.getPropertyMembers().get("string").getType());
}
public void testSingleConstructorResolvableRef() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
visitEnd(Foo6.class, type);
assertTrue(ModelHelper.matches(ModelHelper.getReference(type, "ref"), Ref.class));
}
public void testSingleConstructorAmbiguousRef() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
org.apache.tuscany.assembly.Reference ref = ModelHelper.createReference(factory, javaFactory, "ref", Foo1.class);
type.getReferences().add(ref);
- type.getReferenceMembers().put("ref", new JavaElement("ref", Foo1.class, null));
+ type.getReferenceMembers().put("ref", new JavaElementImpl("ref", Foo1.class, null));
org.apache.tuscany.assembly.Reference ref2 = ModelHelper.createReference(factory, javaFactory, "ref2", Foo1.class);
type.getReferences().add(ref2);
- type.getReferenceMembers().put("ref2", new JavaElement("ref2", Foo1.class, null));
+ type.getReferenceMembers().put("ref2", new JavaElementImpl("ref2", Foo1.class, null));
try {
visitEnd(Foo4.class, type);
fail();
@@ -141,26 +142,26 @@
}
public void testConstructorPropertyAnnotatedParamsOnly() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
visitEnd(Foo7.class, type);
assertNotNull(getProperty(type, "myProp"));
}
public void testConstructorReferenceAnnotatedParamsOnly() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
visitEnd(Foo8.class, type);
assertNotNull(ModelHelper.getReference(type, "myRef"));
}
@SuppressWarnings("unchecked")
public void testDefaultConstructor() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
visitEnd(Foo3.class, type);
- assertNotNull(type.getConstructorDefinition().getConstructor());
+ assertNotNull(type.getConstructor().getConstructor());
}
public void testSameTypesButAnnotated() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
visitEnd(Foo12.class, type);
assertEquals(2, type.getProperties().size());
assertNotNull(getProperty(type, "prop1"));
@@ -171,14 +172,14 @@
* Verifies processing executes with additional extension annotations
*/
public void testRandomAnnotation() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
visitEnd(Foo11.class, type);
assertEquals(1, type.getProperties().size());
assertNotNull(getProperty(type, "prop1"));
}
public void testPrivateConstructor() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
try {
visitEnd(Foo14.class, type);
fail();
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/HeuristicPojoProcessorTestCase.java Mon Apr 30 22:09:44 2007
@@ -25,9 +25,11 @@
import javax.xml.namespace.QName;
import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.ConstructorDefinition;
-import org.apache.tuscany.implementation.java.impl.JavaElement;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.DefaultJavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.implementation.java.impl.JavaElementImpl;
import org.apache.tuscany.implementation.java.introspect.IntrospectionException;
import org.apache.tuscany.interfacedef.java.impl.DefaultJavaFactory;
import org.apache.tuscany.interfacedef.java.introspect.DefaultJavaInterfaceIntrospector;
@@ -46,13 +48,15 @@
public class HeuristicPojoProcessorTestCase extends AbstractProcessorTest {
private org.apache.tuscany.implementation.java.introspect.impl.HeuristicPojoProcessor processor;
+ private JavaImplementationFactory javaImplementationFactory;
public HeuristicPojoProcessorTestCase() {
DefaultJavaInterfaceIntrospector introspector = new DefaultJavaInterfaceIntrospector(new DefaultJavaFactory());
processor = new HeuristicPojoProcessor(new DefaultAssemblyFactory(), new DefaultJavaFactory(), introspector);
+ javaImplementationFactory = new DefaultJavaImplementationFactory(new DefaultAssemblyFactory());
}
- private <T> void visitEnd(Class<T> clazz, JavaImplementationDefinition type) throws IntrospectionException {
+ private <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
for (Constructor<T> constructor : clazz.getConstructors()) {
visitConstructor(constructor, type);
}
@@ -64,9 +68,9 @@
* is implemented
*/
public void testSingleInterface() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<SingleInterfaceImpl> ctor = SingleInterfaceImpl.class.getConstructor();
- type.setConstructorDefinition(new ConstructorDefinition<SingleInterfaceImpl>(ctor));
+ type.setConstructor(new JavaConstructorImpl<SingleInterfaceImpl>(ctor));
processor.visitEnd(SingleInterfaceImpl.class, type);
assertEquals(1, type.getServices().size());
assertTrue(ModelHelper.matches(ModelHelper.getService(type, PropertyInterface.class.getSimpleName()),
@@ -79,10 +83,10 @@
* Verifies property and reference setters are computed
*/
public void testPropertyReference() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<SingleInterfaceWithPropertyReferenceImpl> ctor = SingleInterfaceWithPropertyReferenceImpl.class
.getConstructor();
- type.setConstructorDefinition(new ConstructorDefinition<SingleInterfaceWithPropertyReferenceImpl>(ctor));
+ type.setConstructor(new JavaConstructorImpl<SingleInterfaceWithPropertyReferenceImpl>(ctor));
processor.visitEnd(SingleInterfaceWithPropertyReferenceImpl.class, type);
assertEquals(1, type.getServices().size());
assertTrue(ModelHelper
@@ -100,9 +104,9 @@
* operation is in the service interface
*/
public void testPropertySetterInInterface() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<SingleInterfaceImpl> ctor = SingleInterfaceImpl.class.getConstructor();
- type.setConstructorDefinition(new ConstructorDefinition<SingleInterfaceImpl>(ctor));
+ type.setConstructor(new JavaConstructorImpl<SingleInterfaceImpl>(ctor));
processor.visitEnd(SingleInterfaceImpl.class, type);
assertEquals(0, type.getProperties().size());
}
@@ -112,9 +116,9 @@
* operation is in the service interface
*/
public void testReferenceSetterInInterface() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<RefInterfaceImpl> ctor = RefInterfaceImpl.class.getConstructor();
- type.setConstructorDefinition(new ConstructorDefinition<RefInterfaceImpl>(ctor));
+ type.setConstructor(new JavaConstructorImpl<RefInterfaceImpl>(ctor));
processor.visitEnd(RefInterfaceImpl.class, type);
assertEquals(0, type.getReferences().size());
}
@@ -124,9 +128,9 @@
* references according to spec rules
*/
public void testReferenceCollectionType() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<ReferenceCollectionImpl> ctor = ReferenceCollectionImpl.class.getConstructor();
- type.setConstructorDefinition(new ConstructorDefinition<ReferenceCollectionImpl>(ctor));
+ type.setConstructor(new JavaConstructorImpl<ReferenceCollectionImpl>(ctor));
processor.visitEnd(ReferenceCollectionImpl.class, type);
assertEquals(1, type.getProperties().size());
assertEquals(3, type.getReferences().size());
@@ -137,9 +141,9 @@
* properties according to spec rules
*/
public void testPropertyCollectionType() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<PropertyCollectionImpl> ctor = PropertyCollectionImpl.class.getConstructor();
- type.setConstructorDefinition(new ConstructorDefinition<PropertyCollectionImpl>(ctor));
+ type.setConstructor(new JavaConstructorImpl<PropertyCollectionImpl>(ctor));
processor.visitEnd(PropertyCollectionImpl.class, type);
assertEquals(0, type.getReferences().size());
assertEquals(4, type.getProperties().size());
@@ -151,18 +155,18 @@
* @Remotable
*/
public void testRemotableRef() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<RemotableRefImpl> ctor = RemotableRefImpl.class.getConstructor();
- type.setConstructorDefinition(new ConstructorDefinition<RemotableRefImpl>(ctor));
+ type.setConstructor(new JavaConstructorImpl<RemotableRefImpl>(ctor));
processor.visitEnd(RemotableRefImpl.class, type);
assertEquals(2, type.getReferences().size());
assertEquals(0, type.getProperties().size());
}
public void testParentInterface() throws IntrospectionException, NoSuchMethodException {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<Child> ctor = Child.class.getConstructor();
- type.setConstructorDefinition(new ConstructorDefinition<Child>(ctor));
+ type.setConstructor(new JavaConstructorImpl<Child>(ctor));
processor.visitEnd(Child.class, type);
assertNotNull(ModelHelper.getService(type, Interface1.class.getSimpleName()));
}
@@ -172,47 +176,47 @@
* given
*/
public void testExcludedPropertyAndReference() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
org.apache.tuscany.assembly.Reference ref = factory.createReference();
ref.setName("reference");
type.getReferences().add(ref);
- type.getReferenceMembers().put("reference", new JavaElement("reference", Ref.class, null));
+ type.getReferenceMembers().put("reference", new JavaElementImpl("reference", Ref.class, null));
org.apache.tuscany.assembly.Reference ref2 = factory.createReference();
ref2.setName("reference2");
type.getReferences().add(ref2);
- type.getReferenceMembers().put("reference2", new JavaElement("reference2", Ref.class, null));
+ type.getReferenceMembers().put("reference2", new JavaElementImpl("reference2", Ref.class, null));
org.apache.tuscany.assembly.Property prop1 = factory.createProperty();
prop1.setName("string1");
type.getProperties().add(prop1);
- type.getPropertyMembers().put("string1", new JavaElement("string1", String.class, null));
+ type.getPropertyMembers().put("string1", new JavaElementImpl("string1", String.class, null));
org.apache.tuscany.assembly.Property prop2 = factory.createProperty();
prop2.setName("string2");
type.getProperties().add(prop2);
- type.getPropertyMembers().put("string2", new JavaElement("string2", String.class, null));
+ type.getPropertyMembers().put("string2", new JavaElementImpl("string2", String.class, null));
visitEnd(MockService.class, type);
assertEquals(1, type.getServices().size());
}
public void testProtectedRemotableRefField() throws IntrospectionException, NoSuchMethodException {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<ProtectedRemotableRefFieldImpl> ctor = ProtectedRemotableRefFieldImpl.class.getConstructor();
- type.setConstructorDefinition(new ConstructorDefinition<ProtectedRemotableRefFieldImpl>(ctor));
+ type.setConstructor(new JavaConstructorImpl<ProtectedRemotableRefFieldImpl>(ctor));
processor.visitEnd(ProtectedRemotableRefFieldImpl.class, type);
assertNotNull(ModelHelper.getReference(type, "otherRef"));
}
public void testProtectedRemotableRefMethod() throws IntrospectionException, NoSuchMethodException {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<ProtectedRemotableRefMethodImpl> ctor = ProtectedRemotableRefMethodImpl.class.getConstructor();
- type.setConstructorDefinition(new ConstructorDefinition<ProtectedRemotableRefMethodImpl>(ctor));
+ type.setConstructor(new JavaConstructorImpl<ProtectedRemotableRefMethodImpl>(ctor));
processor.visitEnd(ProtectedRemotableRefMethodImpl.class, type);
assertNotNull(ModelHelper.getReference(type, "otherRef"));
}
public void testSetDataTypes() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<PropertyIntTypeOnConstructor> ctor = PropertyIntTypeOnConstructor.class.getConstructor();
- type.setConstructorDefinition(new ConstructorDefinition<PropertyIntTypeOnConstructor>(ctor));
+ type.setConstructor(new JavaConstructorImpl<PropertyIntTypeOnConstructor>(ctor));
processor.visitEnd(PropertyIntTypeOnConstructor.class, type);
org.apache.tuscany.assembly.Property foo = ModelHelper.getProperty(type, "foo");
assertEquals(int.class, type.getPropertyMembers().get("foo").getType());
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/HeutisticExtensibleConstructorTestCase.java Mon Apr 30 22:09:44 2007
@@ -22,9 +22,11 @@
import org.apache.tuscany.assembly.Property;
import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.ConstructorDefinition;
-import org.apache.tuscany.implementation.java.impl.JavaElement;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.DefaultJavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.JavaConstructorImpl;
+import org.apache.tuscany.implementation.java.impl.JavaElementImpl;
import org.apache.tuscany.implementation.java.introspect.IntrospectionException;
import org.apache.tuscany.interfacedef.java.impl.DefaultJavaFactory;
import org.apache.tuscany.interfacedef.java.introspect.DefaultJavaInterfaceIntrospector;
@@ -39,13 +41,15 @@
public class HeutisticExtensibleConstructorTestCase extends AbstractProcessorTest {
private org.apache.tuscany.implementation.java.introspect.impl.HeuristicPojoProcessor processor;
+ private JavaImplementationFactory javaImplementationFactory;
public HeutisticExtensibleConstructorTestCase() {
DefaultJavaInterfaceIntrospector introspector = new DefaultJavaInterfaceIntrospector(new DefaultJavaFactory());
processor = new HeuristicPojoProcessor(new DefaultAssemblyFactory(), new DefaultJavaFactory(), introspector);
+ javaImplementationFactory = new DefaultJavaImplementationFactory(new DefaultAssemblyFactory());
}
- private <T> void visitEnd(Class<T> clazz, JavaImplementationDefinition type) throws IntrospectionException {
+ private <T> void visitEnd(Class<T> clazz, JavaImplementation type) throws IntrospectionException {
for (Constructor<T> constructor : clazz.getConstructors()) {
visitConstructor(constructor, type);
}
@@ -57,10 +61,10 @@
* annotation processors being called.
*/
public void testBarAnnotationProcessedFirst() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<Foo> ctor = Foo.class.getConstructor(String.class, String.class);
- ConstructorDefinition<Foo> definition = new ConstructorDefinition<Foo>(ctor);
- type.setConstructorDefinition(definition);
+ JavaConstructorImpl<Foo> definition = new JavaConstructorImpl<Foo>(ctor);
+ type.setConstructor(definition);
Property property = factory.createProperty();
property.setName("myBar");
definition.getParameters()[0].setName("myBar");
@@ -83,11 +87,11 @@
* @throws Exception
*/
public void testBarAnnotationProcessedLast() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
visitEnd(Foo.class, type);
// now simulate process the bar impl
- ConstructorDefinition<?> definition = type.getConstructorDefinition();
+ JavaConstructorImpl<?> definition = type.getConstructor();
definition.getParameters()[0].setName("myBar");
Property property = factory.createProperty();
property.setName("myBar");
@@ -104,16 +108,16 @@
* injection names and preserves their ordering.
*/
public void testBarAnnotationProcessedFirstInMiddle() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Constructor<Foo2> ctor = Foo2.class.getConstructor(String.class, String.class, String.class);
- ConstructorDefinition<Foo2> definition = new ConstructorDefinition<Foo2>(ctor);
- type.setConstructorDefinition(definition);
+ JavaConstructorImpl<Foo2> definition = new JavaConstructorImpl<Foo2>(ctor);
+ type.setConstructor(definition);
// insert placeholder for first param, which would be done by a
// processor
definition.getParameters()[0].setName("");
Property property = factory.createProperty();
// Hack to add a property member
- JavaElement element = new JavaElement("myBar", String.class, null);
+ JavaElementImpl element = new JavaElementImpl("myBar", String.class, null);
type.getPropertyMembers().put("myBar", element);
property.setName("myBar");
definition.getParameters()[1].setName("myBar");
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/InitProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/InitProcessorTestCase.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/InitProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/InitProcessorTestCase.java Mon Apr 30 22:09:44 2007
@@ -23,21 +23,25 @@
import junit.framework.TestCase;
import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
-import org.apache.tuscany.implementation.java.introspect.impl.DuplicateInitException;
-import org.apache.tuscany.implementation.java.introspect.impl.IllegalInitException;
-import org.apache.tuscany.implementation.java.introspect.impl.InitProcessor;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.DefaultJavaImplementationFactory;
import org.osoa.sca.annotations.Init;
/**
* @version $Rev$ $Date$
*/
public class InitProcessorTestCase extends TestCase {
+
+ private JavaImplementationFactory javaImplementationFactory;
+
+ public InitProcessorTestCase() {
+ javaImplementationFactory = new DefaultJavaImplementationFactory(new DefaultAssemblyFactory());
+ }
public void testInit() throws Exception {
InitProcessor processor = new InitProcessor(new DefaultAssemblyFactory());
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Method method = InitProcessorTestCase.Foo.class.getMethod("init");
processor.visitMethod(method, type);
assertNotNull(type.getInitMethod());
@@ -45,8 +49,7 @@
public void testBadInit() throws Exception {
InitProcessor processor = new InitProcessor(new DefaultAssemblyFactory());
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Method method = InitProcessorTestCase.Bar.class.getMethod("badInit", String.class);
try {
processor.visitMethod(method, type);
@@ -58,8 +61,7 @@
public void testTwoInit() throws Exception {
InitProcessor processor = new InitProcessor(new DefaultAssemblyFactory());
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
Method method = InitProcessorTestCase.Bar.class.getMethod("init");
Method method2 = InitProcessorTestCase.Bar.class.getMethod("init2");
processor.visitMethod(method, type);
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ModelHelper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ModelHelper.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ModelHelper.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ModelHelper.java Mon Apr 30 22:09:44 2007
@@ -25,7 +25,7 @@
import org.apache.tuscany.assembly.Property;
import org.apache.tuscany.assembly.Reference;
import org.apache.tuscany.assembly.Service;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.implementation.java.JavaImplementation;
import org.apache.tuscany.interfacedef.Interface;
import org.apache.tuscany.interfacedef.java.JavaFactory;
import org.apache.tuscany.interfacedef.java.JavaInterface;
@@ -36,7 +36,7 @@
*/
public class ModelHelper {
- public static Property getProperty(JavaImplementationDefinition type, String name) {
+ public static Property getProperty(JavaImplementation type, String name) {
for (Property prop : type.getProperties()) {
if (prop.getName().equals(name)) {
return prop;
@@ -45,7 +45,7 @@
return null;
}
- public static Reference getReference(JavaImplementationDefinition type, String name) {
+ public static Reference getReference(JavaImplementation type, String name) {
for (Reference ref : type.getReferences()) {
if (ref.getName().equals(name)) {
return ref;
@@ -54,7 +54,7 @@
return null;
}
- public static Service getService(JavaImplementationDefinition type, String name) {
+ public static Service getService(JavaImplementation type, String name) {
for (Service svc : type.getServices()) {
if (svc.getName().equals(name)) {
return svc;
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/PolicyProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/PolicyProcessorTestCase.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/PolicyProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/PolicyProcessorTestCase.java Mon Apr 30 22:09:44 2007
@@ -26,7 +26,9 @@
import junit.framework.TestCase;
import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.DefaultJavaImplementationFactory;
import org.apache.tuscany.interfacedef.Operation;
import org.apache.tuscany.interfacedef.java.impl.DefaultJavaFactory;
import org.apache.tuscany.interfacedef.java.introspect.DefaultJavaInterfaceIntrospector;
@@ -41,7 +43,7 @@
public class PolicyProcessorTestCase extends TestCase {
private ServiceProcessor serviceProcessor;
private PolicyProcessor policyProcessor;
- private JavaImplementationDefinition type;
+ private JavaImplementation type;
// This actually is a test for PolicyJavaInterfaceProcessor. It will get
// invoked via the call to ImplementationProcessorServiceImpl.createService in
@@ -85,7 +87,7 @@
verifyIntents(Service6.class, type);
}
- private void verifyIntents(Class serviceImplClass, JavaImplementationDefinition type) {
+ private void verifyIntents(Class serviceImplClass, JavaImplementation type) {
Requires serviceImplIntentAnnotation = (Requires)serviceImplClass.getAnnotation(Requires.class);
if (serviceImplIntentAnnotation != null) {
@@ -220,7 +222,8 @@
DefaultJavaInterfaceIntrospector introspector = new DefaultJavaInterfaceIntrospector(new DefaultJavaFactory());
serviceProcessor = new ServiceProcessor(new DefaultAssemblyFactory(), new DefaultJavaFactory(), introspector);
policyProcessor = new PolicyProcessor(new DefaultAssemblyFactory(), new DefaultPolicyFactory());
- type = new JavaImplementationDefinition();
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory(new DefaultAssemblyFactory());
+ type = javaImplementationFactory.createJavaImplementation();
}
// @Remotable
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/PropertyProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/PropertyProcessorTestCase.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/PropertyProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/PropertyProcessorTestCase.java Mon Apr 30 22:09:44 2007
@@ -26,12 +26,12 @@
import junit.framework.TestCase;
import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.JavaElement;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.DefaultJavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.JavaElementImpl;
import org.apache.tuscany.implementation.java.introspect.DuplicatePropertyException;
import org.apache.tuscany.implementation.java.introspect.IllegalPropertyException;
-import org.apache.tuscany.implementation.java.introspect.impl.JavaIntrospectionHelper;
-import org.apache.tuscany.implementation.java.introspect.impl.PropertyProcessor;
import org.osoa.sca.annotations.Property;
/**
@@ -39,7 +39,7 @@
*/
public class PropertyProcessorTestCase extends TestCase {
- JavaImplementationDefinition type;
+ JavaImplementation type;
PropertyProcessor processor;
public void testMethodAnnotation() throws Exception {
@@ -107,7 +107,8 @@
protected void setUp() throws Exception {
super.setUp();
- type = new JavaImplementationDefinition();
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory(new DefaultAssemblyFactory());
+ type = javaImplementationFactory.createJavaImplementation();
processor = new PropertyProcessor(new DefaultAssemblyFactory());
}
@@ -173,7 +174,7 @@
}
- private Class<?> getBaseType(JavaElement element) {
+ private Class<?> getBaseType(JavaElementImpl element) {
return JavaIntrospectionHelper.getBaseType(element.getType(), element.getGenericType());
}
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ReferenceProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ReferenceProcessorTestCase.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ReferenceProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ReferenceProcessorTestCase.java Mon Apr 30 22:09:44 2007
@@ -27,7 +27,9 @@
import org.apache.tuscany.assembly.Multiplicity;
import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.DefaultJavaImplementationFactory;
import org.apache.tuscany.interfacedef.java.JavaInterface;
import org.apache.tuscany.interfacedef.java.impl.DefaultJavaFactory;
import org.apache.tuscany.interfacedef.java.introspect.DefaultJavaInterfaceIntrospector;
@@ -38,7 +40,7 @@
*/
public class ReferenceProcessorTestCase extends TestCase {
- private JavaImplementationDefinition type;
+ private JavaImplementation type;
private ReferenceProcessor processor;
public void testMethodAnnotation() throws Exception {
@@ -110,7 +112,8 @@
protected void setUp() throws Exception {
super.setUp();
- type = new JavaImplementationDefinition();
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory(new DefaultAssemblyFactory());
+ type = javaImplementationFactory.createJavaImplementation();
processor = new ReferenceProcessor(new DefaultAssemblyFactory(), new DefaultJavaFactory(), new DefaultJavaInterfaceIntrospector(new DefaultJavaFactory()));
}
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ResourceProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ResourceProcessorTestCase.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ResourceProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ResourceProcessorTestCase.java Mon Apr 30 22:09:44 2007
@@ -24,24 +24,23 @@
import junit.framework.TestCase;
import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
-import org.apache.tuscany.implementation.java.impl.Resource;
-import org.apache.tuscany.implementation.java.introspect.impl.DuplicateResourceException;
-import org.apache.tuscany.implementation.java.introspect.impl.IllegalResourceException;
-import org.apache.tuscany.implementation.java.introspect.impl.ResourceProcessor;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.DefaultJavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.JavaResourceImpl;
/**
* @version $Rev$ $Date$
*/
public class ResourceProcessorTestCase extends TestCase {
- JavaImplementationDefinition type;
+ JavaImplementation type;
ResourceProcessor processor = new ResourceProcessor(new DefaultAssemblyFactory());
public void testVisitField() throws Exception {
Field field = Foo.class.getDeclaredField("bar");
processor.visitField(field, type);
- Resource resource = type.getResources().get("bar");
+ JavaResourceImpl resource = type.getResources().get("bar");
assertFalse(resource.isOptional());
assertNull(resource.getMappedName());
assertEquals(field.getType(), resource.getElement().getType());
@@ -50,7 +49,7 @@
public void testVisitMethod() throws Exception {
Method method = Foo.class.getMethod("setBar", Bar.class);
processor.visitMethod(method, type);
- Resource resource = type.getResources().get("bar");
+ JavaResourceImpl resource = type.getResources().get("bar");
assertFalse(resource.isOptional());
assertNull(resource.getMappedName());
assertEquals(method.getParameterTypes()[0], resource.getElement().getType());
@@ -59,7 +58,7 @@
public void testVisitNamedMethod() throws Exception {
Method method = Foo.class.getMethod("setBar2", Bar.class);
processor.visitMethod(method, type);
- Resource resource = type.getResources().get("someName");
+ JavaResourceImpl resource = type.getResources().get("someName");
assertFalse(resource.isOptional());
assertEquals("mapped", resource.getMappedName());
}
@@ -87,7 +86,8 @@
protected void setUp() throws Exception {
super.setUp();
- type = new JavaImplementationDefinition();
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory(new DefaultAssemblyFactory());
+ type = javaImplementationFactory.createJavaImplementation();
}
private class Foo {
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ScopeProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ScopeProcessorTestCase.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ScopeProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ScopeProcessorTestCase.java Mon Apr 30 22:09:44 2007
@@ -22,10 +22,11 @@
import org.apache.tuscany.assembly.Component;
import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
-import org.apache.tuscany.implementation.java.impl.Scope;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.DefaultJavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.JavaScopeImpl;
import org.apache.tuscany.implementation.java.introspect.IntrospectionException;
-import org.apache.tuscany.implementation.java.introspect.impl.ScopeProcessor;
import org.easymock.EasyMock;
/**
@@ -34,66 +35,54 @@
public class ScopeProcessorTestCase extends TestCase {
Component parent;
+ private JavaImplementationFactory javaImplementationFactory;
public void testCompositeScope() throws IntrospectionException {
ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
processor.visitClass(Composite.class, type);
- assertEquals(Scope.COMPOSITE, type.getScope());
+ assertEquals(JavaScopeImpl.COMPOSITE, type.getJavaScope());
}
public void testSessionScope() throws IntrospectionException {
ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
processor.visitClass(Session.class, type);
- assertEquals(Scope.SESSION, type.getScope());
+ assertEquals(JavaScopeImpl.SESSION, type.getJavaScope());
}
public void testConversationalScope() throws IntrospectionException {
ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
processor.visitClass(Conversation.class, type);
- assertEquals(Scope.CONVERSATION, type.getScope());
+ assertEquals(JavaScopeImpl.CONVERSATION, type.getJavaScope());
}
public void testRequestScope() throws IntrospectionException {
ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
processor.visitClass(Request.class, type);
- assertEquals(Scope.REQUEST, type.getScope());
- }
-
- public void testSystemScope() throws IntrospectionException {
- ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
- processor.visitClass(System.class, type);
- assertEquals(Scope.SYSTEM, type.getScope());
+ assertEquals(JavaScopeImpl.REQUEST, type.getJavaScope());
}
public void testStatelessScope() throws IntrospectionException {
ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
processor.visitClass(Stateless.class, type);
- assertEquals(Scope.STATELESS, type.getScope());
+ assertEquals(JavaScopeImpl.STATELESS, type.getJavaScope());
}
public void testNoScope() throws IntrospectionException {
ScopeProcessor processor = new ScopeProcessor(new DefaultAssemblyFactory());
- JavaImplementationDefinition type =
- new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
processor.visitClass(None.class, type);
- assertEquals(Scope.STATELESS, type.getScope());
+ assertEquals(JavaScopeImpl.STATELESS, type.getJavaScope());
}
protected void setUp() throws Exception {
super.setUp();
+ javaImplementationFactory = new DefaultJavaImplementationFactory(new DefaultAssemblyFactory());
parent = EasyMock.createNiceMock(Component.class);
}
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ServiceCallbackTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ServiceCallbackTestCase.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ServiceCallbackTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ServiceCallbackTestCase.java Mon Apr 30 22:09:44 2007
@@ -26,10 +26,10 @@
import junit.framework.TestCase;
import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.DefaultJavaImplementationFactory;
import org.apache.tuscany.implementation.java.introspect.IntrospectionException;
-import org.apache.tuscany.implementation.java.introspect.impl.IllegalCallbackReferenceException;
-import org.apache.tuscany.implementation.java.introspect.impl.ServiceProcessor;
import org.apache.tuscany.interfacedef.InvalidCallbackException;
import org.apache.tuscany.interfacedef.java.impl.DefaultJavaFactory;
import org.apache.tuscany.interfacedef.java.introspect.DefaultJavaInterfaceIntrospector;
@@ -41,14 +41,16 @@
*/
public class ServiceCallbackTestCase extends TestCase {
private ServiceProcessor processor;
+ private JavaImplementationFactory javaImplementationFactory;
@Override
protected void setUp() throws Exception {
processor = new ServiceProcessor(new DefaultAssemblyFactory(), new DefaultJavaFactory(), new DefaultJavaInterfaceIntrospector(new DefaultJavaFactory()));
+ javaImplementationFactory = new DefaultJavaImplementationFactory(new DefaultAssemblyFactory());
}
public void testMethodCallbackInterface() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
processor.visitClass(FooImpl.class, type);
org.apache.tuscany.assembly.Service service = getService(type, Foo.class.getSimpleName());
assertNotNull(service);
@@ -58,7 +60,7 @@
}
public void testFieldCallbackInterface() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
processor.visitClass(FooImpl.class, type);
org.apache.tuscany.assembly.Service service = getService(type, Foo.class.getSimpleName());
assertNotNull(service);
@@ -68,7 +70,7 @@
}
public void testMethodDoesNotMatchCallback() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
processor.visitClass(BadBarImpl.class, type);
Method method = BadBarImpl.class.getMethod("setWrongInterfaceCallback", String.class);
try {
@@ -80,7 +82,7 @@
}
public void testNoParamCallback() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
processor.visitClass(BadBarImpl.class, type);
Method method = BadBarImpl.class.getMethod("setNoParamCallback");
try {
@@ -92,7 +94,7 @@
}
public void testFieldDoesNotMatchCallback() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
processor.visitClass(BadBarImpl.class, type);
Field field = BadBarImpl.class.getDeclaredField("wrongInterfaceCallback");
try {
@@ -104,7 +106,7 @@
}
public void testBadCallbackInterfaceAnnotation() throws Exception {
- JavaImplementationDefinition type = new JavaImplementationDefinition();
+ JavaImplementation type = javaImplementationFactory.createJavaImplementation();
try {
processor.visitClass(BadFooImpl.class, type);
fail();
Modified: incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ServiceProcessorTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ServiceProcessorTestCase.java?view=diff&rev=533944&r1=533943&r2=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ServiceProcessorTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/implementation/java/introspect/impl/ServiceProcessorTestCase.java Mon Apr 30 22:09:44 2007
@@ -21,10 +21,9 @@
import junit.framework.TestCase;
import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
-import org.apache.tuscany.implementation.java.impl.JavaImplementationDefinition;
-import org.apache.tuscany.implementation.java.introspect.impl.IllegalServiceDefinitionException;
-import org.apache.tuscany.implementation.java.introspect.impl.InvalidServiceType;
-import org.apache.tuscany.implementation.java.introspect.impl.ServiceProcessor;
+import org.apache.tuscany.implementation.java.JavaImplementation;
+import org.apache.tuscany.implementation.java.JavaImplementationFactory;
+import org.apache.tuscany.implementation.java.impl.DefaultJavaImplementationFactory;
import org.apache.tuscany.interfacedef.java.JavaInterface;
import org.apache.tuscany.interfacedef.java.impl.DefaultJavaFactory;
import org.apache.tuscany.interfacedef.java.introspect.DefaultJavaInterfaceIntrospector;
@@ -37,7 +36,7 @@
*/
public class ServiceProcessorTestCase extends TestCase {
private ServiceProcessor processor;
- private JavaImplementationDefinition type;
+ private JavaImplementation type;
public void testMultipleInterfaces() throws Exception {
processor.visitClass(FooMultiple.class, type);
@@ -96,7 +95,8 @@
super.setUp();
DefaultJavaInterfaceIntrospector introspector = new DefaultJavaInterfaceIntrospector(new DefaultJavaFactory());
processor = new ServiceProcessor(new DefaultAssemblyFactory(), new DefaultJavaFactory(), introspector);
- type = new JavaImplementationDefinition();
+ JavaImplementationFactory javaImplementationFactory = new DefaultJavaImplementationFactory(new DefaultAssemblyFactory());
+ type = javaImplementationFactory.createJavaImplementation();
}
@Callback(Bar.class)
Added: incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/implementation/java/BaseJavaImplementation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/implementation/java/BaseJavaImplementation.java?view=auto&rev=533944
==============================================================================
--- incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/implementation/java/BaseJavaImplementation.java (added)
+++ incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/implementation/java/BaseJavaImplementation.java Mon Apr 30 22:09:44 2007
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.tuscany.implementation.java;
+
+import org.apache.tuscany.assembly.Implementation;
+
+/**
+ * Represents a Java implementation.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface BaseJavaImplementation extends Implementation {
+
+ /**
+ * Returns the name of the Java implementation class.
+ *
+ * @return the name of the Java implementation class
+ */
+ String getName();
+
+ /**
+ * Sets the name of the Java implementation class.
+ *
+ * @param className the name of the Java implementation class
+ */
+ void setName(String className);
+
+ /**
+ * Returns the Java implementation class.
+ *
+ * @return the Java implementation class
+ */
+ Class<?> getJavaClass();
+
+ /**
+ * Sets the Java implementation class.
+ *
+ * @param javaClass the Java implementation class
+ */
+ void setJavaClass(Class<?> javaClass);
+
+}
Propchange: incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/implementation/java/BaseJavaImplementation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/implementation-java/src/main/java/org/apache/tuscany/implementation/java/BaseJavaImplementation.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org