You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2007/03/31 08:48:57 UTC

svn commit: r524377 [2/2] - in /incubator/tuscany/java/sca/scdl4j/stax: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/tuscany/ src/main/java/org/apache/tuscany/scdl/ src/main/java/org/apache/tusc...

Added: incubator/tuscany/java/sca/scdl4j/stax/src/main/java/org/apache/tuscany/scdl/stax/impl/LoaderRegistryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/scdl4j/stax/src/main/java/org/apache/tuscany/scdl/stax/impl/LoaderRegistryImpl.java?view=auto&rev=524377
==============================================================================
--- incubator/tuscany/java/sca/scdl4j/stax/src/main/java/org/apache/tuscany/scdl/stax/impl/LoaderRegistryImpl.java (added)
+++ incubator/tuscany/java/sca/scdl4j/stax/src/main/java/org/apache/tuscany/scdl/stax/impl/LoaderRegistryImpl.java Fri Mar 30 23:48:55 2007
@@ -0,0 +1,117 @@
+/*
+ * 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.scdl.stax.impl;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.tuscany.assembly.model.Base;
+import org.apache.tuscany.scdl.stax.InvalidConfigurationException;
+import org.apache.tuscany.scdl.stax.Loader;
+import org.apache.tuscany.scdl.stax.LoaderException;
+import org.apache.tuscany.scdl.stax.LoaderRegistry;
+import org.apache.tuscany.scdl.stax.UnrecognizedElementException;
+
+/**
+ * The default implementation of a loader registry
+ * 
+ * @version $Rev$ $Date$
+ */
+public class LoaderRegistryImpl implements LoaderRegistry {
+    private final Map<QName, Loader> loaders = new HashMap<QName, Loader>();
+
+    public LoaderRegistryImpl() {
+    }
+
+    public Base load(Base object, XMLStreamReader reader) throws XMLStreamException {
+        QName name = reader.getName();
+        Loader loader = loaders.get(name);
+        if (loader == null) {
+            // FIXME:
+            // throw new IllegalArgumentException(name.toString());
+            return null;
+        }
+        return (Base) loader.load(object, reader);
+    }
+
+    public <MO extends Base> MO load(Base object, URL url, Class<MO> type) throws LoaderException {
+        try {
+            XMLStreamReader reader;
+            InputStream is;
+            is = url.openStream();
+            try {
+                XMLInputFactory factory = XMLInputFactory.newInstance();
+                reader = factory.createXMLStreamReader(is);
+                try {
+                    reader.nextTag();
+                    QName name = reader.getName();
+                    Base mo = load(object, reader);
+                    if (type.isInstance(mo)) {
+                        return type.cast(mo);
+                    } else {
+                        UnrecognizedElementException e = new UnrecognizedElementException(name);
+                        e.setResourceURI(url.toString());
+                        throw e;
+                    }
+                } catch (LoaderException e) {
+                    Location location = reader.getLocation();
+                    e.setLine(location.getLineNumber());
+                    e.setColumn(location.getColumnNumber());
+                    throw e;
+                } finally {
+                    try {
+                        reader.close();
+                    } catch (XMLStreamException e) {
+                        // ignore
+                    }
+                }
+            } finally {
+                try {
+                    is.close();
+                } catch (IOException e) {
+                    // ignore
+                }
+            }
+        } catch (IOException e) {
+            LoaderException sfe = new LoaderException(e);
+            sfe.setResourceURI(url.toString());
+            throw sfe;
+        } catch (XMLStreamException e) {
+            throw new InvalidConfigurationException("Invalid or missing resource", url.toString(), e);
+        }
+    }
+
+    public void addLoader(QName element, Loader loader) {
+        loaders.put(element, loader);
+    }
+
+    public Loader getLoader(QName element) {
+        return loaders.get(element);
+    }
+
+}

Propchange: incubator/tuscany/java/sca/scdl4j/stax/src/main/java/org/apache/tuscany/scdl/stax/impl/LoaderRegistryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/scdl4j/stax/src/main/java/org/apache/tuscany/scdl/stax/impl/LoaderRegistryImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/scdl4j/stax/src/test/java/org/apache/tuscany/scdl/stax/impl/ReadAllTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/scdl4j/stax/src/test/java/org/apache/tuscany/scdl/stax/impl/ReadAllTestCase.java?view=auto&rev=524377
==============================================================================
--- incubator/tuscany/java/sca/scdl4j/stax/src/test/java/org/apache/tuscany/scdl/stax/impl/ReadAllTestCase.java (added)
+++ incubator/tuscany/java/sca/scdl4j/stax/src/test/java/org/apache/tuscany/scdl/stax/impl/ReadAllTestCase.java Fri Mar 30 23:48:55 2007
@@ -0,0 +1,186 @@
+/*
+ * 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.scdl.stax.impl;
+
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.assembly.model.AssemblyFactory;
+import org.apache.tuscany.assembly.model.Callback;
+import org.apache.tuscany.assembly.model.Component;
+import org.apache.tuscany.assembly.model.ComponentReference;
+import org.apache.tuscany.assembly.model.ComponentService;
+import org.apache.tuscany.assembly.model.Composite;
+import org.apache.tuscany.assembly.model.CompositeReference;
+import org.apache.tuscany.assembly.model.CompositeService;
+import org.apache.tuscany.assembly.model.Multiplicity;
+import org.apache.tuscany.assembly.model.Property;
+import org.apache.tuscany.assembly.model.impl.DefaultAssemblyFactory;
+import org.apache.tuscany.assembly.util.CompositeUtil;
+import org.apache.tuscany.assembly.util.PrintUtil;
+import org.apache.tuscany.policy.model.PolicyFactory;
+import org.apache.tuscany.policy.model.impl.DefaultPolicyFactory;
+import org.apache.tuscany.scdl.stax.LoaderRegistry;
+import org.apache.tuscany.scdl.stax.impl.CompositeLoader;
+import org.apache.tuscany.scdl.stax.impl.LoaderRegistryImpl;
+
+/**
+ * Test the usability of the assembly model API when loading SCDL
+ * 
+ * @version $Rev$ $Date$
+ */
+public class ReadAllTestCase extends TestCase {
+
+    private XMLInputFactory inputFactory;
+    private AssemblyFactory assemblyFactory;
+    private PolicyFactory policyFactory;
+    private LoaderRegistry loaderRegistry;
+
+    public void setUp() throws Exception {
+        inputFactory = XMLInputFactory.newInstance();
+        assemblyFactory = new DefaultAssemblyFactory();
+        policyFactory = new DefaultPolicyFactory();
+        loaderRegistry = new LoaderRegistryImpl();
+    }
+
+    public void tearDown() throws Exception {
+        assemblyFactory = null;
+        policyFactory = null;
+        inputFactory = null;
+        loaderRegistry = null;
+    }
+
+    public void testReadComposite() throws Exception {
+        InputStream is = getClass().getClassLoader().getResourceAsStream("TestAllCalculator.composite");
+        CompositeLoader loader = new CompositeLoader(assemblyFactory, policyFactory, loaderRegistry);
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+
+        Composite composite = loader.load(reader);
+        is.close();
+        assertNotNull(composite);
+        assertEquals(composite.getName(), new QName("http://calc", "TestAllCalculator"));
+        assertEquals(composite.getConstrainingType().getName(), new QName("http://calc", "Calculator"));
+        assertTrue(composite.isLocal());
+        assertFalse(composite.isAutowire());
+        assertEquals(composite.getRequiredIntents().get(0).getName(), new QName("http://test/confidentiality",
+                                                                                "confidentiality"));
+        assertEquals(composite.getPolicySets().get(0).getName(), new QName("http://test/secure", "secure"));
+
+        Composite include = composite.getIncludes().get(0);
+        assertEquals(include.getName(), new QName("http://calc", "TestAllDivide"));
+
+        CompositeService calcCompositeService = (CompositeService)composite.getServices().get(0);
+        assertEquals(calcCompositeService.getName(), "CalculatorService");
+        assertTrue(calcCompositeService.getPromotedService().isUnresolved());
+        assertEquals(calcCompositeService.getPromotedService().getName(),
+                     "CalculatorServiceComponent/CalculatorService");
+        assertEquals(calcCompositeService.getRequiredIntents().get(0).getName(),
+                     new QName("http://test/confidentiality", "confidentiality"));
+        assertEquals(calcCompositeService.getPolicySets().get(0).getName(), new QName("http://test/secure", "secure"));
+        // TODO test operations
+        Callback calcServiceCallback = calcCompositeService.getCallback();
+        assertNotNull(calcServiceCallback);
+        assertEquals(calcServiceCallback.getRequiredIntents().get(0).getName(),
+                     new QName("http://test/confidentiality", "confidentiality"));
+        assertEquals(calcServiceCallback.getPolicySets().get(0).getName(), new QName("http://test/secure", "secure"));
+        // TODO test operations
+
+        Component calcComponent = composite.getComponents().get(0);
+        assertEquals(calcComponent.getName(), "CalculatorServiceComponent");
+        assertEquals(calcComponent.isAutowire(), false);
+        assertEquals(calcComponent.getConstrainingType().getName(), new QName("http://calc",
+                                                                              "CalculatorServiceComponent"));
+        assertEquals(calcComponent.getRequiredIntents().get(0).getName(), new QName("http://test/confidentiality",
+                                                                                    "confidentiality"));
+        assertEquals(calcComponent.getPolicySets().get(0).getName(), new QName("http://test/secure", "secure"));
+
+        ComponentService calcComponentService = calcComponent.getServices().get(0);
+        assertEquals(calcComponentService.getName(), "CalculatorService");
+        assertEquals(calcComponentService.getRequiredIntents().get(0).getName(),
+                     new QName("http://test/confidentiality", "confidentiality"));
+        assertEquals(calcComponentService.getPolicySets().get(0).getName(), new QName("http://test/secure", "secure"));
+        // TODO test operations
+
+        ComponentReference calcComponentReference = calcComponent.getReferences().get(0);
+        assertEquals(calcComponentReference.getName(), "addService");
+        assertEquals(calcComponentReference.isAutowire(), false);
+        assertEquals(calcComponentReference.isWiredByImpl(), false);
+        assertEquals(calcComponentReference.getMultiplicity(), Multiplicity.ONE_ONE);
+        assertEquals(calcComponentReference.getRequiredIntents().get(0).getName(),
+                     new QName("http://test/confidentiality", "confidentiality"));
+        assertEquals(calcComponentReference.getPolicySets().get(0).getName(), new QName("http://test/secure", "secure"));
+        // TODO test operations
+
+        Property property = calcComponent.getProperties().get(0);
+        assertEquals(property.getName(), "round");
+        assertEquals(property.getDefaultValue(), "true");
+        assertEquals(property.getXSDType(), new QName("http://www.w3.org/2001/XMLSchema", "boolean"));
+        assertEquals(property.isMany(), false);
+
+        CompositeReference calcCompositeReference = (CompositeReference)composite.getReferences().get(0);
+        assertEquals(calcCompositeReference.getName(), "MultiplyService");
+        assertTrue(calcCompositeReference.getPromotedReferences().get(0).isUnresolved());
+        assertEquals(calcCompositeReference.getPromotedReferences().get(0).getName(),
+                     "CalculatorServiceComponent/multiplyService");
+        assertEquals(calcCompositeReference.getRequiredIntents().get(0).getName(),
+                     new QName("http://test/confidentiality", "confidentiality"));
+        assertEquals(calcCompositeReference.getPolicySets().get(0).getName(), new QName("http://test/secure", "secure"));
+        // TODO test operations
+        Callback calcCallback = calcCompositeReference.getCallback();
+        assertEquals(calcCompositeReference.getRequiredIntents().get(0).getName(),
+                     new QName("http://test/confidentiality", "confidentiality"));
+        assertEquals(calcCompositeReference.getPolicySets().get(0).getName(), new QName("http://test/secure", "secure"));
+        assertNotNull(calcCallback);
+        // TODO test operations
+
+        new PrintUtil(System.out).print(loader);
+    }
+
+    public void testReadCompositeAndWireIt() throws Exception {
+        InputStream is = getClass().getClassLoader().getResourceAsStream("TestAllCalculator.composite");
+        CompositeLoader loader = new CompositeLoader(assemblyFactory, policyFactory, loaderRegistry);
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+
+        Composite composite = loader.load(reader);
+        is.close();
+        assertNotNull(composite);
+        new CompositeUtil(assemblyFactory, composite).configure(null);
+
+        Component calcComponent = composite.getComponents().get(0);
+        CompositeService calcCompositeService = (CompositeService)composite.getServices().get(0);
+        assertEquals(calcComponent.getServices().get(0), calcCompositeService.getPromotedService());
+
+        ComponentReference multiplyReference = calcComponent.getReferences().get(2);
+        CompositeReference calcCompositeReference = (CompositeReference)composite.getReferences().get(0);
+        assertEquals(multiplyReference, calcCompositeReference.getPromotedReferences().get(0));
+
+        Component addComponent = composite.getComponents().get(1);
+        ComponentReference addReference = calcComponent.getReferences().get(0);
+        assertEquals(addReference.getTargets().get(0), addComponent.getServices().get(0));
+
+        new PrintUtil(System.out).print(composite);
+    }
+
+}

Propchange: incubator/tuscany/java/sca/scdl4j/stax/src/test/java/org/apache/tuscany/scdl/stax/impl/ReadAllTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/scdl4j/stax/src/test/java/org/apache/tuscany/scdl/stax/impl/ReadAllTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/scdl4j/stax/src/test/java/org/apache/tuscany/scdl/stax/impl/ReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/scdl4j/stax/src/test/java/org/apache/tuscany/scdl/stax/impl/ReadTestCase.java?view=auto&rev=524377
==============================================================================
--- incubator/tuscany/java/sca/scdl4j/stax/src/test/java/org/apache/tuscany/scdl/stax/impl/ReadTestCase.java (added)
+++ incubator/tuscany/java/sca/scdl4j/stax/src/test/java/org/apache/tuscany/scdl/stax/impl/ReadTestCase.java Fri Mar 30 23:48:55 2007
@@ -0,0 +1,105 @@
+/*
+ * 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.scdl.stax.impl;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.assembly.model.AssemblyFactory;
+import org.apache.tuscany.assembly.model.impl.DefaultAssemblyFactory;
+import org.apache.tuscany.policy.model.PolicyFactory;
+import org.apache.tuscany.policy.model.impl.DefaultPolicyFactory;
+import org.apache.tuscany.scdl.stax.LoaderRegistry;
+import org.apache.tuscany.scdl.stax.impl.ComponentTypeLoader;
+import org.apache.tuscany.scdl.stax.impl.CompositeLoader;
+import org.apache.tuscany.scdl.stax.impl.ConstrainingTypeLoader;
+import org.apache.tuscany.scdl.stax.impl.LoaderRegistryImpl;
+
+/**
+ * Test the usability of the assembly model API when loading SCDL
+ * 
+ * @version $Rev$ $Date$
+ */
+public class ReadTestCase extends TestCase {
+
+    private XMLInputFactory inputFactory;
+    private AssemblyFactory assemblyFactory;
+    private PolicyFactory policyFactory;
+    private LoaderRegistry loaderRegistry;
+
+    public void setUp() throws Exception {
+        inputFactory = XMLInputFactory.newInstance();
+        assemblyFactory = new DefaultAssemblyFactory();
+        policyFactory = new DefaultPolicyFactory();
+        loaderRegistry = new LoaderRegistryImpl();
+    }
+
+    public void tearDown() throws Exception {
+        assemblyFactory = null;
+        policyFactory = null;
+        inputFactory = null;
+        loaderRegistry = null;
+    }
+
+    public void testReadComponentType() throws Exception {
+        ComponentTypeLoader loader = new ComponentTypeLoader(assemblyFactory, policyFactory, loaderRegistry);
+        InputStream is = getClass().getClassLoader().getResourceAsStream("CalculatorImpl.componentType");
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+        assertNotNull(loader.load(reader));
+        is.close();
+    }
+
+    public void testReadConstrainingType() throws Exception {
+        InputStream is = getClass().getClassLoader().getResourceAsStream("CalculatorComponent.constrainingType");
+        ConstrainingTypeLoader loader = new ConstrainingTypeLoader(assemblyFactory, policyFactory, loaderRegistry);
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+        assertNotNull(loader.load(reader));
+        is.close();
+
+    }
+
+    public static void main(String[] args) throws Exception {
+        ReadTestCase tc = new ReadTestCase();
+        tc.setUp();
+        tc.testReadComposite();
+    }
+
+    public void testReadComposite() throws Exception {
+        InputStream is = getClass().getClassLoader().getResourceAsStream("Calculator.composite");
+        CompositeLoader loader = new CompositeLoader(assemblyFactory, policyFactory, loaderRegistry);
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+        assertNotNull(loader.load(reader));
+        is.close();
+
+    }
+
+    public void testReadCompositeAndWireIt() throws Exception {
+        InputStream is = getClass().getClassLoader().getResourceAsStream("Calculator.composite");
+        CompositeLoader loader = new CompositeLoader(assemblyFactory, policyFactory, loaderRegistry);
+        XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+        assertNotNull(loader.load(reader));
+        is.close();
+    }
+
+}

Propchange: incubator/tuscany/java/sca/scdl4j/stax/src/test/java/org/apache/tuscany/scdl/stax/impl/ReadTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/scdl4j/stax/src/test/java/org/apache/tuscany/scdl/stax/impl/ReadTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/tuscany/java/sca/scdl4j/stax/src/test/resources/Calculator.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/scdl4j/stax/src/test/resources/Calculator.composite?view=auto&rev=524377
==============================================================================
--- incubator/tuscany/java/sca/scdl4j/stax/src/test/resources/Calculator.composite (added)
+++ incubator/tuscany/java/sca/scdl4j/stax/src/test/resources/Calculator.composite Fri Mar 30 23:48:55 2007
@@ -0,0 +1,52 @@
+<?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://sample.calculator"
+	name="calc: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/java/sca/scdl4j/stax/src/test/resources/CalculatorComponent.constrainingType
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/scdl4j/stax/src/test/resources/CalculatorComponent.constrainingType?view=auto&rev=524377
==============================================================================
--- incubator/tuscany/java/sca/scdl4j/stax/src/test/resources/CalculatorComponent.constrainingType (added)
+++ incubator/tuscany/java/sca/scdl4j/stax/src/test/resources/CalculatorComponent.constrainingType Fri Mar 30 23:48:55 2007
@@ -0,0 +1,33 @@
+<?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://sample.calculator"
+	name="calc: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/java/sca/scdl4j/stax/src/test/resources/CalculatorImpl.componentType
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/scdl4j/stax/src/test/resources/CalculatorImpl.componentType?view=auto&rev=524377
==============================================================================
--- incubator/tuscany/java/sca/scdl4j/stax/src/test/resources/CalculatorImpl.componentType (added)
+++ incubator/tuscany/java/sca/scdl4j/stax/src/test/resources/CalculatorImpl.componentType Fri Mar 30 23:48:55 2007
@@ -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/java/sca/scdl4j/stax/src/test/resources/TestAllCalculator.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/scdl4j/stax/src/test/resources/TestAllCalculator.composite?view=auto&rev=524377
==============================================================================
--- incubator/tuscany/java/sca/scdl4j/stax/src/test/resources/TestAllCalculator.composite (added)
+++ incubator/tuscany/java/sca/scdl4j/stax/src/test/resources/TestAllCalculator.composite Fri Mar 30 23:48:55 2007
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<composite autowire="false"
+	constrainingType="tns:Calculator"
+	local="true"
+	name="tns:TestAllCalculator"
+	policySets="sns:secure" 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:cns="http://test/confidentiality"
+	xmlns:sns="http://test/secure">
+	
+  <include>tns:TestAllDivide</include>
+  
+  <service name="CalculatorService" promote="CalculatorServiceComponent/CalculatorService"
+	requires="cns:confidentiality" policySets="sns:secure">
+    <interface.java interface="calculator.CalculatorService" callbackInterface="calculator.CalculatorCallback"/>
+    <operation name="add" policySets="sns:secure" requires="cns:confidentiality"/>
+
+    <binding.ws name="CalculatorWS" policySets="sns:secure" port="" requires="cns:confidentiality" uri="http://calc/ws">
+      <operation name="add" policySets="sns:secure" requires="cns:confidentiality"/>
+    </binding.ws>
+
+    <callback policySets="sns:secure" requires="cns:confidentiality">
+      <binding.ws name="CalculatorCallbackWS" policySets="" port="" requires="" uri="http://calc/callback/ws">
+        <operation name="addCallback" policySets="sns:secure" requires="cns:confidentiality"/>
+      </binding.ws>
+    </callback>
+  </service>
+  
+   <component name="CalculatorServiceComponent" autowire="false" constrainingType="tns:CalculatorServiceComponent" policySets="sns:secure" requires="cns:confidentiality">
+   		<service name="CalculatorService" policySets="sns:secure" 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:secure" requires="cns:confidentiality" wiredByImpl="false">
+   			<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="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:secure" requires="cns:confidentiality" >
+    <interface.java interface="calculator.MultiplyService" callbackInterface="calculator.MultiplyCallback"/>
+    <operation name="multiply" policySets="sns:secure" requires="cns:confidentiality" />
+
+    <binding.ws name="MultiplyWS" port="" policySets="sns:secure" requires="cns:confidentiality" uri="http://calc/ws">
+      <operation name="multiply" policySets="sns:secure" requires="cns:confidentiality" />
+    </binding.ws>
+
+    <callback policySets="sns:secure" requires="cns:confidentiality" >
+      <binding.ws name="MultiplyCallbackWS" port="" uri="http://calc/callback/ws" policySets="sns:secure" requires="cns:confidentiality" >
+        <operation name="multiplyCallback" policySets="sns:secure" requires="cns:confidentiality" />
+      </binding.ws>
+    </callback>
+  </reference>
+  
+</composite>

Added: incubator/tuscany/java/sca/scdl4j/stax/src/test/resources/TestAllDivide.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/scdl4j/stax/src/test/resources/TestAllDivide.composite?view=auto&rev=524377
==============================================================================
--- incubator/tuscany/java/sca/scdl4j/stax/src/test/resources/TestAllDivide.composite (added)
+++ incubator/tuscany/java/sca/scdl4j/stax/src/test/resources/TestAllDivide.composite Fri Mar 30 23:48:55 2007
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<composite autowire="false"
+	constrainingType="tns:Calculator"
+	local="true"
+	name="CompleteCalculator"
+	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>tns:CompleteDivide</include>
+  
+  <service name="CalculatorService" policySets="" promote="CalculatorComponent/CalculatorService" requires="">
+    <interface.java interface="calculator.CalculatorService" callbackInterface="calculator.CalculatorCallback"/>
+    <operation name="add" policySets="" requires=""/>
+
+    <binding.ws name="CalculatorWS" policySets="" port="" requires="" uri="http://calc/ws">
+      <operation name="add" policySets="" requires=""/>
+    </binding.ws>
+
+    <callback policySets="" requires="">
+      <binding.ws name="CalculatorCallbackWS" policySets="" port="" requires="" uri="http://calc/callback/ws">
+        <operation name="addCallback" policySets="" requires=""/>
+      </binding.ws>
+    </callback>
+  </service>
+  
+   <component name="CalculatorServiceComponent" autowire="false" constrainingType="tns:CalculatorServiceComponent" policySets="" requires="">
+   		<service name="CalculatorService" policySets="" requires="">
+   			<interface.java interface="calculator.CalculatorService" callbackInterface="calculator.CalculatorCallback"/>
+   		</service>
+
+   		<reference name="addService" target="AddServiceComponent" autowire="false" multiplicity="1..1" policySets="" requires="" wiredByImpl="false">
+   			<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">
+       <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>
+
+  <reference name="MultiplyService" policySets="" promote="CalculatorComponent/multiplyService" requires="">
+    <interface.java interface="calculator.MultiplyService" callbackInterface="calculator.MultiplyCallback"/>
+    <operation name="multiply" policySets="" requires=""/>
+
+    <binding.ws name="MultiplyWS" policySets="" port="" requires="" uri="http://calc/ws">
+      <operation name="multiply" policySets="" requires=""/>
+    </binding.ws>
+
+    <callback policySets="" requires="">
+      <binding.ws name="MultiplyCallbackWS" policySets="" port="" requires="" uri="http://calc/callback/ws">
+        <operation name="multiplyCallback" policySets="" requires=""/>
+      </binding.ws>
+    </callback>
+  </service>
+  
+</composite>



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org