tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adrianocrest...@apache.org
Subject svn commit: r653133 [12/33] - in /incubator/tuscany/sandbox/mobile-android: android-jdk-classes/ android-jdk-classes/src/ android-jdk-classes/src/javax/ android-jdk-classes/src/javax/xml/ android-jdk-classes/src/javax/xml/namespace/ android-jdk-classes...
Date Sat, 03 May 2008 20:52:58 GMT
Added: incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.java (added)
+++ incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ReadTestCase.java Sat May  3 13:52:41 2008
@@ -0,0 +1,99 @@
+/*
+ * 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.assembly.xml;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test reading SCA XML assemblies.
+ * 
+ * @version $Rev: 638855 $ $Date: 2008-03-19 08:04:32 -0700 (Wed, 19 Mar 2008) $
+ */
+public class ReadTestCase extends TestCase {
+
+    private XMLInputFactory inputFactory;
+    private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+    private ExtensibleStAXArtifactProcessor staxProcessor;
+    private AssemblyFactory factory;
+    private PolicyFactory policyFactory;
+
+    @Override
+    public void setUp() throws Exception {
+        factory = new DefaultAssemblyFactory();
+        policyFactory = new DefaultPolicyFactory();
+        inputFactory = XMLInputFactory.newInstance();
+        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+    }
+
+    @Override
+    public void tearDown() throws Exception {
+    }
+
+    public void testReadComponentType() throws Exception {
+        ComponentTypeProcessor componentTypeReader = new ComponentTypeProcessor(factory, policyFactory, staxProcessor);
+        InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+        assertNotNull(componentTypeReader.read(reader));
+        is.close();
+    }
+
+    public void testReadConstrainingType() throws Exception {
+        InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+        ConstrainingTypeProcessor constrainingTypeReader = new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor);
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+        assertNotNull(constrainingTypeReader.read(reader));
+        is.close();
+
+    }
+
+    public void testReadComposite() throws Exception {
+        InputStream is = getClass().getResourceAsStream("Calculator.composite");
+        CompositeProcessor compositeReader = new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor);
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+        assertNotNull(compositeReader.read(reader));
+        is.close();
+
+    }
+
+    public void testReadCompositeAndWireIt() throws Exception {
+        InputStream is = getClass().getResourceAsStream("Calculator.composite");
+        CompositeProcessor compositeReader = new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor);
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+        assertNotNull(compositeReader.read(reader));
+        is.close();
+    }
+
+}

Added: incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java (added)
+++ incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolvePolicyTestCase.java Sat May  3 13:52:41 2008
@@ -0,0 +1,198 @@
+/*
+ * 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.assembly.xml; 
+
+import java.net.URI;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultURLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleURLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.definitions.xml.SCADefinitionsDocumentProcessor;
+import org.apache.tuscany.sca.definitions.xml.SCADefinitionsProcessor;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.xml.PolicySetProcessor;
+import org.apache.tuscany.sca.policy.xml.ProfileIntentProcessor;
+import org.apache.tuscany.sca.policy.xml.QualifiedIntentProcessor;
+import org.apache.tuscany.sca.policy.xml.SimpleIntentProcessor;
+
+/**
+ * Test reading SCA XML assembly documents.
+ * 
+ * @version $Rev: 561254 $ $Date: 2007-07-31 13:16:27 +0530 (Tue, 31 Jul 2007) $
+ */
+public class ResolvePolicyTestCase extends TestCase {
+
+    private ExtensibleURLArtifactProcessor documentProcessor;
+    private TestModelResolver resolver;  
+    SCADefinitionsDocumentProcessor scaDefnDocProcessor;
+
+    @Override
+    public void setUp() throws Exception {
+        List scaDefnSink = new ArrayList();
+        AssemblyFactory factory = new DefaultAssemblyFactory();
+        PolicyFactory policyFactory = new DefaultPolicyFactory();
+        resolver = new TestModelResolver();
+        
+        URLArtifactProcessorExtensionPoint documentProcessors = new DefaultURLArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+        documentProcessor = new ExtensibleURLArtifactProcessor(documentProcessors); 
+        
+        // Create StAX processors
+        DefaultStAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+        ExtensibleStAXArtifactProcessor staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+        staxProcessors.addArtifactProcessor(new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor));
+        staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(factory, policyFactory, staxProcessor));
+        staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor));
+        staxProcessors.addArtifactProcessor(new SCADefinitionsProcessor(policyFactory, staxProcessor, resolver));
+        staxProcessors.addArtifactProcessor(new SimpleIntentProcessor(policyFactory, staxProcessor));
+        staxProcessors.addArtifactProcessor(new ProfileIntentProcessor(policyFactory, staxProcessor));
+        staxProcessors.addArtifactProcessor(new QualifiedIntentProcessor(policyFactory, staxProcessor));
+        staxProcessors.addArtifactProcessor(new PolicySetProcessor(policyFactory, staxProcessor));
+        staxProcessors.addArtifactProcessor(new MockPolicyProcessor());
+        
+        // Create document processors
+        XMLInputFactory inputFactory = XMLInputFactory.newInstance(); 
+        documentProcessors.addArtifactProcessor(new CompositeDocumentProcessor(staxProcessor, inputFactory, scaDefnSink));
+        documentProcessors.addArtifactProcessor(new ComponentTypeDocumentProcessor(staxProcessor, inputFactory));
+        documentProcessors.addArtifactProcessor(new ConstrainingTypeDocumentProcessor(staxProcessor, inputFactory));
+        scaDefnDocProcessor = new SCADefinitionsDocumentProcessor(staxProcessors, staxProcessor, inputFactory, policyFactory);
+        documentProcessors.addArtifactProcessor(scaDefnDocProcessor);
+    }
+
+    @Override
+    public void tearDown() throws Exception {
+    }
+
+    public void testResolveConstrainingType() throws Exception {
+        
+        URL url = getClass().getResource("CalculatorComponent.constrainingType");
+        URI uri = URI.create("CalculatorComponent.constrainingType");
+        ConstrainingType constrainingType = (ConstrainingType)documentProcessor.read(null, uri, url);
+        assertNotNull(constrainingType);
+        resolver.addModel(constrainingType);
+
+        url = getClass().getResource("TestAllCalculator.composite");
+        uri = URI.create("TestAllCalculator.constrainingType");
+        Composite composite = (Composite)documentProcessor.read(null, uri, url);
+        assertNotNull(composite);
+        
+        url = getClass().getResource("test_definitions.xml");
+        uri = URI.create("test_definitions.xml");
+        SCADefinitions scaDefns = (SCADefinitions)scaDefnDocProcessor.read(null, uri, url);
+        assertNotNull(scaDefns);
+        
+        preResolvePolicyTests(composite);
+        documentProcessor.resolve(scaDefns, resolver);
+        documentProcessor.resolve(composite, resolver);
+        postResolvePolicyTests(composite);
+        
+        assertEquals(composite.getConstrainingType(), constrainingType);
+        assertEquals(composite.getComponents().get(0).getConstrainingType(), constrainingType);
+    }
+    
+    private void preResolvePolicyTests(Composite composite) {
+        assertNull(((PolicySetAttachPoint)composite).getRequiredIntents().get(0).getDescription());
+        assertTrue(((PolicySetAttachPoint)composite).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        
+        assertNull(composite.getServices().get(0).getRequiredIntents().get(0).getDescription());
+        assertTrue(composite.getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNull(composite.getServices().get(0).getCallback().getRequiredIntents().get(0).getDescription());
+        assertTrue(composite.getServices().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
+        
+        assertNull(composite.getComponents().get(0).getRequiredIntents().get(0).getDescription());
+        assertTrue(composite.getComponents().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNull(composite.getComponents().get(0).getServices().get(0).getRequiredIntents().get(0).getDescription());
+        assertTrue(composite.getComponents().get(0).getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNull(composite.getComponents().get(0).getReferences().get(0).getRequiredIntents().get(0).getDescription());
+        assertTrue(composite.getComponents().get(0).getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        
+        assertNull(composite.getReferences().get(0).getRequiredIntents().get(0).getDescription());
+        assertTrue(composite.getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNull(composite.getReferences().get(0).getCallback().getRequiredIntents().get(0).getDescription());
+        assertTrue(composite.getReferences().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
+    }
+    
+    private void postResolvePolicyTests(Composite composite) {
+        assertNotNull(((PolicySetAttachPoint)composite).getRequiredIntents().get(0).getDescription());
+        assertFalse(((PolicySetAttachPoint)composite).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNotNull(((PolicySetAttachPoint)composite).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+        
+        assertNotNull(composite.getServices().get(0).getRequiredIntents().get(0).getDescription());
+        assertFalse(composite.getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNotNull(composite.getServices().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+        assertNotNull(composite.getServices().get(0).getCallback().getRequiredIntents().get(0).getDescription());
+        assertFalse(composite.getServices().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNotNull(composite.getServices().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+        
+        assertNotNull(composite.getComponents().get(0).getRequiredIntents().get(0).getDescription());
+        assertFalse(composite.getComponents().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNotNull(composite.getComponents().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+        assertNotNull(composite.getComponents().get(0).getServices().get(0).getRequiredIntents().get(0).getDescription());
+        assertFalse(composite.getComponents().get(0).getServices().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNotNull(composite.getComponents().get(0).getServices().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+        assertNotNull(composite.getComponents().get(0).getReferences().get(0).getRequiredIntents().get(0).getDescription());
+        assertFalse(composite.getComponents().get(0).getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNotNull(composite.getComponents().get(0).getReferences().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+        
+        assertNotNull(composite.getReferences().get(0).getRequiredIntents().get(0).getDescription());
+        assertFalse(composite.getReferences().get(0).getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNotNull(composite.getReferences().get(0).getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+        assertNotNull(composite.getReferences().get(0).getCallback().getRequiredIntents().get(0).getDescription());
+        assertFalse(composite.getReferences().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().isEmpty());
+        assertNotNull(composite.getReferences().get(0).getCallback().getPolicySets().get(0).getProvidedIntents().get(1).getDescription());
+        
+        
+    }
+
+    public void testResolveComposite() throws Exception {
+        URL url = getClass().getResource("Calculator.composite");
+        URI uri = URI.create("Calculator.composite");
+        Composite nestedComposite = (Composite)documentProcessor.read(null, uri, url);
+        assertNotNull(nestedComposite);
+        resolver.addModel(nestedComposite);
+
+        url = getClass().getResource("TestAllCalculator.composite");
+        uri = URI.create("TestAllCalculator.composite");
+        Composite composite = (Composite)documentProcessor.read(null, uri, url);
+        
+        documentProcessor.resolve(composite, resolver);
+        
+        assertEquals(composite.getComponents().get(2).getImplementation(), nestedComposite);
+    }
+
+}

Added: incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.java (added)
+++ incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/ResolveTestCase.java Sat May  3 13:52:41 2008
@@ -0,0 +1,111 @@
+/*
+ * 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.assembly.xml;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test resolving SCA XML assemblies.
+ * 
+ * @version $Rev: 638855 $ $Date: 2008-03-19 08:04:32 -0700 (Wed, 19 Mar 2008) $
+ */
+public class ResolveTestCase extends TestCase {
+
+    private XMLInputFactory inputFactory;
+    private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+    private ExtensibleStAXArtifactProcessor staxProcessor;
+    private TestModelResolver resolver; 
+    private AssemblyFactory factory;
+    private PolicyFactory policyFactory;
+
+    @Override
+    public void setUp() throws Exception {
+        factory = new DefaultAssemblyFactory();
+        policyFactory = new DefaultPolicyFactory();
+        inputFactory = XMLInputFactory.newInstance();
+        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+        resolver = new TestModelResolver();
+    }
+
+    @Override
+    public void tearDown() throws Exception {
+    }
+
+    public void testResolveConstrainingType() throws Exception {
+        InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+        ConstrainingTypeProcessor constrainingTypeReader = new ConstrainingTypeProcessor(factory, policyFactory, staxProcessor);
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+        ConstrainingType constrainingType = constrainingTypeReader.read(reader);
+        is.close();
+        assertNotNull(constrainingType);
+        resolver.addModel(constrainingType);
+
+        is = getClass().getResourceAsStream("TestAllCalculator.composite");
+        CompositeProcessor compositeReader = new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor);
+        reader = inputFactory.createXMLStreamReader(is);
+        Composite composite = compositeReader.read(reader);
+        is.close();
+        assertNotNull(composite);
+        
+        compositeReader.resolve(composite, resolver);
+        
+        assertEquals(composite.getConstrainingType(), constrainingType);
+        assertEquals(composite.getComponents().get(0).getConstrainingType(), constrainingType);
+    }
+
+    public void testResolveComposite() throws Exception {
+        InputStream is = getClass().getResourceAsStream("Calculator.composite");
+        CompositeProcessor compositeReader = new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor);
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+        Composite nestedComposite = compositeReader.read(reader);
+        is.close();
+        assertNotNull(nestedComposite);
+        resolver.addModel(nestedComposite);
+
+        is = getClass().getResourceAsStream("TestAllCalculator.composite");
+        compositeReader = new CompositeProcessor(new DefaultContributionFactory(), factory, policyFactory, staxProcessor);
+        reader = inputFactory.createXMLStreamReader(is);
+        Composite composite = compositeReader.read(reader);
+        is.close();
+        
+        compositeReader.resolve(composite, resolver);
+        
+        assertEquals(composite.getComponents().get(2).getImplementation(), nestedComposite);
+    }
+
+}

Added: incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestModelResolver.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestModelResolver.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestModelResolver.java (added)
+++ incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestModelResolver.java Sat May  3 13:52:41 2008
@@ -0,0 +1,63 @@
+/*
+ * 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.assembly.xml;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
+
+
+/**
+ * A default implementation of an artifact resolver, based on a map.
+ *
+ * @version $Rev: 560306 $ $Date: 2007-07-27 09:31:44 -0700 (Fri, 27 Jul 2007) $
+ */
+public class TestModelResolver implements ModelResolver {
+    private static final long serialVersionUID = -7826976465762296634L;
+    
+    private Map<Object, Object> map = new HashMap<Object, Object>();
+    
+    public TestModelResolver() {
+    }
+
+    public <T> T resolveModel(Class<T> modelClass, T unresolved) {
+        Object resolved = map.get(unresolved);
+        if (resolved != null) {
+            
+            // Return the resolved object
+            return modelClass.cast(resolved);
+            
+        } else {
+            
+            // Return the unresolved object
+            return unresolved;
+        }
+    }
+    
+    public void addModel(Object resolved) {
+        map.put(resolved, resolved);
+    }
+    
+    public Object removeModel(Object resolved) {
+        return map.remove(resolved);
+    }
+    
+}

Added: incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingFactoryImpl.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingFactoryImpl.java (added)
+++ incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingFactoryImpl.java Sat May  3 13:52:41 2008
@@ -0,0 +1,35 @@
+/*
+ * 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.assembly.xml;
+
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+
+/**
+ * A factory for the SCA binding model.
+ * 
+ * @version $Rev: 563772 $ $Date: 2007-08-07 23:50:49 -0700 (Tue, 07 Aug 2007) $
+ */
+public class TestSCABindingFactoryImpl implements SCABindingFactory {
+    public SCABinding createSCABinding() {
+        return new TestSCABindingImpl();
+    }
+
+}

Added: incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java (added)
+++ incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/TestSCABindingImpl.java Sat May  3 13:52:41 2008
@@ -0,0 +1,213 @@
+/*
+ * 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.assembly.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.ConfiguredOperation;
+import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.assembly.SCABinding;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * A test cheel for the SCA binding.
+ * 
+ * @version $Rev: 620307 $ $Date: 2008-02-10 10:56:51 -0800 (Sun, 10 Feb 2008) $
+ */
+public class TestSCABindingImpl implements SCABinding, OptimizableBinding, PolicySetAttachPoint, OperationsConfigurator {
+    private String name;
+    private String uri;
+    private List<Object> extensions = new ArrayList<Object>();
+    
+    private Component targetComponent;
+    private ComponentService targetComponentService;
+    private Binding targetBinding;
+    
+    List<Intent> requiredIntents = new ArrayList<Intent>();
+    List<PolicySet> policySets = new ArrayList<PolicySet>();
+    IntentAttachPointType bindingType = new TestSCABindingType();
+    List<ConfiguredOperation>  configuredOperations = new ArrayList<ConfiguredOperation>();
+    private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+    /**
+     * Constructs a new SCA binding.
+     */
+    protected TestSCABindingImpl() {
+    }
+    
+    public String getName() {
+        return name;
+    }
+
+    public String getURI() {
+        return uri;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public void setURI(String uri) {
+        this.uri = uri;
+    }
+
+    public List<Object> getExtensions() {
+        return extensions;
+    }
+    
+    public boolean isUnresolved() {
+        return false;
+    }
+    
+    public void setUnresolved(boolean unresolved) {
+    }
+
+    /**
+     * @see java.lang.Object#clone()
+     */
+    @Override
+    public Object clone() throws CloneNotSupportedException {
+        return super.clone();
+    }
+
+    /**
+     * @return the targetComponent
+     */
+    public Component getTargetComponent() {
+        return targetComponent;
+    }
+
+    /**
+     * @param targetComponent the targetComponent to set
+     */
+    public void setTargetComponent(Component targetComponent) {
+        this.targetComponent = targetComponent;
+    }
+
+    /**
+     * @return the targetComponentService
+     */
+    public ComponentService getTargetComponentService() {
+        return targetComponentService;
+    }
+
+    /**
+     * @param targetComponentService the targetComponentService to set
+     */
+    public void setTargetComponentService(ComponentService targetComponentService) {
+        this.targetComponentService = targetComponentService;
+    }
+
+    /**
+     * @return the targetBinding
+     */
+    public Binding getTargetBinding() {
+        return targetBinding;
+    }
+
+    /**
+     * @param targetBinding the targetBinding to set
+     */
+    public void setTargetBinding(Binding targetBinding) {
+        this.targetBinding = targetBinding;
+    }
+    
+    public List<PolicySet> getPolicySets() {
+        // TODO Auto-generated method stub
+        return policySets;
+    }
+
+    public List<Intent> getRequiredIntents() {
+        // TODO Auto-generated method stub
+        return requiredIntents;
+    }
+
+    public IntentAttachPointType getType() {
+        // TODO Auto-generated method stub
+        return bindingType;
+    }
+
+    public void setType(IntentAttachPointType type) {
+        this.bindingType = type;
+    }
+    
+    private class TestSCABindingType implements IntentAttachPointType {
+        private QName name = new QName("http://www.osoa.org/xmlns/sca/1.0","binding");
+
+        public List<Intent> getAlwaysProvidedIntents() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public List<Intent> getMayProvideIntents() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
+        public QName getName() {
+            return name;
+        }
+
+        public boolean isUnresolved() {
+            // TODO Auto-generated method stub
+            return false;
+        }
+
+        public void setName(QName type) {
+            // TODO Auto-generated method stub
+            
+        }
+
+        public void setUnresolved(boolean unresolved) {
+            // TODO Auto-generated method stub
+            
+        }
+        
+    }
+    
+    public void setPolicySets(List<PolicySet> policySets) {
+        this.policySets = policySets; 
+    }
+
+    public void setRequiredIntents(List<Intent> intents) {
+        this.requiredIntents = intents;
+    }
+    
+    public List<ConfiguredOperation> getConfiguredOperations() {
+        return configuredOperations;
+    }
+
+    public void setConfiguredOperations(List<ConfiguredOperation> configuredOperations) {
+        this.configuredOperations = configuredOperations;
+    }
+
+    public List<PolicySet> getApplicablePolicySets() {
+        return applicablePolicySets;
+    }
+}

Added: incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java (added)
+++ incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WireTestCase.java Sat May  3 13:52:41 2008
@@ -0,0 +1,146 @@
+/*
+ * 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.assembly.xml;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.definitions.xml.SCADefinitionsDocumentProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test the wiring of SCA XML assemblies.
+ * 
+ * @version $Rev: 637129 $ $Date: 2008-03-14 08:11:59 -0700 (Fri, 14 Mar 2008) $
+ */
+public class WireTestCase extends TestCase {
+
+    private XMLInputFactory inputFactory;
+    private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+    private ExtensibleStAXArtifactProcessor staxProcessor; 
+    private TestModelResolver resolver; 
+    private AssemblyFactory assemblyFactory;
+    private SCABindingFactory scaBindingFactory;
+    private PolicyFactory policyFactory;
+    private InterfaceContractMapper mapper;
+    private SCADefinitionsDocumentProcessor scaDefnDocProcessor;
+
+    @Override
+    public void setUp() throws Exception {
+        inputFactory = XMLInputFactory.newInstance();
+        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+        resolver = new TestModelResolver();
+        assemblyFactory = new DefaultAssemblyFactory();
+        scaBindingFactory = new TestSCABindingFactoryImpl();
+        policyFactory = new DefaultPolicyFactory();
+        mapper = new InterfaceContractMapperImpl();
+        
+        scaDefnDocProcessor = new SCADefinitionsDocumentProcessor(staxProcessors, staxProcessor, inputFactory, policyFactory);
+        
+    }
+
+    @Override
+    public void tearDown() throws Exception {
+    }
+
+    public void testResolveConstrainingType() throws Exception {
+        InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+        ConstrainingTypeProcessor constrainingTypeReader = new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor);
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+        ConstrainingType constrainingType = constrainingTypeReader.read(reader);
+        is.close();
+        assertNotNull(constrainingType);
+        resolver.addModel(constrainingType);
+
+        is = getClass().getResourceAsStream("TestAllCalculator.composite");
+        CompositeProcessor compositeReader = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+        reader = inputFactory.createXMLStreamReader(is);
+        Composite composite = compositeReader.read(reader);
+        is.close();
+        assertNotNull(composite);
+        
+        URL url = getClass().getResource("test_definitions.xml");
+        URI uri = URI.create("test_definitions.xml");
+        SCADefinitions scaDefns = (SCADefinitions)scaDefnDocProcessor.read(null, uri, url);
+        assertNotNull(scaDefns);
+        
+        scaDefnDocProcessor.resolve(scaDefns, resolver);
+        
+        compositeReader.resolve(composite, resolver);
+        CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
+        compositeUtil.build(composite);
+        
+        assertEquals(composite.getConstrainingType(), constrainingType);
+        assertEquals(composite.getComponents().get(0).getConstrainingType(), constrainingType);
+    }
+
+    public void testResolveComposite() throws Exception {
+        InputStream is = getClass().getResourceAsStream("Calculator.composite");
+        CompositeProcessor compositeReader = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+        Composite nestedComposite = compositeReader.read(reader);
+        is.close();
+        assertNotNull(nestedComposite);
+        resolver.addModel(nestedComposite);
+
+        is = getClass().getResourceAsStream("TestAllCalculator.composite");
+        compositeReader = new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor);
+        reader = inputFactory.createXMLStreamReader(is);
+        Composite composite = compositeReader.read(reader);
+        is.close();
+        
+        URL url = getClass().getResource("test_definitions.xml");
+        URI uri = URI.create("test_definitions.xml");
+        SCADefinitions scaDefns = (SCADefinitions)scaDefnDocProcessor.read(null, uri, url);
+        assertNotNull(scaDefns);
+        
+        scaDefnDocProcessor.resolve(scaDefns, resolver);
+        
+        compositeReader.resolve(composite, resolver);
+        CompositeBuilderImpl compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
+        compositeUtil.build(composite);
+        
+        assertEquals(composite.getComponents().get(2).getImplementation(), nestedComposite);
+    }
+
+}

Added: incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java (added)
+++ incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/java/org/apache/tuscany/sca/assembly/xml/WriteAllTestCase.java Sat May  3 13:52:41 2008
@@ -0,0 +1,148 @@
+/*
+ * 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.assembly.xml;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.ComponentType;
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
+import org.apache.tuscany.sca.assembly.SCABindingFactory;
+import org.apache.tuscany.sca.assembly.builder.impl.CompositeBuilderImpl;
+import org.apache.tuscany.sca.contribution.DefaultContributionFactory;
+import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.definitions.xml.SCADefinitionsDocumentProcessor;
+import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl;
+import org.apache.tuscany.sca.policy.DefaultIntentAttachPointTypeFactory;
+import org.apache.tuscany.sca.policy.DefaultPolicyFactory;
+import org.apache.tuscany.sca.policy.PolicyFactory;
+
+/**
+ * Test writing SCA XML assemblies.
+ * 
+ * @version $Rev: 637129 $ $Date: 2008-03-14 08:11:59 -0700 (Fri, 14 Mar 2008) $
+ */
+public class WriteAllTestCase extends TestCase {
+    private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
+    private ExtensibleStAXArtifactProcessor staxProcessor;
+    private TestModelResolver resolver; 
+    private AssemblyFactory assemblyFactory;
+    private SCABindingFactory scaBindingFactory;
+    private PolicyFactory policyFactory;
+    private InterfaceContractMapper mapper;
+    private CompositeBuilderImpl compositeUtil;
+    private SCADefinitionsDocumentProcessor scaDefnDocProcessor;
+
+
+    @Override
+    public void setUp() throws Exception {
+        assemblyFactory = new DefaultAssemblyFactory();
+        scaBindingFactory = new TestSCABindingFactoryImpl();
+        policyFactory = new DefaultPolicyFactory();
+        mapper = new InterfaceContractMapperImpl();
+        compositeUtil = new CompositeBuilderImpl(assemblyFactory, scaBindingFactory, new DefaultIntentAttachPointTypeFactory(), mapper, null);
+        staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(new DefaultModelFactoryExtensionPoint());
+        staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, XMLInputFactory.newInstance(), XMLOutputFactory.newInstance());
+        staxProcessors.addArtifactProcessor(new CompositeProcessor(new DefaultContributionFactory(), assemblyFactory, policyFactory, staxProcessor));
+        staxProcessors.addArtifactProcessor(new ComponentTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
+        staxProcessors.addArtifactProcessor(new ConstrainingTypeProcessor(assemblyFactory, policyFactory, staxProcessor));
+        resolver = new TestModelResolver();
+        scaDefnDocProcessor = new SCADefinitionsDocumentProcessor(staxProcessors, staxProcessor, XMLInputFactory.newInstance(), policyFactory);
+    }
+
+    @Override
+    public void tearDown() throws Exception {
+    }
+
+    public void testReadWriteComposite() throws Exception {
+        InputStream is = getClass().getResourceAsStream("TestAllCalculator.composite");
+        Composite composite = staxProcessor.read(is, Composite.class);
+        
+        verifyComposite(composite);
+        
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        staxProcessor.write(composite, bos);
+        bos.close();
+        
+        ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
+        composite = staxProcessor.read(bis, Composite.class);
+        
+        verifyComposite(composite);
+        
+    }
+
+    public void testReadWireWriteComposite() throws Exception {
+        InputStream is = getClass().getResourceAsStream("TestAllCalculator.composite");
+        Composite composite = staxProcessor.read(is, Composite.class);
+        
+        URL url = getClass().getResource("test_definitions.xml");
+        URI uri = URI.create("test_definitions.xml");
+        SCADefinitions scaDefns = (SCADefinitions)scaDefnDocProcessor.read(null, uri, url);
+        assertNotNull(scaDefns);
+        scaDefnDocProcessor.resolve(scaDefns, resolver);
+        
+        staxProcessor.resolve(composite, resolver);
+        compositeUtil.build(composite);
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        staxProcessor.write(composite, bos);
+    }
+    
+    public void testReadWriteComponentType() throws Exception {
+        InputStream is = getClass().getResourceAsStream("CalculatorImpl.componentType");
+        ComponentType componentType = staxProcessor.read(is, ComponentType.class);
+        staxProcessor.resolve(componentType, resolver);
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        staxProcessor.write(componentType, bos);
+    }
+
+    public void testReadWriteConstrainingType() throws Exception {
+        InputStream is = getClass().getResourceAsStream("CalculatorComponent.constrainingType");
+        ConstrainingType constrainingType = staxProcessor.read(is, ConstrainingType.class);
+        staxProcessor.resolve(constrainingType, resolver);
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        staxProcessor.write(constrainingType, bos);
+    }
+    
+    private void verifyComposite(Composite composite) {
+        assertEquals(composite.getProperties().get(0).getName(),"prop1");
+        assertEquals(composite.getProperties().get(0).isMany(), true);
+        assertEquals(composite.getProperties().get(1).getName(),"prop2");
+        assertEquals(composite.getProperties().get(1).isMustSupply(), true);
+        assertEquals(composite.getProperties().get(0).getXSDType(), new QName("http://foo", "MyComplexType"));
+        assertEquals(composite.getProperties().get(1).getXSDElement(), new QName("http://www.osoa.org/xmlns/sca/1.0", "MyComplexPropertyValue1"));
+    }
+
+}

Added: incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite (added)
+++ incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/Calculator.composite Sat May  3 13:52:41 2008
@@ -0,0 +1,53 @@
+<?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"
+	xmlns:calc="http://calc"
+	targetNamespace="http://calc"
+	name="Calculator">
+
+    <service name="CalculatorService" promote="CalculatorServiceComponent">
+        <interface.java interface="calculator.CalculatorService"/>
+    </service>
+
+    <component name="CalculatorServiceComponent">
+		<implementation.java class="calculator.CalculatorServiceImpl"/>
+        <reference name="addService" target="AddServiceComponent"/>
+        <reference name="subtractService" target="SubtractServiceComponent"/>
+        <reference name="multiplyService" target="MultiplyServiceComponent"/>
+        <reference name="divideService" target="DivideServiceComponent"/>
+    </component>
+
+    <component name="AddServiceComponent">
+        <implementation.java class="calculator.AddServiceImpl"/>
+    </component>
+
+    <component name="SubtractServiceComponent">
+        <implementation.java class="calculator.SubtractServiceImpl"/>
+    </component>
+
+    <component name="MultiplyServiceComponent">
+        <implementation.java class="calculator.MultiplyServiceImpl"/>
+    </component>
+
+    <component name="DivideServiceComponent">
+        <implementation.java class="calculator.DivideServiceImpl"/>
+    </component>
+
+</composite>

Added: incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType (added)
+++ incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorComponent.constrainingType Sat May  3 13:52:41 2008
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+<constrainingType xmlns="http://www.osoa.org/xmlns/sca/1.0"
+	xmlns:calc="http://calc"
+	targetNamespace="http://calc"
+	name="CalculatorComponent">
+
+  <service name="CalculatorService">
+        <interface.java class="calculator.CalculatorService" />
+  </service>
+
+  <reference name="divideService">
+        <interface.java class="calculator.DivideService" />
+  </reference>  
+
+</constrainingType>              
+       
\ No newline at end of file

Added: incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType (added)
+++ incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/CalculatorImpl.componentType Sat May  3 13:52:41 2008
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.
+-->
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0">
+
+  <service name="CalculatorService">
+        <interface.java class="calculator.CalculatorService" />
+  </service>
+
+  <reference name="divideService">
+        <interface.java class="calculator.DivideService" />
+  </reference>  
+
+</componentType>              
+       
\ No newline at end of file

Added: incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/JavaScriptReference.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/JavaScriptReference.composite?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/JavaScriptReference.composite (added)
+++ incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/JavaScriptReference.composite Sat May  3 13:52:41 2008
@@ -0,0 +1,37 @@
+<?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"
+           xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+           name="JavaScriptReference">
+
+    <component name="ClientComponent">
+        <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.helloworld.HelloWorldProxy"/>
+    </component>
+
+    <component name="ReferenceComponent">
+        <tuscany:implementation.script script="org/apache/tuscany/sca/implementation/script/itests/references/reference.js"/>
+        <reference name="ref" target="TargetComponent" />
+    </component>
+
+    <component name="TargetComponent">
+        <implementation.java class="org.apache.tuscany.sca.implementation.script.itests.references.HelloWorldTarget"/>
+    </component>
+
+</composite>

Added: incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/RMIBindingTest.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/RMIBindingTest.composite?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/RMIBindingTest.composite (added)
+++ incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/RMIBindingTest.composite Sat May  3 13:52:41 2008
@@ -0,0 +1,43 @@
+<?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"
+	       xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
+           name="HelloWorldRmiComposite">
+
+	<service name="HelloWorldRmiService" promote="HelloWorldServiceComponent">
+        <interface.java interface="helloworld.HelloWorldService"/>
+        <tuscany:binding.rmi host="localhost" port="8099" serviceName="HelloWorldRemoteService"   />
+    </service>
+      
+    <component name="HelloWorldServiceComponent">
+        <implementation.java class="helloworld.HelloWorldImpl"/>
+    </component>   
+  
+   <component name="HelloWorldRmiServiceComponent">
+        <implementation.java class="helloworld.HelloWorldRmiImpl"/>
+        <reference name="extService"></reference>
+    </component>        
+           
+  	<reference name="HelloWorldRmiReference" promote="HelloWorldRmiServiceComponent/extService">
+        <interface.java interface="helloworld.HelloWorldService"/>
+        <tuscany:binding.rmi host="localhost" port="8099" serviceName="HelloWorldRemoteService"   />
+    </reference>
+
+</composite>

Added: incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllCalculator.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllCalculator.composite?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllCalculator.composite (added)
+++ incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllCalculator.composite Sat May  3 13:52:41 2008
@@ -0,0 +1,128 @@
+<?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 autowire="false" constrainingType="tns:CalculatorComponent" local="true" name="TestAllCalculator" policySets="sns:SecureReliablePolicy"
+    requires="cns:confidentiality" targetNamespace="http://calc" xmlns:tns="http://calc"
+    xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://www.osoa.org/xmlns/sca/1.0 http://www.osoa.org/xmlns/sca/1.0 "
+    xmlns:ext="http://extension"
+    xmlns:cns="http://test" xmlns:sns="http://test">
+
+    <include name="tns:TestAllDivide"/>
+    <ext:testExtension/>
+
+    <service name="CalculatorService" promote="CalculatorServiceComponent/CalculatorService" requires="cns:confidentiality"
+        policySets="sns:SecureReliablePolicy">
+        <ext:testExtension/>
+        <interface.java interface="calculator.CalculatorService" callbackInterface="calculator.CalculatorCallback" />
+        <operation name="add" policySets="sns:SecureReliablePolicy" requires="cns:confidentiality" />
+
+        <binding.ws name="CalculatorWS" policySets="sns:SecureReliablePolicy" port="" requires="cns:confidentiality" uri="http://calc/ws">
+            <operation name="add" policySets="sns:SecureReliablePolicy" requires="cns:confidentiality" />
+        </binding.ws>
+
+        <callback policySets="sns:SecureReliablePolicy" requires="cns:confidentiality">
+	        <ext:testExtension/>
+            <binding.ws name="CalculatorCallbackWS" policySets="" port="" requires="" uri="http://calc/callback/ws">
+                <operation name="addCallback" policySets="sns:SecureReliablePolicy" requires="cns:confidentiality" />
+            </binding.ws>
+        </callback>
+    </service>
+
+    <component name="CalculatorServiceComponent" autowire="false" constrainingType="tns:CalculatorComponent"
+        policySets="sns:SecureReliablePolicy" requires="cns:confidentiality">
+        <ext:testExtension/>
+        <service name="CalculatorService" policySets="sns:SecureReliablePolicy" requires="cns:confidentiality">
+            <interface.java interface="calculator.CalculatorService" callbackInterface="calculator.CalculatorCallback" />
+        </service>
+
+        <reference name="addService" target="AddServiceComponent/AddService" autowire="false" multiplicity="1..1"
+            policySets="sns:SecureReliablePolicy" requires="cns:confidentiality" wiredByImpl="false">
+            <ext:testExtension/>
+            <interface.java interface="calculator.AddService" callbackInterface="calculator.AddCallback" />
+        </reference>
+        <reference name="subtractService" target="SubtractServiceComponent" />
+        <reference name="multiplyService" />
+        <reference name="divideService" target="DivideServiceComponent" />
+
+        <property name="round" type="xsd:boolean" many="false">true</property>
+
+        <implementation.java class="calculator.CalculatorServiceImpl" policySets="" requires="" />
+    </component>
+
+    <component name="AddServiceComponent">
+        <service name="AddService">
+            <interface.java interface="calculator.AddService" />
+        </service>
+        <implementation.java class="calculator.AddServiceImpl" />
+    </component>
+
+    <component name="NestedCompositeComponent">
+        <service name="CalculatorService">
+            <interface.java interface="calculator.CalculatorService" />
+        </service>
+        <implementation.composite name="tns:Calculator" />
+    </component>
+
+    <component name="SubtractServiceComponent">
+        <implementation.java class="calculator.SubtractServiceImpl" />
+    </component>
+
+    <component name="MultiplyServiceComponent">
+        <implementation.java class="calculator.MultiplyServiceImpl" />
+    </component>
+
+    <component name="DivideServiceComponent">
+        <implementation.java class="calculator.DivideServiceImpl" />
+    </component>
+
+    <reference name="MultiplyService" promote="CalculatorServiceComponent/multiplyService" policySets="sns:SecureReliablePolicy"
+        requires="cns:confidentiality">
+        <interface.java interface="calculator.MultiplyService" callbackInterface="calculator.MultiplyCallback" />
+        <operation name="multiply" policySets="sns:SecureReliablePolicy" requires="cns:confidentiality" />
+
+        <binding.ws name="MultiplyWS" port="" policySets="sns:SecureReliablePolicy" requires="cns:confidentiality" uri="http://calc/ws">
+            <operation name="multiply" policySets="sns:SecureReliablePolicy" requires="cns:confidentiality" />
+        </binding.ws>
+
+        <callback policySets="sns:SecureReliablePolicy" requires="cns:confidentiality">
+            <binding.ws name="MultiplyCallbackWS" port="" uri="http://calc/callback/ws" policySets="sns:SecureReliablePolicy"
+                requires="cns:confidentiality">
+                <operation name="multiplyCallback" policySets="sns:SecureReliablePolicy" requires="cns:confidentiality" />
+            </binding.ws>
+        </callback>
+    </reference> 
+
+    <property name="prop1" xmlns:foo="http://foo" many="true" type="foo:MyComplexType">
+    	<ext:testExtension/>
+   	    <MyComplexPropertyValue1 xsi:type="foo:MyComplexType" attr="bar">
+            <foo:a>AValue</foo:a>
+            <bar:b xmlns:bar="http://bar">InterestingURI</bar:b>
+        </MyComplexPropertyValue1>
+        <MyComplexPropertyValue2 xsi:type="foo:MyComplexType" attr="zing">
+            <foo:a>BValue</foo:a>
+            <bar:b xmlns:bar="http://bar">BoringURI</bar:b>
+        </MyComplexPropertyValue2>
+    </property>
+    
+    <property name="prop2" xmlns:foo="http://foo" mustSupply="true" element="MyComplexPropertyValue1"/>
+
+</composite>

Added: incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllDivide.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllDivide.composite?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllDivide.composite (added)
+++ incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllDivide.composite Sat May  3 13:52:41 2008
@@ -0,0 +1,56 @@
+<?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 autowire="false"
+	constrainingType="tns:Calculator"
+	local="true"
+	name="TestAllDivide"
+	policySets="" requires=""
+	targetNamespace="http://calc"
+	xmlns:tns="http://calc"
+	xmlns="http://www.osoa.org/xmlns/sca/1.0"
+	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.osoa.org/xmlns/sca/1.0 http://www.osoa.org/xmlns/sca/1.0 ">
+	
+  <include name="tns:CompleteDivide"/>
+  
+  <service name="DivideService" policySets="" promote="CalculatorDivideComponent/DivideService" requires="">
+    <interface.java interface="calculator.DivideService" callbackInterface="calculator.DivideCallback"/>
+    <operation name="divide" policySets="" requires=""/>
+
+    <binding.ws name="CalculatorWS" policySets="" port="" requires="" uri="http://calc/ws">
+      <operation name="divide" policySets="" requires=""/>
+    </binding.ws>
+
+    <callback policySets="" requires="">
+      <binding.ws name="CalculatorCallbackWS" policySets="" port="" requires="" uri="http://calc/callback/ws">
+        <operation name="divideCallback" policySets="" requires=""/>
+      </binding.ws>
+    </callback>
+  </service>
+  
+   <component name="CalculatorDivideComponent" autowire="false" constrainingType="tns:CalculatorServiceComponent" policySets="" requires="">
+   		<service name="DivideService" policySets="" requires="">
+   			<interface.java interface="calculator.DivideService" callbackInterface="calculator.DivideCallback"/>
+   		</service>
+		<implementation.java class="calculator.DivideImpl" policySets="" requires=""/>
+   </component>
+
+</composite>

Added: incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllPolicyCalculator.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllPolicyCalculator.composite?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllPolicyCalculator.composite (added)
+++ incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/TestAllPolicyCalculator.composite Sat May  3 13:52:41 2008
@@ -0,0 +1,129 @@
+<?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 autowire="false" constrainingType="tns:CalculatorComponent" local="true" name="TestAllCalculator" 
+    requires="cns:tuscanyIntent_1" targetNamespace="http://calc" xmlns:tns="http://calc"
+    xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://www.osoa.org/xmlns/sca/1.0 http://www.osoa.org/xmlns/sca/1.0 "
+    xmlns:ext="http://extension"
+    xmlns:cns="http://test" xmlns:sns="http://test">
+
+    <include name="tns:TestAllDivide"/>
+    <ext:testExtension/>
+
+    <service name="CalculatorService" promote="CalculatorServiceComponent/CalculatorService" requires="cns:tuscanyIntent_2 cns:tuscanyIntent_1">
+        <ext:testExtension/>
+        <interface.java interface="calculator.CalculatorService" callbackInterface="calculator.CalculatorCallback" />
+        <operation name="add" requires="cns:tuscanyIntent_6"/>
+
+        <binding.ws name="CalculatorWS" port="" requires="cns:tuscanyIntent_3" uri="http://calc/ws">
+        </binding.ws>
+
+        <callback requires="cns:tuscanyIntent_4">
+	        <ext:testExtension/>
+            <binding.ws name="CalculatorCallbackWS" policySets="" port="" requires="cns:tuscanyIntent_5" uri="http://calc/callback/ws">
+            </binding.ws>
+        </callback>
+    </service>
+
+    <component name="CalculatorServiceComponent" autowire="false" constrainingType="tns:CalculatorComponent"
+        requires="cns:tuscanyIntent_2 cns:tuscanyIntent_3">
+        <ext:testExtension/>
+        <service name="CalculatorService" requires="cns:tuscanyIntent_3">
+            <interface.java interface="calculator.CalculatorService" callbackInterface="calculator.CalculatorCallback" />
+            <operation name="add" requires="cns:tuscanyIntent_6 cns:tuscanyIntent_7"/>
+            <binding.ws name="CalculatorCallbackWS" policySets="" port="" requires="cns:tuscanyIntent_4" uri="http://calc/callback/ws">
+            </binding.ws>
+            <callback>
+           	</callback>
+        </service>
+
+        <reference name="addService" target="AddServiceComponent/AddService" autowire="false" multiplicity="1..1"
+            requires="cns:tuscanyIntent_3 cns:tuscanyIntent_2.qualified" wiredByImpl="false">
+            <ext:testExtension/>
+            <interface.java interface="calculator.AddService" callbackInterface="calculator.AddCallback" />
+            <operation name="add" requires="cns:tuscanyIntent_8 cns:tuscanyIntent_9"/>
+            <binding.ws name="addServiceWSRef" policySets="" port="" requires="cns:tuscanyIntent_4" uri="http://calc/callback/ws">
+            </binding.ws>
+        </reference>
+        <reference name="subtractService" target="SubtractServiceComponent" />
+        <reference name="multiplyService" />
+        <reference name="divideService" target="DivideServiceComponent" />
+
+        <property name="round" type="xsd:boolean" many="false">true</property>
+
+        <implementation.java class="calculator.CalculatorServiceImpl" policySets="" requires="cns:tuscanyIntent_4" />
+    </component>
+
+    <component name="AddServiceComponent">
+        <service name="AddService">
+            <interface.java interface="calculator.AddService" />
+        </service>
+        <implementation.java class="calculator.AddServiceImpl" />
+    </component>
+
+    <component name="NestedCompositeComponent">
+        <service name="CalculatorService">
+            <interface.java interface="calculator.CalculatorService" />
+        </service>
+        <implementation.composite name="tns:Calculator" />
+    </component>
+
+    <component name="SubtractServiceComponent">
+        <implementation.java class="calculator.SubtractServiceImpl" />
+    </component>
+
+    <component name="MultiplyServiceComponent">
+        <implementation.java class="calculator.MultiplyServiceImpl" />
+    </component>
+
+    <component name="DivideServiceComponent">
+        <implementation.java class="calculator.DivideServiceImpl" />
+    </component>
+
+    <reference name="MultiplyService" promote="CalculatorServiceComponent/multiplyService" 
+        requires="cns:tuscanyIntent_2">
+        <interface.java interface="calculator.MultiplyService" callbackInterface="calculator.MultiplyCallback" />
+        <operation name="multiply" requires="cns:tuscanyIntent_6"/>
+
+        <binding.ws name="MultiplyWS" port="" requires="cns:tuscanyIntent_3" uri="http://calc/ws">
+        </binding.ws>
+
+        <callback policySets="sns:SecureReliablePolicy" requires="cns:tuscanyIntent_3">
+            <binding.ws name="MultiplyCallbackWS" port="" uri="http://calc/callback/ws" 
+                requires="cns:tuscanyIntent_4">
+            </binding.ws>
+        </callback>
+    </reference>
+
+    <property name="prop1" xmlns:foo="http://foo">
+    	<ext:testExtension/>
+   	    <MyComplexPropertyValue1 xsi:type="foo:MyComplexType" attr="bar">
+            <foo:a>AValue</foo:a>
+            <bar:b xmlns:bar="http://bar">InterestingURI</bar:b>
+        </MyComplexPropertyValue1>
+        <MyComplexPropertyValue2 xsi:type="foo:MyComplexType" attr="zing">
+            <foo:a>BValue</foo:a>
+            <bar:b xmlns:bar="http://bar">BoringURI</bar:b>
+        </MyComplexPropertyValue2>
+    </property>
+
+</composite>

Added: incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/another_test_definitions.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/another_test_definitions.xml?rev=653133&view=auto
==============================================================================
--- incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/another_test_definitions.xml (added)
+++ incubator/tuscany/sandbox/mobile-android/tuscany-assembly-xml/src/test/resources/org/apache/tuscany/sca/assembly/xml/another_test_definitions.xml Sat May  3 13:52:41 2008
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * 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.    
+-->
+<sca:definitions xmlns="http://test"
+ 			targetNamespace="http://test"
+ 			xmlns:sca="http://www.osoa.org/xmlns/sca/1.0">
+
+<!-- simple intent -->
+ <sca:intent name="tuscanyIntent_1" 
+ 			 constrains="sca:binding">
+ 			 <sca:description>
+ 			 Sample Intent
+ 			 </sca:description>
+ </sca:intent>
+ 
+ <sca:intent name="tuscanyIntent_2" 
+ 			 constrains="sca:binding">
+ 			 <sca:description>
+ 			 Sample Intent
+ 			 </sca:description>
+ </sca:intent>
+ 
+ <sca:intent name="tuscanyIntent_3" 
+ 			 constrains="sca:binding">
+ 			 <sca:description>
+ 			 Sample Intent
+ 			 </sca:description>
+ </sca:intent>
+ 
+ <sca:intent name="tuscanyIntent_4" 
+ 			 constrains="sca:binding">
+ 			 <sca:description>
+ 			 Sample Intent
+ 			 </sca:description>
+ </sca:intent>
+ 
+<sca:intent name="tuscanyIntent_5" 
+ 			 constrains="sca:binding">
+ 			 <sca:description>
+ 			 Sample Intent
+ 			 </sca:description>
+ </sca:intent>
+ 
+ <sca:intent name="tuscanyIntent_6" 
+ 			 constrains="sca:binding">
+ 			 <sca:description>
+ 			 Sample Intent
+ 			 </sca:description>
+ </sca:intent>
+ 
+ <sca:intent name="tuscanyIntent_7" 
+ 			 constrains="sca:binding">
+ 			 <sca:description>
+ 			 Sample Intent
+ 			 </sca:description>
+ </sca:intent>
+ 
+ <sca:intent name="tuscanyIntent_8" 
+ 			 constrains="sca:binding">
+ 			 <sca:description>
+ 			 Sample Intent
+ 			 </sca:description>
+ </sca:intent>
+ 
+ <sca:intent name="tuscanyIntent_9" 
+ 			 constrains="sca:binding">
+ 			 <sca:description>
+ 			 Sample Intent
+ 			 </sca:description>
+ </sca:intent>
+ 
+ <sca:intent name="tuscanyIntent_10" 
+ 			 constrains="sca:binding">
+ 			 <sca:description>
+ 			 Sample Intent
+ 			 </sca:description>
+ </sca:intent>
+  <!-- qualified intents -->
+ <sca:intent name="tuscanyIntent_1.qualified" />
+ <sca:intent name="tuscanyIntent_2.qualified" />
+</sca:definitions>
\ No newline at end of file



Mime
View raw message