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 2008/01/02 21:29:09 UTC
svn commit: r608205 - in
/incubator/tuscany/java/sca/modules/host-embedded/src/test:
java/org/apache/tuscany/sca/host/embedded/
java/org/apache/tuscany/sca/host/embedded/impl/
java/org/apache/tuscany/sca/host/embedded/test/
java/org/apache/tuscany/sca/...
Author: jsdelfino
Date: Wed Jan 2 12:29:05 2008
New Revision: 608205
URL: http://svn.apache.org/viewvc?rev=608205&view=rev
Log:
Cleanup test extension, simplified it and refactored it to avoid confusion with the CRUD sample.
Added:
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/DefaultTestImplementationFactory.java (with props)
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementation.java (with props)
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementationFactory.java (with props)
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestService.java (with props)
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/
- copied from r608167, incubator/tuscany/java/sca/modules/host-embedded/src/test/java/test/crud/impl/
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationImpl.java (with props)
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationProcessor.java (with props)
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/
- copied from r608167, incubator/tuscany/java/sca/modules/host-embedded/src/test/java/test/crud/module/
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/TestModuleActivator.java (with props)
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/
- copied from r608167, incubator/tuscany/java/sca/modules/host-embedded/src/test/java/test/crud/provider/
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProvider.java (with props)
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProviderFactory.java (with props)
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestInvoker.java (with props)
incubator/tuscany/java/sca/modules/host-embedded/src/test/resources/test.composite (with props)
Removed:
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/CRUDImplementationImpl.java
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/CRUDImplementationProcessor.java
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/CRUDModuleActivator.java
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/CRUDImplementationProvider.java
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/CRUDImplementationProviderFactory.java
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/CRUDInvoker.java
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/test/crud/CRUD.java
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/test/crud/CRUDImplementation.java
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/test/crud/CRUDImplementationFactory.java
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/test/crud/DefaultCRUDImplementationFactory.java
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/test/crud/backend/
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/test/crud/impl/
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/test/crud/module/
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/test/crud/provider/
incubator/tuscany/java/sca/modules/host-embedded/src/test/resources/crud.composite
Modified:
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainBeanTestCase.java
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainTestCase.java
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomainTestCase.java
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomainTestCase.java
incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/TestModelResolver.java
incubator/tuscany/java/sca/modules/host-embedded/src/test/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
Modified: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainBeanTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainBeanTestCase.java?rev=608205&r1=608204&r2=608205&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainBeanTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainBeanTestCase.java Wed Jan 2 12:29:05 2008
@@ -21,12 +21,14 @@
import junit.framework.TestCase;
+import org.apache.tuscany.sca.host.embedded.test.extension.TestService;
import org.osoa.sca.ServiceReference;
-import test.crud.CRUD;
/**
+ * Test creation of an SCADomainBean and invocation of a service.
+ *
* @version $Rev$ $Date$
*/
public class SCADomainBeanTestCase extends TestCase {
@@ -36,27 +38,17 @@
@Override
protected void setUp() throws Exception {
domain = new SCADomainBean();
- domain.setDeployableComposites("crud.composite");
+ domain.setDeployableComposites("test.composite");
}
- public void testStart() throws Exception {
- ServiceReference<CRUD> serviceReference = domain.getServiceReference(CRUD.class, "CRUDServiceComponent");
+ public void testInvoke() throws Exception {
+ ServiceReference<TestService> serviceReference = domain.getServiceReference(TestService.class, "TestServiceComponent");
assertNotNull(serviceReference);
- CRUD service = serviceReference.getService();
- String id = service.create("ABC");
- Object result = service.retrieve(id);
- assertEquals("ABC", result);
- service.update(id, "EFG");
- result = service.retrieve(id);
- assertEquals("EFG", result);
- service.delete(id);
- result = service.retrieve(id);
- assertNull(result);
+ TestService service = serviceReference.getService();
+ String result = service.ping("Bob");
+ assertEquals("Hello Bob", result);
}
- /**
- * @throws java.lang.Exception
- */
@Override
protected void tearDown() throws Exception {
domain.close();
Modified: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainTestCase.java?rev=608205&r1=608204&r2=608205&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/SCADomainTestCase.java Wed Jan 2 12:29:05 2008
@@ -21,12 +21,14 @@
import junit.framework.TestCase;
+import org.apache.tuscany.sca.host.embedded.test.extension.TestService;
import org.osoa.sca.ServiceReference;
-import test.crud.CRUD;
/**
+ * Test SCADomain.newInstance and invocation of a service.
+ *
* @version $Rev$ $Date$
*/
public class SCADomainTestCase extends TestCase {
@@ -35,27 +37,17 @@
@Override
protected void setUp() throws Exception {
- domain = SCADomain.newInstance("crud.composite");
+ domain = SCADomain.newInstance("test.composite");
}
- public void testStart() throws Exception {
- ServiceReference<CRUD> serviceReference = domain.getServiceReference(CRUD.class, "CRUDServiceComponent");
+ public void testInvoke() throws Exception {
+ ServiceReference<TestService> serviceReference = domain.getServiceReference(TestService.class, "TestServiceComponent");
assertNotNull(serviceReference);
- CRUD service = serviceReference.getService();
- String id = service.create("ABC");
- Object result = service.retrieve(id);
- assertEquals("ABC", result);
- service.update(id, "EFG");
- result = service.retrieve(id);
- assertEquals("EFG", result);
- service.delete(id);
- result = service.retrieve(id);
- assertNull(result);
+ TestService service = serviceReference.getService();
+ String result = service.ping("Bob");
+ assertEquals("Hello Bob", result);
}
- /**
- * @throws java.lang.Exception
- */
@Override
protected void tearDown() throws Exception {
domain.close();
Modified: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomainTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomainTestCase.java?rev=608205&r1=608204&r2=608205&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomainTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/DefaultSCADomainTestCase.java Wed Jan 2 12:29:05 2008
@@ -22,43 +22,39 @@
import junit.framework.TestCase;
import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
+import org.apache.tuscany.sca.host.embedded.test.extension.TestService;
-import test.crud.CRUD;
/**
+ * Test creation of DefaultSCADomain.
+ *
* @version $Rev$ $Date$
*/
public class DefaultSCADomainTestCase extends TestCase {
private DefaultSCADomain domain;
- /**
- * @throws java.lang.Exception
- */
@Override
protected void setUp() throws Exception {
domain = new DefaultSCADomain(getClass().getClassLoader(), getClass().getClassLoader(),
- "http://localhost", ".", "crud.composite");
+ "http://localhost", ".", "test.composite");
}
public void testStart() throws Exception {
- CRUD service = domain.getService(CRUD.class, "CRUDServiceComponent");
+ TestService service = domain.getService(TestService.class, "TestServiceComponent");
assertNotNull(service);
}
public void testComponentManager() throws Exception {
ComponentManager componentManager = domain.getComponentManager();
assertEquals(1, componentManager.getComponentNames().size());
- assertEquals("CRUDServiceComponent", componentManager.getComponentNames().iterator().next());
- assertNotNull(componentManager.getComponent("CRUDServiceComponent"));
+ assertEquals("TestServiceComponent", componentManager.getComponentNames().iterator().next());
+ assertNotNull(componentManager.getComponent("TestServiceComponent"));
- assertTrue(componentManager.isComponentStarted("CRUDServiceComponent"));
- componentManager.stopComponent("CRUDServiceComponent");
- assertFalse(componentManager.isComponentStarted("CRUDServiceComponent"));
+ assertTrue(componentManager.isComponentStarted("TestServiceComponent"));
+ componentManager.stopComponent("TestServiceComponent");
+ assertFalse(componentManager.isComponentStarted("TestServiceComponent"));
}
- /**
- * @throws java.lang.Exception
- */
@Override
protected void tearDown() throws Exception {
domain.close();
Modified: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomainTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomainTestCase.java?rev=608205&r1=608204&r2=608205&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomainTestCase.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/EmbeddedSCADomainTestCase.java Wed Jan 2 12:29:05 2008
@@ -31,19 +31,16 @@
import org.apache.tuscany.sca.contribution.service.ContributionService;
import org.apache.tuscany.sca.host.embedded.management.ComponentListener;
import org.apache.tuscany.sca.host.embedded.management.ComponentManager;
-
-import test.crud.CRUD;
-
+import org.apache.tuscany.sca.host.embedded.test.extension.TestService;
/**
+ * Test creation of an EmbeddedSCADomain and invocation of a service.
+ *
* @version $Rev$ $Date$
*/
public class EmbeddedSCADomainTestCase extends TestCase {
private EmbeddedSCADomain domain;
- /**
- * @throws java.lang.Exception
- */
@Override
protected void setUp() throws Exception {
@@ -67,7 +64,7 @@
assertNotNull(contribution);
// Decide which SCA composite I want to deploy
- Composite myComposite = myResolver.getComposite(new QName("http://sample/crud", "crud"));
+ Composite myComposite = myResolver.getComposite(new QName("http://test", "test"));
// Add the deployable composite to the domain
domain.getDomainComposite().getIncludes().add(myComposite);
@@ -86,19 +83,12 @@
// At this point the domain contains my contribution, my composite and
// it's started, my application code can start using it
- // Get the CRUDServiceComponent service
- CRUD service = domain.getService(CRUD.class, "CRUDServiceComponent");
+ // Get the TestServiceComponent service
+ TestService service = domain.getService(TestService.class, "TestServiceComponent");
// Invoke the service
- String id = service.create("ABC");
- Object result = service.retrieve(id);
- assertEquals("ABC", result);
- service.update(id, "EFG");
- result = service.retrieve(id);
- assertEquals("EFG", result);
- service.delete(id);
- result = service.retrieve(id);
- assertNull(result);
+ String result = service.ping("Bob");
+ assertEquals("Hello Bob", result);
// Stop my composite
domain.getCompositeActivator().stop(myComposite);
@@ -130,7 +120,7 @@
assertNotNull(contribution);
// Decide which SCA composite I want to deploy
- Composite myComposite = myResolver.getComposite(new QName("http://sample/crud", "crud"));
+ Composite myComposite = myResolver.getComposite(new QName("http://test", "test"));
// Add the deployable composite to the domain
domain.getDomainComposite().getIncludes().add(myComposite);
@@ -150,26 +140,26 @@
ComponentManager componentManager = domain.getComponentManager();
assertEquals(1, componentManager.getComponentNames().size());
- assertEquals("CRUDServiceComponent", componentManager.getComponentNames().iterator().next());
+ assertEquals("TestServiceComponent", componentManager.getComponentNames().iterator().next());
- Component component = componentManager.getComponent("CRUDServiceComponent");
+ Component component = componentManager.getComponent("TestServiceComponent");
assertNotNull(component);
- assertEquals("CRUDServiceComponent", component.getName());
+ assertEquals("TestServiceComponent", component.getName());
MyComponentListener cl = new MyComponentListener();
componentManager.addComponentListener(cl);
- assertTrue(componentManager.isComponentStarted("CRUDServiceComponent"));
+ assertTrue(componentManager.isComponentStarted("TestServiceComponent"));
assertFalse(cl.stopCalled);
- componentManager.stopComponent("CRUDServiceComponent");
+ componentManager.stopComponent("TestServiceComponent");
assertTrue(cl.stopCalled);
- assertFalse(componentManager.isComponentStarted("CRUDServiceComponent"));
+ assertFalse(componentManager.isComponentStarted("TestServiceComponent"));
assertFalse(cl.startCalled);
- componentManager.startComponent("CRUDServiceComponent");
+ componentManager.startComponent("TestServiceComponent");
assertTrue(cl.startCalled);
- assertTrue(componentManager.isComponentStarted("CRUDServiceComponent"));
+ assertTrue(componentManager.isComponentStarted("TestServiceComponent"));
// Stop my composite
domain.getCompositeActivator().stop(myComposite);
@@ -199,9 +189,6 @@
}
- /**
- * @throws java.lang.Exception
- */
@Override
protected void tearDown() throws Exception {
domain.close();
Modified: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/TestModelResolver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/TestModelResolver.java?rev=608205&r1=608204&r2=608205&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/TestModelResolver.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/impl/TestModelResolver.java Wed Jan 2 12:29:05 2008
@@ -58,7 +58,7 @@
// Load a class on demand
ClassReference classReference = (ClassReference)unresolved;
- Class clazz;
+ Class<?> clazz;
try {
clazz = Class.forName(classReference.getClassName(), true, classLoader.get());
} catch (ClassNotFoundException e) {
Added: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/DefaultTestImplementationFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/DefaultTestImplementationFactory.java?rev=608205&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/DefaultTestImplementationFactory.java (added)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/DefaultTestImplementationFactory.java Wed Jan 2 12:29:05 2008
@@ -0,0 +1,47 @@
+/*
+ * 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.sca.host.embedded.test.extension;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.host.embedded.test.extension.impl.TestImplementationImpl;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+
+/**
+ * Default factory for the test implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class DefaultTestImplementationFactory implements TestImplementationFactory {
+
+ private AssemblyFactory assemblyFactory;
+ private JavaInterfaceFactory javaFactory;
+
+ public DefaultTestImplementationFactory(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaFactory) {
+ this.assemblyFactory = assemblyFactory;
+ this.javaFactory = javaFactory;
+ }
+
+ public TestImplementation createTestImplementation() {
+ return new TestImplementationImpl(assemblyFactory, javaFactory);
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/DefaultTestImplementationFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/DefaultTestImplementationFactory.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementation.java?rev=608205&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementation.java (added)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementation.java Wed Jan 2 12:29:05 2008
@@ -0,0 +1,45 @@
+/*
+ * 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.sca.host.embedded.test.extension;
+
+import org.apache.tuscany.sca.assembly.Implementation;
+
+/**
+ * The model representing a test implementation in an SCA assembly model.
+ *
+ * @version $$Rev$$ $$Date: 2007-04-23 19:18:54 -0700 (Mon, 23 Apr
+ * 2007) $$
+ */
+public interface TestImplementation extends Implementation {
+
+ /**
+ * Returns the greeting string that can be configured on test implementations.
+ *
+ * @return the greeting string that can be configured on test implementations
+ */
+ public String getGreeting();
+
+ /**
+ * Sets the greeting string that can be configured on test implementations.
+ *
+ * @param greeting the greeting string that can be configured on test implementations
+ */
+ public void setGreeting(String greeting);
+
+}
Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementation.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementationFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementationFactory.java?rev=608205&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementationFactory.java (added)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementationFactory.java Wed Jan 2 12:29:05 2008
@@ -0,0 +1,37 @@
+/*
+ * 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.sca.host.embedded.test.extension;
+
+
+/**
+ * A factory for the test implementation model.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface TestImplementationFactory {
+
+ /**
+ * Creates a new test implementation.
+ *
+ * @return
+ */
+ TestImplementation createTestImplementation();
+
+}
Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementationFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestImplementationFactory.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestService.java?rev=608205&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestService.java (added)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestService.java Wed Jan 2 12:29:05 2008
@@ -0,0 +1,30 @@
+/*
+ * 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.sca.host.embedded.test.extension;
+
+/**
+ * Service interface for test component implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface TestService {
+
+ String ping(String name);
+
+}
Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestService.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/TestService.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationImpl.java?rev=608205&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationImpl.java (added)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationImpl.java Wed Jan 2 12:29:05 2008
@@ -0,0 +1,118 @@
+/*
+ * 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.sca.host.embedded.test.extension.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Property;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.host.embedded.test.extension.TestService;
+import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementation;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+
+/**
+ * The model representing a test implementation in an SCA assembly model.
+ *
+ * @version $$Rev$$ $$Date: 2007-04-23 19:18:54 -0700 (Mon, 23 Apr
+ * 2007) $$
+ */
+public class TestImplementationImpl implements TestImplementation {
+
+ private Service testService;
+ private String greeting;
+
+ /**
+ * Constructs a new test implementation.
+ */
+ public TestImplementationImpl(AssemblyFactory assemblyFactory,
+ JavaInterfaceFactory javaFactory) {
+
+ // Test implementations always provide a single service exposing
+ // the TestService interface, and have no references and properties
+ testService = assemblyFactory.createService();
+ testService.setName("Test");
+ JavaInterface javaInterface;
+ try {
+ javaInterface = javaFactory.createJavaInterface(TestService.class);
+ } catch (InvalidInterfaceException e) {
+ throw new IllegalArgumentException(e);
+ }
+ JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+ interfaceContract.setInterface(javaInterface);
+ testService.setInterfaceContract(interfaceContract);
+ }
+
+ public String getGreeting() {
+ return greeting;
+ }
+
+ public void setGreeting(String greeting) {
+ this.greeting = greeting;
+ }
+
+ public ConstrainingType getConstrainingType() {
+ // The test implementation does not support constrainingTypes
+ return null;
+ }
+
+ public List<Property> getProperties() {
+ // The test implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public List<Service> getServices() {
+ // The test implementation provides a single fixed Test service
+ return Collections.singletonList(testService);
+ }
+
+ public List<Reference> getReferences() {
+ // The test implementation does not support properties
+ return Collections.emptyList();
+ }
+
+ public String getURI() {
+ // The test implementation does not have a URI
+ return null;
+ }
+
+ public void setConstrainingType(ConstrainingType constrainingType) {
+ // The test implementation does not support constrainingTypes
+ }
+
+ public void setURI(String uri) {
+ // The test implementation does not have a URI
+ }
+
+ public boolean isUnresolved() {
+ // The test implementation is always resolved
+ return false;
+ }
+
+ public void setUnresolved(boolean unresolved) {
+ // The test implementation is always resolved
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationProcessor.java?rev=608205&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationProcessor.java (added)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationProcessor.java Wed Jan 2 12:29:05 2008
@@ -0,0 +1,96 @@
+/*
+ * 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.sca.host.embedded.test.extension.impl;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
+import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
+import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementation;
+import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementationFactory;
+
+
+
+/**
+ * Implements a STAX artifact processor for test implementations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestImplementationProcessor implements StAXArtifactProcessor<TestImplementation> {
+ private static final QName IMPLEMENTATION_TEST = new QName("http://test/extension", "implementation.test");
+
+ private TestImplementationFactory testFactory;
+
+ public TestImplementationProcessor(TestImplementationFactory testFactory) {
+ this.testFactory = testFactory;
+ }
+
+ public QName getArtifactType() {
+ // Returns the qname of the XML element processed by this processor
+ return IMPLEMENTATION_TEST;
+ }
+
+ public Class<TestImplementation> getModelType() {
+ // Returns the type of model processed by this processor
+ return TestImplementation.class;
+ }
+
+ public TestImplementation read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
+
+ // Read an <implementation.test> element
+
+ // Read the message attribute.
+ String message = reader.getAttributeValue(null, "greeting");
+
+ // Create and initialize the test implementation model
+ TestImplementation implementation = testFactory.createTestImplementation();
+ implementation.setGreeting(message);
+
+ // Skip to end element
+ while (reader.hasNext()) {
+ if (reader.next() == END_ELEMENT && IMPLEMENTATION_TEST.equals(reader.getName())) {
+ break;
+ }
+ }
+
+ return implementation;
+ }
+
+ public void resolve(TestImplementation impl, ModelResolver resolver) throws ContributionResolveException {
+ }
+
+ public void write(TestImplementation implementation, XMLStreamWriter writer) throws ContributionWriteException, XMLStreamException {
+
+ writer.writeStartElement(IMPLEMENTATION_TEST.getNamespaceURI(), IMPLEMENTATION_TEST.getLocalPart());
+
+ if (implementation.getGreeting() != null) {
+ writer.writeAttribute("greeting", implementation.getGreeting());
+ }
+
+ writer.writeEndElement();
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationProcessor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationProcessor.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/TestModuleActivator.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/TestModuleActivator.java?rev=608205&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/TestModuleActivator.java (added)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/TestModuleActivator.java Wed Jan 2 12:29:05 2008
@@ -0,0 +1,66 @@
+/*
+ * 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.sca.host.embedded.test.extension.module;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.ModuleActivator;
+import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementationFactory;
+import org.apache.tuscany.sca.host.embedded.test.extension.DefaultTestImplementationFactory;
+import org.apache.tuscany.sca.host.embedded.test.extension.impl.TestImplementationProcessor;
+import org.apache.tuscany.sca.host.embedded.test.extension.provider.TestImplementationProviderFactory;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.provider.ProviderFactoryExtensionPoint;
+
+
+
+/**
+ * Implements a module activator for the test implementation extension module.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestModuleActivator implements ModuleActivator {
+
+ public void start(ExtensionPointRegistry registry) {
+
+ // Create the test implementation factory
+ ModelFactoryExtensionPoint factories = registry.getExtensionPoint(ModelFactoryExtensionPoint.class);
+ AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
+ JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
+ TestImplementationFactory testFactory = new DefaultTestImplementationFactory(assemblyFactory, javaFactory);
+ factories.addFactory(testFactory);
+
+ // Add the test implementation extension to the StAXArtifactProcessor
+ // extension point
+ StAXArtifactProcessorExtensionPoint processors = registry.getExtensionPoint(StAXArtifactProcessorExtensionPoint.class);
+ TestImplementationProcessor implementationArtifactProcessor = new TestImplementationProcessor(testFactory);
+ processors.addArtifactProcessor(implementationArtifactProcessor);
+
+ // Add the test provider factory to the ProviderFactory extension point
+ ProviderFactoryExtensionPoint providerFactories = registry.getExtensionPoint(ProviderFactoryExtensionPoint.class);
+ providerFactories.addProviderFactory(new TestImplementationProviderFactory());
+ }
+
+ public void stop(ExtensionPointRegistry registry) {
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/TestModuleActivator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/module/TestModuleActivator.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProvider.java?rev=608205&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProvider.java (added)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProvider.java Wed Jan 2 12:29:05 2008
@@ -0,0 +1,65 @@
+/*
+ * 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.sca.host.embedded.test.extension.provider;
+
+import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementation;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+
+/**
+ * Implementation provider for test implementations.
+ *
+ * @version $$Rev$$ $$Date: 2007-04-23 19:18:54 -0700 (Mon, 23 Apr
+ * 2007) $$
+ */
+public class TestImplementationProvider implements ImplementationProvider {
+
+ private RuntimeComponent component;
+ private TestImplementation implementation;
+
+ /**
+ * Constructs a new test implementation provider.
+ */
+ public TestImplementationProvider(RuntimeComponent component, TestImplementation implementation) {
+ this.component = component;
+ this.implementation = implementation;
+ }
+
+ public Invoker createInvoker(RuntimeComponentService service, Operation operation) {
+ TestInvoker invoker = new TestInvoker(operation, implementation.getGreeting());
+ return invoker;
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return false;
+ }
+
+ public void start() {
+ System.out.println("Starting " + component.getName());
+ }
+
+ public void stop() {
+ System.out.println("Stopping " + component.getName());
+ }
+
+}
Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProvider.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProviderFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProviderFactory.java?rev=608205&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProviderFactory.java (added)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProviderFactory.java Wed Jan 2 12:29:05 2008
@@ -0,0 +1,48 @@
+/*
+ * 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.sca.host.embedded.test.extension.provider;
+
+import org.apache.tuscany.sca.host.embedded.test.extension.TestImplementation;
+import org.apache.tuscany.sca.provider.ImplementationProvider;
+import org.apache.tuscany.sca.provider.ImplementationProviderFactory;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+
+
+/**
+ * The model representing a test implementation in an SCA assembly model.
+ *
+ * @version $$Rev$$ $$Date: 2007-04-23 19:18:54 -0700 (Mon, 23 Apr
+ * 2007) $$
+ */
+public class TestImplementationProviderFactory implements ImplementationProviderFactory<TestImplementation> {
+
+ /**
+ * Constructs a new test implementation provider factory.
+ */
+ public TestImplementationProviderFactory() {
+ }
+
+ public ImplementationProvider createImplementationProvider(RuntimeComponent component, TestImplementation implementation) {
+ return new TestImplementationProvider(component, implementation);
+ }
+
+ public Class<TestImplementation> getModelType() {
+ return TestImplementation.class;
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProviderFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestImplementationProviderFactory.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestInvoker.java?rev=608205&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestInvoker.java (added)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestInvoker.java Wed Jan 2 12:29:05 2008
@@ -0,0 +1,52 @@
+/*
+ * 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.sca.host.embedded.test.extension.provider;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+
+
+/**
+ * Implements an invoker for test component implementations.
+ *
+ * The target invoker is responsible for handling operation invocations.
+ *
+ * @version $Rev$ $Date$
+ */
+public class TestInvoker implements Invoker {
+ private Operation operation;
+ private String greeting;
+
+ public TestInvoker(Operation operation, String greeting) {
+ this.operation = operation;
+ this.greeting = greeting;
+ }
+
+ public Message invoke(Message msg) {
+ Object[] args = msg.getBody();
+ if (operation.getName().equals("ping")) {
+ msg.setBody(greeting + " " + args[0]);
+ } else {
+ msg.setFaultBody(new Exception("Operation " + operation.getName() + " is not supported"));
+ }
+ return msg;
+ }
+}
Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestInvoker.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/provider/TestInvoker.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: incubator/tuscany/java/sca/modules/host-embedded/src/test/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator?rev=608205&r1=608204&r2=608205&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator Wed Jan 2 12:29:05 2008
@@ -15,4 +15,4 @@
# specific language governing permissions and limitations
# under the License.
# Implementation class for the ExtensionActivator
-test.crud.module.CRUDModuleActivator
+org.apache.tuscany.sca.host.embedded.test.extension.module.TestModuleActivator
Added: incubator/tuscany/java/sca/modules/host-embedded/src/test/resources/test.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/test/resources/test.composite?rev=608205&view=auto
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/test/resources/test.composite (added)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/test/resources/test.composite Wed Jan 2 12:29:05 2008
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+ targetNamespace="http://test"
+ xmlns:se="http://test"
+ xmlns:e="http://test/extension"
+ name="test">
+
+ <component name="TestServiceComponent">
+ <e:implementation.test greeting="Hello" />
+ </component>
+
+</composite>
Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/resources/test.composite
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/modules/host-embedded/src/test/resources/test.composite
------------------------------------------------------------------------------
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