You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2007/03/20 19:43:41 UTC
svn commit: r520515 - in
/incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test:
java/org/apache/tuscany/assembly/reader/
java/org/apache/tuscany/assembly/reader/util/
java/org/apache/tuscany/assembly/writer/ java/org/apache/tuscany/ass...
Author: jsdelfino
Date: Tue Mar 20 11:43:28 2007
New Revision: 520515
URL: http://svn.apache.org/viewvc?view=rev&rev=520515
Log:
Moved test cases from scdl to assembly
Added:
incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/
incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/ComponentTypeHandler.java (with props)
incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/CompositeHandler.java (with props)
incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/ConstrainingTypeHandler.java (with props)
incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/ReadTestCase.java (with props)
incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/util/
incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/util/BaseHandler.java (with props)
incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/util/NamespaceStack.java (with props)
incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/util/PrintUtil.java (with props)
incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/
incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/ComponentTypeWriter.java (with props)
incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/CompositeWriter.java (with props)
incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/ConstrainingTypeWriter.java (with props)
incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/WriteTestCase.java (with props)
incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/util/
incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/util/Attr.java (with props)
incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/util/BaseWriter.java (with props)
incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/resources/
incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/resources/Calculator.composite (with props)
incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/resources/CalculatorComponent.constrainingType
incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/resources/CalculatorImpl.componentType (with props)
Added: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/ComponentTypeHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/ComponentTypeHandler.java?view=auto&rev=520515
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/ComponentTypeHandler.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/ComponentTypeHandler.java Tue Mar 20 11:43:28 2007
@@ -0,0 +1,107 @@
+/*
+ * 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.assembly.reader;
+
+import org.apache.tuscany.assembly.model.AssemblyFactory;
+import org.apache.tuscany.assembly.model.Callback;
+import org.apache.tuscany.assembly.model.ComponentService;
+import org.apache.tuscany.assembly.model.ComponentType;
+import org.apache.tuscany.assembly.model.Property;
+import org.apache.tuscany.assembly.model.Reference;
+import org.apache.tuscany.assembly.model.Service;
+import org.apache.tuscany.assembly.reader.util.BaseHandler;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+/**
+ * A test handler to test the usability of the assembly model API when loading SCDL
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentTypeHandler extends BaseHandler implements ContentHandler {
+
+ private ComponentType componentType;
+ private Service service;
+ private Reference reference;
+ private Property property;
+ private Callback callback;
+
+ public ComponentTypeHandler(AssemblyFactory factory, XMLReader reader) {
+ super(factory, reader);
+ }
+
+ public void startElement(String uri, String name, String qname, Attributes attr) throws SAXException {
+ if (sca10.equals(uri)) {
+
+ if ("componentType".equals(name)) {
+ componentType = factory.createComponentType();
+ componentType.setConstrainingType(getConstrainingType(attr));
+
+ } else if ("service".equals(name)) {
+ service = factory.createService();
+ componentType.getServices().add(service);
+ service.setName(getString(attr, "name"));
+
+ } else if ("reference".equals(name)) {
+ reference = factory.createReference();
+ componentType.getReferences().add(reference);
+ reference.setName(getString(attr, "name"));
+
+ //TODO support multivalued attribute
+ ComponentService target = factory.createComponentService();
+ target.setUndefined(true);
+ target.setName(getString(attr, "target"));
+ reference.getTargets().add(target);
+
+ } else if ("property".equals(name)) {
+ property = factory.createProperty();
+ readProperty(property, attr);
+
+ } else if ("callback".equals(name)) {
+ callback = factory.createCallback();
+ if (reference != null) {
+ reference.setCallback(callback);
+ } else if (service != null) {
+ service.setCallback(callback);
+ }
+ }
+ }
+ }
+
+ public void endElement(String uri, String name, String qName) throws SAXException {
+ if (sca10.equals(uri)) {
+ if ("service".equals(name)) {
+ service = null;
+ } else if ("reference".equals(name)) {
+ reference = null;
+ } else if ("property".equals(name)) {
+ property = null;
+ } else if ("callback".equals(name))
+ callback = null;
+ }
+ }
+
+ public ComponentType getComponentType() {
+ return componentType;
+ }
+
+}
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/ComponentTypeHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/ComponentTypeHandler.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/CompositeHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/CompositeHandler.java?view=auto&rev=520515
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/CompositeHandler.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/CompositeHandler.java Tue Mar 20 11:43:28 2007
@@ -0,0 +1,180 @@
+/*
+ * 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.assembly.reader;
+
+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.ComponentProperty;
+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.Property;
+import org.apache.tuscany.assembly.model.Wire;
+import org.apache.tuscany.assembly.reader.util.BaseHandler;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+/**
+ * A test handler to test the usability of the assembly model API when loading SCDL
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeHandler extends BaseHandler implements ContentHandler {
+
+ private Composite composite;
+ private Component component;
+ private Property property;
+ private ComponentService componentService;
+ private ComponentReference componentReference;
+ private ComponentProperty componentProperty;
+ private CompositeService compositeService;
+ private CompositeReference compositeReference;
+ private Wire wire;
+ private Callback callback;
+
+ public CompositeHandler(AssemblyFactory factory, XMLReader reader) {
+ super(factory, reader);
+ }
+
+ public void startElement(String uri, String name, String qname, Attributes attr) throws SAXException {
+ if (sca10.equals(uri)) {
+
+ if ("composite".equals(name)) {
+ composite = factory.createComposite();
+ composite.setName(getQName(attr, "name"));
+ composite.setAutowire(getBoolean(attr, "autowire"));
+ composite.setLocal(getBoolean(attr, "local"));
+ composite.setConstrainingType(getConstrainingType(attr));
+
+ } else if ("service".equals(name)) {
+ if (component != null) {
+ componentService = factory.createComponentService();
+ component.getServices().add(componentService);
+ componentService.setName(getString(attr, "name"));
+ } else {
+ compositeService = factory.createCompositeService();
+ composite.getServices().add(compositeService);
+ compositeService.setName(getString(attr, "name"));
+
+ ComponentService promoted = factory.createComponentService();
+ promoted.setUndefined(true);
+ promoted.setName(getString(attr, "promote"));
+ compositeService.setPromotedService(promoted);
+ }
+
+ } else if ("reference".equals(name)) {
+ if (component != null) {
+ componentReference = factory.createComponentReference();
+ component.getReferences().add(componentReference);
+ componentReference.setName(getString(attr, "name"));
+
+ //TODO support multivalued attribute
+ ComponentService target = factory.createComponentService();
+ target.setUndefined(true);
+ target.setName(getString(attr, "target"));
+ componentReference.getTargets().add(target);
+
+ } else {
+ compositeReference = factory.createCompositeReference();
+ composite.getReferences().add(compositeReference);
+ compositeReference.setName(getString(attr, "name"));
+
+ //TODO support multivalued attribute
+ ComponentReference promoted = factory.createComponentReference();
+ promoted.setUndefined(true);
+ promoted.setName(getString(attr, "promote"));
+ compositeReference.getPromotedReferences().add(promoted);
+ }
+
+ } else if ("property".equals(name)) {
+ if (component != null) {
+ componentProperty = factory.createComponentProperty();
+ component.getProperties().add(componentProperty);
+ readProperty(componentProperty, attr);
+ } else {
+ property = factory.createProperty();
+ composite.getProperties().add(property);
+ readProperty(property, attr);
+ }
+
+ } else if ("component".equals(name)) {
+ component = factory.createComponent();
+ composite.getComponents().add(component);
+ component.setName(getString(attr, "name"));
+ component.setConstrainingType(getConstrainingType(attr));
+
+ } else if ("wire".equals(name)) {
+ wire = factory.createWire();
+ composite.getWires().add(wire);
+
+ ComponentReference source = factory.createComponentReference();
+ source.setUndefined(true);
+ source.setName(getString(attr, "source"));
+ wire.setSource(source);
+
+ ComponentService target = factory.createComponentService();
+ target.setUndefined(true);
+ target.setName(getString(attr, "target"));
+ wire.setTarget(target);
+
+ } else if ("callback".equals(name)) {
+ callback = factory.createCallback();
+ if (componentReference != null) {
+ componentReference.setCallback(callback);
+ } else if (compositeReference != null) {
+ compositeReference.setCallback(callback);
+ } else if (componentService != null) {
+ componentService.setCallback(callback);
+ } else if (compositeService != null) {
+ compositeService.setCallback(callback);
+ }
+ }
+ }
+ }
+
+ public void endElement(String uri, String name, String qname) throws SAXException {
+ if ("service".equals(name)) {
+ componentService = null;
+ compositeService = null;
+ } else if ("reference".equals(name)) {
+ componentReference = null;
+ compositeReference = null;
+ } else if ("property".equals(name)) {
+ componentProperty = null;
+ property = null;
+ } else if ("component".equals(name)) {
+ component = null;
+ } else if ("wire".equals(name)) {
+ wire= null;
+ } else if ("callback".equals(name)) {
+ callback = null;
+ }
+ }
+
+ public Composite getComposite() {
+ return composite;
+ }
+
+}
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/CompositeHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/CompositeHandler.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/ConstrainingTypeHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/ConstrainingTypeHandler.java?view=auto&rev=520515
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/ConstrainingTypeHandler.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/ConstrainingTypeHandler.java Tue Mar 20 11:43:28 2007
@@ -0,0 +1,92 @@
+/*
+ * 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.assembly.reader;
+
+import org.apache.tuscany.assembly.model.AbstractProperty;
+import org.apache.tuscany.assembly.model.AbstractReference;
+import org.apache.tuscany.assembly.model.AbstractService;
+import org.apache.tuscany.assembly.model.AssemblyFactory;
+import org.apache.tuscany.assembly.model.ConstrainingType;
+import org.apache.tuscany.assembly.reader.util.BaseHandler;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+/**
+ * A test handler to test the usability of the assembly model API when loading SCDL
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConstrainingTypeHandler extends BaseHandler implements ContentHandler {
+
+ private ConstrainingType constrainingType;
+ private AbstractService abstractService;
+ private AbstractReference abstractReference;
+ private AbstractProperty abstractProperty;
+
+ public ConstrainingTypeHandler(AssemblyFactory factory, XMLReader reader) {
+ super(factory, reader);
+ }
+
+ public void startElement(String uri, String name, String qname, Attributes attr) throws SAXException {
+ if (sca10.equals(uri)) {
+
+ if ("constrainingType".equals(name)) {
+ constrainingType = factory.createConstrainingType();
+ constrainingType.setName(getQName(attr, "name"));
+
+ } else if ("service".equals(name)) {
+ abstractService = factory.createAbstractService();
+ constrainingType.getServices().add(abstractService);
+ abstractService.setName(getString(attr, "name"));
+
+ } else if ("reference".equals(name)) {
+ abstractReference = factory.createAbstractReference();
+ constrainingType.getReferences().add(abstractReference);
+ abstractReference.setName(getString(attr, "name"));
+
+ } else if ("property".equals(name)) {
+ abstractProperty = factory.createAbstractProperty();
+ constrainingType.getProperties().add(abstractProperty);
+ readAbstractProperty(abstractProperty, attr);
+ }
+ }
+ }
+
+ public void endElement(String uri, String name, String qName) throws SAXException {
+ if (sca10.equals(uri)) {
+ if ("service".equals(name)) {
+ abstractService = null;
+
+ } else if ("reference".equals(name)) {
+ abstractReference = null;
+
+ } else if ("property".equals(name)) {
+ abstractProperty = null;
+ }
+ }
+ }
+
+ public ConstrainingType getConstrainingType() {
+ return constrainingType;
+ }
+
+}
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/ConstrainingTypeHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/ConstrainingTypeHandler.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/ReadTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/ReadTestCase.java?view=auto&rev=520515
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/ReadTestCase.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/ReadTestCase.java Tue Mar 20 11:43:28 2007
@@ -0,0 +1,93 @@
+/*
+ * 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.assembly.reader;
+
+import java.io.InputStream;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.assembly.model.AssemblyFactory;
+import org.apache.tuscany.assembly.model.impl.AssemblyFactoryImpl;
+import org.apache.tuscany.assembly.reader.util.PrintUtil;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Test the usability of the assembly model API when loading SCDL
+ *
+ * @version $Rev$ $Date$
+ */
+public class ReadTestCase extends TestCase {
+
+ AssemblyFactory factory;
+ XMLReader reader;
+
+ public void setUp() throws Exception {
+ factory = new AssemblyFactoryImpl();
+
+ reader = XMLReaderFactory.createXMLReader();
+ reader.setFeature("http://xml.org/sax/features/namespaces", true);
+ reader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
+
+ }
+
+ public void tearDown() throws Exception {
+ factory = null;
+ reader = null;
+ }
+
+ public void testReadComponentType() throws Exception {
+ InputStream is = getClass().getClassLoader().getResourceAsStream("CalculatorImpl.componentType");
+ ComponentTypeHandler handler = new ComponentTypeHandler(factory, reader);
+ reader.setContentHandler(handler);
+ reader.parse(new InputSource(is));
+ assertNotNull(handler.getComponentType());
+
+ new PrintUtil(System.out).print(handler.getComponentType());
+ }
+
+ public void testReadConstrainingType() throws Exception {
+ InputStream is = getClass().getClassLoader().getResourceAsStream("CalculatorComponent.constrainingType");
+ ConstrainingTypeHandler handler = new ConstrainingTypeHandler(factory, reader);
+ reader.setContentHandler(handler);
+ reader.parse(new InputSource(is));
+ assertNotNull(handler.getConstrainingType());
+
+ new PrintUtil(System.out).print(handler.getConstrainingType());
+ }
+
+ 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");
+ CompositeHandler handler = new CompositeHandler(factory, reader);
+ reader.setContentHandler(handler);
+ reader.parse(new InputSource(is));
+ assertNotNull(handler.getComposite());
+
+ new PrintUtil(System.out).print(handler.getComposite());
+ }
+
+}
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/ReadTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/ReadTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/util/BaseHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/util/BaseHandler.java?view=auto&rev=520515
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/util/BaseHandler.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/util/BaseHandler.java Tue Mar 20 11:43:28 2007
@@ -0,0 +1,112 @@
+/*
+ * 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.assembly.reader.util;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.assembly.model.AbstractProperty;
+import org.apache.tuscany.assembly.model.AssemblyFactory;
+import org.apache.tuscany.assembly.model.ConstrainingType;
+import org.apache.tuscany.assembly.model.Property;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * A test handler to test the usability of the assembly model API when loading SCDL
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseHandler extends DefaultHandler implements ContentHandler {
+
+ protected final static String sca10 = "http://www.osoa.org/xmlns/sca/1.0";
+
+ protected NamespaceStack nsStack = new NamespaceStack();
+ protected AssemblyFactory factory;
+ protected XMLReader reader;
+
+ public BaseHandler(AssemblyFactory factory, XMLReader reader) {
+ this.factory = factory;
+ this.reader = reader;
+ }
+
+ protected String getString(Attributes attr, String name) {
+ return attr.getValue(name);
+ }
+
+ protected QName getQName(Attributes attr, String name) {
+ String qName = attr.getValue(name);
+ int index = qName.indexOf(':');
+ String prefix = index == -1 ? "" : qName.substring(0, index);
+ String localName = index == -1 ? qName : qName.substring(index);
+ String ns = nsStack.getNamespaceURI(prefix);
+ if (ns == null) {
+ ns = "";
+ }
+ return new QName(ns, localName, prefix);
+ }
+
+ protected boolean getBoolean(Attributes attr, String name) {
+ return Boolean.valueOf(attr.getValue(name));
+ }
+
+ protected ConstrainingType getConstrainingType(Attributes attr) {
+ String constrainingTypeName = attr.getValue(sca10, "constrainingType");
+ if (constrainingTypeName != null) {
+ ConstrainingType constrainingType = factory.createConstrainingType();
+ constrainingType.setName(new QName(constrainingTypeName));
+ constrainingType.setUndefined(true);
+ return constrainingType;
+ } else {
+ return null;
+ }
+ }
+
+ protected void readAbstractProperty(AbstractProperty prop, Attributes attr) {
+ prop.setName(getString(attr, "name"));
+ prop.setMany(getBoolean(attr, "many"));
+ prop.setMustSupply(getBoolean(attr, "mustSupply"));
+ String xsdElement = getString(attr, "element");
+ if (xsdElement != null) {
+ prop.setXSDElement(new QName(xsdElement));
+ }
+ String xsdType = getString(attr, "type");
+ if (xsdType != null) {
+ prop.setXSDType(new QName(xsdType));
+ }
+ // TODO handle default value
+ }
+
+ protected void readProperty(Property prop, Attributes attr) {
+ readAbstractProperty(prop, attr);
+ // TODO handle property value
+ }
+
+ public void endPrefixMapping(String prefix) throws SAXException {
+ nsStack.endPrefixMapping(prefix);
+ }
+
+ public void startPrefixMapping(String prefix, String uri) throws SAXException {
+ nsStack.startPrefixMapping(prefix, uri);
+ }
+
+}
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/util/BaseHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/util/BaseHandler.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/util/NamespaceStack.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/util/NamespaceStack.java?view=auto&rev=520515
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/util/NamespaceStack.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/util/NamespaceStack.java Tue Mar 20 11:43:28 2007
@@ -0,0 +1,225 @@
+/*
+ * 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.assembly.reader.util;
+
+import java.util.ArrayList;
+import java.util.EmptyStackException;
+
+public class NamespaceStack {
+ private FastStack<String> prefixStack = new FastStack<String>();
+
+ // Keep two arraylists for the prefixes and namespaces. They should be in
+ // sync
+ // since the index of the entry will be used to relate them
+ // use the minimum initial capacity to let things handle memory better
+
+ private FastStack<String> uriStack = new FastStack<String>();
+
+ public String getNamespaceURI(String prefix) {
+ int index = prefixStack.search(prefix);
+ return index == -1 ? null : (String)uriStack.get(index);
+ }
+
+ public String getPrefix(String uri) {
+ int index = uriStack.search(uri);
+ if (index != -1) {
+ return (String)prefixStack.get(index);
+ }
+ return null;
+ }
+
+ /**
+ * Pop a namespace
+ */
+ public void endPrefixMapping(String prefix) {
+ int index = prefixStack.search(prefix);
+ if (index != -1) {
+ prefixStack.remove(index);
+ uriStack.remove(index);
+ }
+ }
+
+ /**
+ * Register a namespace in this context
+ *
+ * @param prefix
+ * @param uri
+ */
+ public void startPrefixMapping(String prefix, String uri) {
+ prefixStack.push(prefix);
+ uriStack.push(uri);
+
+ }
+
+ /**
+ * An implementation of the {@link java.util.Stack} API that is based on an <code>ArrayList</code> instead of a
+ * <code>Vector</code>, so it is not synchronized to protect against multi-threaded access. The implementation is
+ * therefore operates faster in environments where you do not need to worry about multiple thread contention.
+ * <p>
+ * The removal order of an <code>ArrayStack</code> is based on insertion order: The most recently added element is
+ * removed first. The iteration order is <i>not</i> the same as the removal order. The iterator returns elements
+ * from the bottom up, whereas the {@link #remove()} method removes them from the top down.
+ * <p>
+ * Unlike <code>Stack</code>, <code>ArrayStack</code> accepts null entries.
+ */
+ private static class FastStack<T> extends ArrayList<T> {
+
+ /** Ensure serialization compatibility */
+ private static final long serialVersionUID = 2130079159931574599L;
+
+ /**
+ * Constructs a new empty <code>ArrayStack</code>. The initial size is controlled by <code>ArrayList</code>
+ * and is currently 10.
+ */
+ public FastStack() {
+ super();
+ }
+
+ /**
+ * Constructs a new empty <code>ArrayStack</code> with an initial size.
+ *
+ * @param initialSize the initial size to use
+ * @throws IllegalArgumentException if the specified initial size is negative
+ */
+ public FastStack(int initialSize) {
+ super(initialSize);
+ }
+
+ /**
+ * Return <code>true</code> if this stack is currently empty.
+ * <p>
+ * This method exists for compatibility with <code>java.util.Stack</code>. New users of this class should use
+ * <code>isEmpty</code> instead.
+ *
+ * @return true if the stack is currently empty
+ */
+ public boolean empty() {
+ return isEmpty();
+ }
+
+ /**
+ * Returns the top item off of this stack without removing it.
+ *
+ * @return the top item on the stack
+ * @throws EmptyStackException if the stack is empty
+ */
+ public T peek() throws EmptyStackException {
+ int n = size();
+ if (n <= 0) {
+ throw new EmptyStackException();
+ } else {
+ return get(n - 1);
+ }
+ }
+
+ /**
+ * Returns the n'th item down (zero-relative) from the top of this stack without removing it.
+ *
+ * @param n the number of items down to go
+ * @return the n'th item on the stack, zero relative
+ * @throws EmptyStackException if there are not enough items on the stack to satisfy this request
+ */
+ public T peek(int n) throws EmptyStackException {
+ int m = (size() - n) - 1;
+ if (m < 0) {
+ throw new EmptyStackException();
+ } else {
+ return get(m);
+ }
+ }
+
+ /**
+ * Pops the top item off of this stack and return it.
+ *
+ * @return the top item on the stack
+ * @throws EmptyStackException if the stack is empty
+ */
+ public T pop() throws EmptyStackException {
+ int n = size();
+ if (n <= 0) {
+ throw new EmptyStackException();
+ } else {
+ return remove(n - 1);
+ }
+ }
+
+ /**
+ * Pushes a new item onto the top of this stack. The pushed item is also returned. This is equivalent to calling
+ * <code>add</code>.
+ *
+ * @param item the item to be added
+ * @return the item just pushed
+ */
+ public Object push(T item) {
+ add(item);
+ return item;
+ }
+
+ /**
+ * Returns the one-based position of the distance from the top that the specified object exists on this stack,
+ * where the top-most element is considered to be at distance <code>1</code>. If the object is not present on
+ * the stack, return <code>-1</code> instead. The <code>equals()</code> method is used to compare to the
+ * items in this stack.
+ *
+ * @param object the object to be searched for
+ * @return index of the stack for the object, or -1 if not found
+ */
+ public int search(T object) {
+ int i = size() - 1; // Current index
+ while (i >= 0) {
+ T current = get(i);
+ if ((object == null && current == null) || (object != null && object.equals(current))) {
+ return i;
+ }
+ i--;
+ }
+ return -1;
+ }
+
+ /**
+ * Returns the element on the top of the stack.
+ *
+ * @return the element on the top of the stack
+ * @throws EmptyStackException if the stack is empty
+ */
+ public T get() {
+ int size = size();
+ if (size == 0) {
+ throw new EmptyStackException();
+ }
+ return get(size - 1);
+ }
+
+ /**
+ * Removes the element on the top of the stack.
+ *
+ * @return the removed element
+ * @throws EmptyStackException if the stack is empty
+ */
+ public T remove() {
+ int size = size();
+ if (size == 0) {
+ throw new EmptyStackException();
+ }
+ return remove(size - 1);
+ }
+
+ }
+
+}
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/util/NamespaceStack.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/util/NamespaceStack.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/util/PrintUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/util/PrintUtil.java?view=auto&rev=520515
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/util/PrintUtil.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/util/PrintUtil.java Tue Mar 20 11:43:28 2007
@@ -0,0 +1,114 @@
+/*
+ * 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.assembly.reader.util;
+
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * A simple print utility class to help print the assembly model.
+ *
+ * @version $Rev$ $Date$
+ */
+public class PrintUtil {
+
+ PrintWriter out;
+ Set<Object> objs = new HashSet<Object>();
+ int level;
+
+ public PrintUtil(OutputStream out) {
+ this.out = new PrintWriter(new OutputStreamWriter(out), true);
+ }
+
+ void indent(int level) {
+ for (int i=0; i<level; i++) {
+ out.print(" ");
+ }
+ }
+
+ public void print(Object obj) {
+ if (objs.contains(obj)) {
+ indent(level);
+ out.println(obj.getClass().getName()+"@"+System.identityHashCode(obj));
+ }
+ else {
+ objs.add(obj);
+ try {
+ indent(level);
+ out.println(obj.getClass().getSimpleName() + " {");
+ BeanInfo bi = Introspector.getBeanInfo(obj.getClass());
+ for (PropertyDescriptor pd: bi.getPropertyDescriptors()) {
+ try {
+ Object pv = pd.getReadMethod().invoke(obj);
+ if (pv != null) {
+ if (pv.getClass().isArray()) {
+ pv = Arrays.asList((Object[])pv);
+ }
+ if (pv instanceof List) {
+ if (!((List)pv).isEmpty()) {
+ level++;
+ indent(level);
+ out.println(pd.getName() + "= [");
+ for (Object e: (List)pv) {
+ level++;
+ print(e);
+ level--;
+ }
+ indent(level);
+ out.println( " ]");
+ level--;
+ }
+ }
+ else {
+ Class<?> pvc = pv.getClass();
+ if (pvc.isPrimitive() || pvc.getName().startsWith("java.") || pvc.getName().startsWith("javax.") || pvc.isEnum()) {
+ if (!pd.getName().equals("class")) {
+ if (!(Boolean.FALSE.equals(pv))) {
+ indent(level+1);
+ out.println(pd.getName() + "=" + pv.toString());
+ }
+ }
+ } else {
+ level++;
+ print(pv);
+ level--;
+ }
+ }
+ }
+ } catch (Exception e) {}
+ }
+ indent(level);
+ out.println("}");
+ } catch (IntrospectionException e) {
+ indent(level);
+ out.println(e);
+ }
+ }
+ }
+
+}
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/util/PrintUtil.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/reader/util/PrintUtil.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/ComponentTypeWriter.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/ComponentTypeWriter.java?view=auto&rev=520515
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/ComponentTypeWriter.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/ComponentTypeWriter.java Tue Mar 20 11:43:28 2007
@@ -0,0 +1,77 @@
+/*
+ * 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.assembly.writer;
+
+import org.apache.tuscany.assembly.model.ComponentType;
+import org.apache.tuscany.assembly.model.Property;
+import org.apache.tuscany.assembly.model.Reference;
+import org.apache.tuscany.assembly.model.Service;
+import org.apache.tuscany.assembly.writer.util.Attr;
+import org.apache.tuscany.assembly.writer.util.BaseWriter;
+import org.xml.sax.SAXException;
+
+/**
+ * A test handler to test the usability of the assembly model API when writing SCDL
+ *
+ * @version $Rev$ $Date$
+ */
+public class ComponentTypeWriter extends BaseWriter {
+
+ private ComponentType componentType;
+
+ public ComponentTypeWriter(ComponentType componentType) {
+ this.componentType = componentType;
+ }
+
+ protected void write() throws SAXException {
+
+ start("componentType", new Attr("constrainingType", getConstrainingType(componentType)));
+
+ for (Service service: componentType.getServices()) {
+ start("service", new Attr("name", service.getName()));
+ if (service.getCallback() != null) {
+ start("callback");
+ end("callback");
+ }
+ end("service");
+ }
+
+ for (Reference reference: componentType.getReferences()) {
+ //TODO handle multivalued target attribute
+ String target = reference.getTargets().isEmpty()? null: reference.getTargets().get(0).getName();
+ start("reference",
+ new Attr("name", reference.getName()),
+ new Attr("target", target));
+ if (reference.getCallback() != null) {
+ start("callback");
+ end("callback");
+ }
+ end("reference");
+ }
+
+ for (Property property: componentType.getProperties()) {
+ start("property", new Attr("name", property.getName()));
+ end("property");
+ }
+
+ end("componentType");
+ }
+
+}
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/ComponentTypeWriter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/ComponentTypeWriter.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/CompositeWriter.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/CompositeWriter.java?view=auto&rev=520515
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/CompositeWriter.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/CompositeWriter.java Tue Mar 20 11:43:28 2007
@@ -0,0 +1,128 @@
+/*
+ * 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.assembly.writer;
+
+import org.apache.tuscany.assembly.model.Component;
+import org.apache.tuscany.assembly.model.ComponentProperty;
+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.Property;
+import org.apache.tuscany.assembly.model.Reference;
+import org.apache.tuscany.assembly.model.Service;
+import org.apache.tuscany.assembly.writer.util.Attr;
+import org.apache.tuscany.assembly.writer.util.BaseWriter;
+import org.xml.sax.SAXException;
+
+/**
+ * A test handler to test the usability of the assembly model API when writing SCDL
+ *
+ * @version $Rev$ $Date$
+ */
+public class CompositeWriter extends BaseWriter {
+
+ private Composite composite;
+
+ public CompositeWriter(Composite composite) {
+ this.composite = composite;
+ }
+
+ protected void write() throws SAXException {
+
+ start("composite", new Attr("constrainingType", getConstrainingType(composite)));
+
+ for (Service service: composite.getServices()) {
+ CompositeService compositeService = (CompositeService)service;
+ ComponentService promotedService = compositeService.getPromotedService();
+ String promote = promotedService != null? promotedService.getName():null;
+ start("service",
+ new Attr("name", service.getName()),
+ new Attr("promote", promote));
+ if (service.getCallback() != null) {
+ start("callback");
+ end("callback");
+ }
+ end("service");
+ }
+
+ for (Component component: composite.getComponents()) {
+ start("component",
+ new Attr("name", component.getName()));
+
+ for (ComponentService service: component.getServices()) {
+ start("service",
+ new Attr("name", service.getName()));
+ end("service");
+ if (service.getCallback() != null) {
+ start("callback");
+ end("callback");
+ }
+ }
+
+ for (ComponentReference reference: component.getReferences()) {
+ //TODO handle multivalued target attribute
+ String target = reference.getTargets().isEmpty()? null: reference.getTargets().get(0).getName();
+ start("reference",
+ new Attr("name", reference.getName()),
+ new Attr("target", target));
+ if (reference.getCallback() != null) {
+ start("callback");
+ end("callback");
+ }
+ end("reference");
+ }
+
+ for (ComponentProperty property: component.getProperties()) {
+ start("property", new Attr("name", property.getName()));
+ end("property");
+ }
+
+ end("component");
+ }
+
+ for (Reference reference: composite.getReferences()) {
+ //TODO handle multivalued promote attribute
+ CompositeReference compositeReference = (CompositeReference)reference;
+ String promote;
+ if (!compositeReference.getPromotedReferences().isEmpty())
+ promote = compositeReference.getPromotedReferences().get(0).getName();
+ else
+ promote = null;
+ start("reference",
+ new Attr("name", reference.getName()),
+ new Attr("promote", promote));
+ if (reference.getCallback() != null) {
+ start("callback");
+ end("callback");
+ }
+ end("reference");
+ }
+
+ for (Property property: composite.getProperties()) {
+ start("property", new Attr("name", property.getName()));
+ end("property");
+ }
+
+ end("composite");
+ }
+
+}
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/CompositeWriter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/CompositeWriter.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/ConstrainingTypeWriter.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/ConstrainingTypeWriter.java?view=auto&rev=520515
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/ConstrainingTypeWriter.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/ConstrainingTypeWriter.java Tue Mar 20 11:43:28 2007
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.assembly.writer;
+
+import org.apache.tuscany.assembly.model.AbstractProperty;
+import org.apache.tuscany.assembly.model.AbstractReference;
+import org.apache.tuscany.assembly.model.AbstractService;
+import org.apache.tuscany.assembly.model.ConstrainingType;
+import org.apache.tuscany.assembly.writer.util.Attr;
+import org.apache.tuscany.assembly.writer.util.BaseWriter;
+import org.xml.sax.SAXException;
+
+/**
+ * A test handler to test the usability of the assembly model API when writing SCDL
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConstrainingTypeWriter extends BaseWriter {
+
+ private ConstrainingType constrainingType;
+
+ public ConstrainingTypeWriter(ConstrainingType constrainingType) {
+ this.constrainingType = constrainingType;
+ }
+
+ protected void write() throws SAXException {
+
+ start("constrainingType");
+
+ for (AbstractService service: constrainingType.getServices()) {
+ start("service", new Attr("name", service.getName()));
+ end("service");
+ }
+
+ for (AbstractReference reference: constrainingType.getReferences()) {
+ //TODO handle multivalued target attribute
+ start("reference", new Attr("name", reference.getName()));
+ end("reference");
+ }
+
+ for (AbstractProperty property: constrainingType.getProperties()) {
+ start("property", new Attr("name", property.getName()));
+ end("property");
+ }
+
+ end("constrainingType");
+ }
+
+}
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/ConstrainingTypeWriter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/ConstrainingTypeWriter.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/WriteTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/WriteTestCase.java?view=auto&rev=520515
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/WriteTestCase.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/WriteTestCase.java Tue Mar 20 11:43:28 2007
@@ -0,0 +1,113 @@
+/*
+ * 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.assembly.writer;
+
+import java.io.InputStream;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.assembly.model.AssemblyFactory;
+import org.apache.tuscany.assembly.model.impl.AssemblyFactoryImpl;
+import org.apache.tuscany.assembly.reader.ComponentTypeHandler;
+import org.apache.tuscany.assembly.reader.CompositeHandler;
+import org.apache.tuscany.assembly.reader.ConstrainingTypeHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/**
+ * Test the usability of the assembly model API when loading SCDL
+ *
+ * @version $Rev$ $Date$
+ */
+public class WriteTestCase extends TestCase {
+
+ AssemblyFactory factory;
+ XMLReader reader;
+ Transformer transformer;
+
+ public void setUp() throws Exception {
+ factory = new AssemblyFactoryImpl();
+
+ reader = XMLReaderFactory.createXMLReader();
+ reader.setFeature("http://xml.org/sax/features/namespaces", true);
+ reader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
+
+ transformer = TransformerFactory.newInstance().newTransformer();
+ transformer.setOutputProperty("indent", "yes");
+ }
+
+ public void tearDown() throws Exception {
+ factory = null;
+ reader = null;
+ transformer = null;
+ }
+
+ public static void main(String[] args) throws Exception {
+ WriteTestCase tc = new WriteTestCase();
+ tc.setUp();
+ tc.testWriteComponentType();
+ }
+
+ public void testWriteComponentType() throws Exception {
+ InputStream is = getClass().getClassLoader().getResourceAsStream("CalculatorImpl.componentType");
+ ComponentTypeHandler handler = new ComponentTypeHandler(factory, reader);
+ reader.setContentHandler(handler);
+ reader.parse(new InputSource(is));
+ assertNotNull(handler.getComponentType());
+
+ ComponentTypeWriter writer = new ComponentTypeWriter(handler.getComponentType());
+ System.out.println();
+ transformer.transform(new SAXSource(writer, null), new StreamResult(System.out));
+ System.out.println();
+ }
+
+ public void testWriteComposite() throws Exception {
+ InputStream is = getClass().getClassLoader().getResourceAsStream("Calculator.composite");
+ CompositeHandler handler = new CompositeHandler(factory, reader);
+ reader.setContentHandler(handler);
+ reader.parse(new InputSource(is));
+ assertNotNull(handler.getComposite());
+
+ CompositeWriter writer = new CompositeWriter(handler.getComposite());
+ System.out.println();
+ transformer.transform(new SAXSource(writer, null), new StreamResult(System.out));
+ System.out.println();
+ }
+
+ public void testWriteConstrainingType() throws Exception {
+ InputStream is = getClass().getClassLoader().getResourceAsStream("CalculatorComponent.constrainingType");
+ ConstrainingTypeHandler handler = new ConstrainingTypeHandler(factory, reader);
+ reader.setContentHandler(handler);
+ reader.parse(new InputSource(is));
+ assertNotNull(handler.getConstrainingType());
+
+ ConstrainingTypeWriter writer = new ConstrainingTypeWriter(handler.getConstrainingType());
+ System.out.println();
+ transformer.transform(new SAXSource(writer, null), new StreamResult(System.out));
+ System.out.println();
+ }
+
+}
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/WriteTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/WriteTestCase.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/util/Attr.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/util/Attr.java?view=auto&rev=520515
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/util/Attr.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/util/Attr.java Tue Mar 20 11:43:28 2007
@@ -0,0 +1,71 @@
+/*
+ * 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.assembly.writer.util;
+
+import javax.xml.namespace.QName;
+
+import org.xml.sax.helpers.AttributesImpl;
+
+public class Attr {
+
+ String uri;
+ String name;
+ Object value;
+
+ public Attr(String uri, String name, String value) {
+ this.uri = uri;
+ this.name = name;
+ this.value = value;
+ }
+
+ public Attr(String name, String value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ public Attr(String uri, String name, boolean value) {
+ this.uri = uri;
+ this.name = name;
+ this.value = value;
+ }
+
+ public Attr(String name, boolean value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ public Attr(String uri, String name, QName value) {
+ this.uri = uri;
+ this.name = name;
+ this.value = value;
+ }
+
+ public Attr(String name, QName value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ void write(AttributesImpl attrs) {
+ if (value != null) {
+ attrs.addAttribute(uri, name, name, "CDATA", String.valueOf(value));
+ }
+ }
+
+}
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/util/Attr.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/util/Attr.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/util/BaseWriter.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/util/BaseWriter.java?view=auto&rev=520515
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/util/BaseWriter.java (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/util/BaseWriter.java Tue Mar 20 11:43:28 2007
@@ -0,0 +1,113 @@
+/*
+ * 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.assembly.writer.util;
+
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.assembly.model.AbstractProperty;
+import org.apache.tuscany.assembly.model.ComponentType;
+import org.apache.tuscany.assembly.model.ConstrainingType;
+import org.apache.tuscany.assembly.model.Property;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+import org.xml.sax.helpers.XMLFilterImpl;
+
+/**
+ * A test writer to test the usability of the assembly model API when writing SCDL
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class BaseWriter extends XMLFilterImpl {
+
+ protected final static String sca10 = "http://www.osoa.org/xmlns/sca/1.0";
+ protected ContentHandler out;
+
+ /**
+ * This is where you write the logic to produce SCDL.
+ * @throws SAXException
+ */
+ abstract protected void write() throws SAXException;
+
+ public void parse(InputSource input) throws SAXException, IOException {
+ out.startDocument();
+ write();
+ out.endDocument();
+ }
+
+ public void setContentHandler(ContentHandler handler) {
+ super.setContentHandler(handler);
+ out = handler;
+ }
+
+ protected void start(String uri, String name, Attr... attrs) throws SAXException {
+ out.startElement(uri, null, name, attributes(attrs));
+ }
+
+ protected void start(String name, Attr... attrs) throws SAXException {
+ out.startElement(sca10, null, name, attributes(attrs));
+ }
+
+ protected void end(String uri, String name) throws SAXException {
+ out.endElement(uri, null, name);
+ }
+
+ protected void end(String name) throws SAXException {
+ out.endElement(sca10, null, name);
+ }
+
+ protected Attributes attributes(Attr... attrs) {
+ AttributesImpl attributes = new AttributesImpl();
+ for (Attr attr: attrs) {
+ if (attr != null)
+ attr.write(attributes);
+ }
+ return attributes;
+ }
+
+ protected QName getConstrainingType(ComponentType componentType) {
+ ConstrainingType constrainingType = componentType.getConstrainingType();
+ if (constrainingType!=null)
+ return constrainingType.getName();
+ else
+ return null;
+ }
+
+ protected Attributes abstractPropertyAttributes(AbstractProperty prop) {
+ Attributes attributes = attributes(
+ new Attr("name", prop.getName()),
+ new Attr("many", prop.isMany()),
+ new Attr("mustSupply", prop.isMustSupply()),
+ new Attr("element", prop.getXSDElement()),
+ new Attr("type", prop.getXSDType())
+ );
+ // TODO handle default value
+ return attributes;
+ }
+
+ protected Attributes propertyAttributes(Property prop) {
+ // TODO handle property value
+ return abstractPropertyAttributes(prop);
+ }
+}
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/util/BaseWriter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/java/org/apache/tuscany/assembly/writer/util/BaseWriter.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/resources/Calculator.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/resources/Calculator.composite?view=auto&rev=520515
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/resources/Calculator.composite (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/resources/Calculator.composite Tue Mar 20 11:43:28 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>
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/resources/Calculator.composite
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/resources/Calculator.composite
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/resources/CalculatorComponent.constrainingType
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/resources/CalculatorComponent.constrainingType?view=auto&rev=520515
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/resources/CalculatorComponent.constrainingType (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/resources/CalculatorComponent.constrainingType Tue Mar 20 11:43:28 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/branches/sca-java-integration/sca/assembly/src/test/resources/CalculatorImpl.componentType
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/resources/CalculatorImpl.componentType?view=auto&rev=520515
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/resources/CalculatorImpl.componentType (added)
+++ incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/resources/CalculatorImpl.componentType Tue Mar 20 11:43:28 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
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/resources/CalculatorImpl.componentType
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/branches/sca-java-integration/sca/assembly/src/test/resources/CalculatorImpl.componentType
------------------------------------------------------------------------------
svn:keywords = Rev Date
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org