From 539451c7e13d98504e6f3368d892406494ca711d Mon Sep 17 00:00:00 2001 From: lresende Date: Fri, 13 Nov 2009 01:23:07 +0000 Subject: Removing obsolete release candidate tags git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835693 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/assembly/AssemblyFactoryTestCase.java | 209 ------------------- .../apache/tuscany/sca/assembly/TestBinding.java | 56 ----- .../tuscany/sca/assembly/TestImplementation.java | 61 ------ .../apache/tuscany/sca/assembly/TestInterface.java | 42 ---- .../sca/assembly/TestInterfaceContract.java | 41 ---- .../apache/tuscany/sca/assembly/TestOperation.java | 30 --- .../builder/impl/CompositeBuilderTestCase.java | 128 ------------ .../assembly/builder/impl/PrintUtilTestCase.java | 229 --------------------- 8 files changed, 796 deletions(-) delete mode 100644 sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java delete mode 100644 sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java delete mode 100644 sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java delete mode 100644 sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.java delete mode 100644 sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.java delete mode 100644 sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java delete mode 100644 sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java delete mode 100644 sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java (limited to 'sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache') diff --git a/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java b/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java deleted file mode 100644 index 8a3a89aba4..0000000000 --- a/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/AssemblyFactoryTestCase.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import javax.xml.namespace.QName; - -import junit.framework.TestCase; - - -/** - * Test building of assembly model instances using the assembly factory. - * - * @version $Rev$ $Date$ - */ -public class AssemblyFactoryTestCase extends TestCase { - - private AssemblyFactory assemblyFactory; - - @Override - public void setUp() throws Exception { - assemblyFactory = new DefaultAssemblyFactory(); - } - - public void testCreateComponent() { - createComponent("AccountServiceComponent1"); - } - - public void testCreateComponentType() { - createComponentType(); - } - - public void testCreateComposite() { - createComposite(); - } - - public void testCreateConstrainingType() { - createConstrainingType(); - } - - /** - * Create a composite - */ - Composite createComposite() { - Composite c = assemblyFactory.createComposite(); - - Component c1 = createComponent("AccountServiceComponent1"); - c.getComponents().add(c1); - Component c2 = createComponent("AccountServiceComponent2"); - c.getComponents().add(c2); - - Wire w = assemblyFactory.createWire(); - w.setSource(c1.getReferences().get(0)); - w.setTarget(c2.getServices().get(0)); - c.getWires().add(w); - - CompositeService cs = assemblyFactory.createCompositeService(); - cs.setName("AccountService"); - cs.setPromotedService(c1.getServices().get(0)); - cs.setInterfaceContract(new TestInterfaceContract(assemblyFactory)); - c.getServices().add(cs); - cs.getBindings().add(new TestBinding(assemblyFactory)); - - CompositeReference cr = assemblyFactory.createCompositeReference(); - cr.setName("StockQuoteService"); - cr.getPromotedReferences().add(c2.getReferences().get(1)); - cr.setInterfaceContract(new TestInterfaceContract(assemblyFactory)); - c.getReferences().add(cr); - cr.getBindings().add(new TestBinding(assemblyFactory)); - - return c; - } - - /** - * Create a new component - */ - Component createComponent(String name) { - Component c = assemblyFactory.createComponent(); - c.setName(name); - - ConstrainingType constraint = createConstrainingType(); - c.setConstrainingType(constraint); - - Implementation i = new TestImplementation(assemblyFactory); - c.setImplementation(i); - - ComponentProperty p = assemblyFactory.createComponentProperty(); - p.setName("currency"); - p.setValue("USD"); - p.setMustSupply(true); - p.setXSDType(new QName("", "")); - p.setProperty(i.getProperties().get(0)); - c.getProperties().add(p); - - ComponentReference ref1 = assemblyFactory.createComponentReference(); - ref1.setName("accountDataService"); - ref1.setMultiplicity(Multiplicity.ONE_ONE); - ref1.setInterfaceContract(new TestInterfaceContract(assemblyFactory)); - ref1.setReference(i.getReferences().get(0)); - c.getReferences().add(ref1); - ref1.getBindings().add(new TestBinding(assemblyFactory)); - - ComponentReference ref2 = assemblyFactory.createComponentReference(); - ref2.setName("stockQuoteService"); - ref2.setMultiplicity(Multiplicity.ONE_ONE); - ref2.setInterfaceContract(new TestInterfaceContract(assemblyFactory)); - ref2.setReference(i.getReferences().get(1)); - c.getReferences().add(ref2); - ref2.getBindings().add(new TestBinding(assemblyFactory)); - - ComponentService s = assemblyFactory.createComponentService(); - s.setName("AccountService"); - s.setInterfaceContract(new TestInterfaceContract(assemblyFactory)); - s.setService(i.getServices().get(0)); - c.getServices().add(s); - s.getBindings().add(new TestBinding(assemblyFactory)); - - return c; - } - - /** - * Create a new component type - * - * @return - */ - ComponentType createComponentType() { - ComponentType ctype = assemblyFactory.createComponentType(); - - Property p = assemblyFactory.createProperty(); - p.setName("currency"); - p.setValue("USD"); - p.setMustSupply(true); - p.setXSDType(new QName("", "")); - ctype.getProperties().add(p); - - Reference ref1 = assemblyFactory.createReference(); - ref1.setName("accountDataService"); - ref1.setInterfaceContract(new TestInterfaceContract(assemblyFactory)); - ref1.setMultiplicity(Multiplicity.ONE_ONE); - ctype.getReferences().add(ref1); - ref1.getBindings().add(new TestBinding(assemblyFactory)); - - Reference ref2 = assemblyFactory.createReference(); - ref2.setName("stockQuoteService"); - ref2.setInterfaceContract(new TestInterfaceContract(assemblyFactory)); - ref2.setMultiplicity(Multiplicity.ONE_ONE); - ctype.getReferences().add(ref2); - ref2.getBindings().add(new TestBinding(assemblyFactory)); - - Service s = assemblyFactory.createService(); - s.setName("AccountService"); - s.setInterfaceContract(new TestInterfaceContract(assemblyFactory)); - ctype.getServices().add(s); - s.getBindings().add(new TestBinding(assemblyFactory)); - - return ctype; - } - - /** - * Create a new constraining type - * - * @return - */ - ConstrainingType createConstrainingType() { - ConstrainingType ctype = assemblyFactory.createConstrainingType(); - - AbstractProperty p = assemblyFactory.createAbstractProperty(); - p.setName("currency"); - p.setValue("USD"); - p.setMustSupply(true); - p.setXSDType(new QName("", "")); - ctype.getProperties().add(p); - - AbstractReference ref1 = assemblyFactory.createAbstractReference(); - ref1.setName("accountDataService"); - ref1.setInterfaceContract(new TestInterfaceContract(assemblyFactory)); - ref1.setMultiplicity(Multiplicity.ONE_ONE); - ctype.getReferences().add(ref1); - - AbstractReference ref2 = assemblyFactory.createAbstractReference(); - ref2.setName("stockQuoteService"); - ref2.setInterfaceContract(new TestInterfaceContract(assemblyFactory)); - ref2.setMultiplicity(Multiplicity.ONE_ONE); - ctype.getReferences().add(ref2); - - AbstractService s = assemblyFactory.createAbstractService(); - s.setName("AccountService"); - s.setInterfaceContract(new TestInterfaceContract(assemblyFactory)); - ctype.getServices().add(s); - - return ctype; - } - -} diff --git a/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java b/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java deleted file mode 100644 index 5e0a2335d1..0000000000 --- a/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestBinding.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - - -/** - * A test interface model. - * - * @version $Rev$ $Date$ - */ -public class TestBinding implements Binding { - public TestBinding(AssemblyFactory factory) { - } - - public String getName() { - return null; - } - - public String getURI() { - return "http://test"; - } - - public void setName(String name) { - } - - public void setURI(String uri) { - } - - public void setUnresolved(boolean unresolved) { - } - - public boolean isUnresolved() { - return false; - } - - @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); - } -} diff --git a/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java b/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java deleted file mode 100644 index 19702954c9..0000000000 --- a/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestImplementation.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.impl.ImplementationImpl; - -/** - * A test component implementation model. - * - * @version $Rev$ $Date$ - */ -public class TestImplementation extends ImplementationImpl implements Implementation { - public TestImplementation(AssemblyFactory factory) { - - Property p = factory.createProperty(); - p.setName("currency"); - p.setValue("USD"); - p.setMustSupply(true); - p.setXSDType(new QName("", "")); - getProperties().add(p); - - Reference ref1 = factory.createReference(); - ref1.setName("accountDataService"); - ref1.setMultiplicity(Multiplicity.ONE_ONE); - getReferences().add(ref1); - ref1.getBindings().add(new TestBinding(factory)); - - Reference ref2 = factory.createReference(); - ref2.setName("stockQuoteService"); - ref2.setMultiplicity(Multiplicity.ONE_ONE); - ref2.setInterfaceContract(new TestInterfaceContract(factory)); - getReferences().add(ref2); - ref2.getBindings().add(new TestBinding(factory)); - - Service s = factory.createService(); - s.setName("AccountService"); - s.setInterfaceContract(new TestInterfaceContract(factory)); - getServices().add(s); - s.getBindings().add(new TestBinding(factory)); - - } - -} diff --git a/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.java b/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.java deleted file mode 100644 index dbe0cb8225..0000000000 --- a/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterface.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import org.apache.tuscany.sca.interfacedef.Interface; -import org.apache.tuscany.sca.interfacedef.Operation; -import org.apache.tuscany.sca.interfacedef.impl.InterfaceImpl; - -/** - * A test interface model. - * - * @version $Rev$ $Date$ - */ -public class TestInterface extends InterfaceImpl implements Interface { - - public TestInterface(AssemblyFactory factory) { - - setRemotable(true); - - Operation operation = new TestOperation(); - operation.setName("test"); - getOperations().add(operation); - - } - -} diff --git a/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.java b/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.java deleted file mode 100644 index ee6b95edc9..0000000000 --- a/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestInterfaceContract.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import org.apache.tuscany.sca.interfacedef.InterfaceContract; -import org.apache.tuscany.sca.interfacedef.impl.InterfaceContractImpl; - -/** - * A test interface contract model. - * - * @version $Rev$ $Date$ - */ -public class TestInterfaceContract extends InterfaceContractImpl implements InterfaceContract { - - public TestInterfaceContract(AssemblyFactory factory) { - - TestInterface testInterface = new TestInterface(factory); - setInterface(testInterface); - - TestInterface testCallbackInterface = new TestInterface(factory); - setCallbackInterface(testCallbackInterface); - - } - -} diff --git a/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java b/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java deleted file mode 100644 index d94a7e93a3..0000000000 --- a/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/TestOperation.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tuscany.sca.assembly; - -import org.apache.tuscany.sca.interfacedef.impl.OperationImpl; - -/** - * A test operation model. - * - * @version $Rev$ $Date$ - */ -public class TestOperation extends OperationImpl { - -} diff --git a/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java b/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java deleted file mode 100644 index fabafc998b..0000000000 --- a/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderTestCase.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.builder.impl; - -import javax.xml.namespace.QName; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.CompositeReference; -import org.apache.tuscany.sca.assembly.CompositeService; -import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; - -/** - * Test the CompositeBuilder. - * - * @version $Rev$ $Date$ - */ -public class CompositeBuilderTestCase extends TestCase { - - private AssemblyFactory assemblyFactory; - - @Override - protected void setUp() throws Exception { - assemblyFactory = new DefaultAssemblyFactory(); - } - - public void testFuseIncludes() throws Exception { - Composite c1 = assemblyFactory.createComposite(); - c1.setName(new QName("http://foo", "C1")); - Component a = assemblyFactory.createComponent(); - a.setName("a"); - c1.getComponents().add(a); - CompositeService s = assemblyFactory.createCompositeService(); - s.setName("s"); - c1.getServices().add(s); - CompositeReference r = assemblyFactory.createCompositeReference(); - r.setName("r"); - c1.getReferences().add(r); - - Composite c2 = assemblyFactory.createComposite(); - c2.setName(new QName("http://foo", "C2")); - c1.getIncludes().add(c2); - Component b = assemblyFactory.createComponent(); - b.setName("b"); - c2.getComponents().add(b); - - Composite c = assemblyFactory.createComposite(); - c.setName(new QName("http://foo", "C")); - c.getIncludes().add(c1); - - new CompositeIncludeBuilderImpl(null).build(c); - - assertTrue(c.getComponents().get(0).getName().equals("a")); - assertTrue(c.getComponents().get(1).getName().equals("b")); - assertTrue(c.getServices().get(0).getName().equals("s")); - assertTrue(c.getReferences().get(0).getName().equals("r")); - } - - public void testExpandComposites() throws Exception { - Composite c1 = assemblyFactory.createComposite(); - c1.setName(new QName("http://foo", "C1")); - Component a = assemblyFactory.createComponent(); - a.setName("a"); - c1.getComponents().add(a); - CompositeService s = assemblyFactory.createCompositeService(); - s.setName("s"); - c1.getServices().add(s); - CompositeReference r = assemblyFactory.createCompositeReference(); - r.setName("r"); - c1.getReferences().add(r); - - Composite c2 = assemblyFactory.createComposite(); - c2.setName(new QName("http://foo", "C2")); - Component b = assemblyFactory.createComponent(); - b.setName("b"); - c2.getComponents().add(b); - - Composite c = assemblyFactory.createComposite(); - c.setName(new QName("http://foo", "C")); - Component x = assemblyFactory.createComponent(); - x.setName("x"); - x.setImplementation(c1); - c.getComponents().add(x); - Component y = assemblyFactory.createComponent(); - y.setName("y"); - y.setImplementation(c2); - c.getComponents().add(y); - Component z = assemblyFactory.createComponent(); - z.setName("z"); - z.setImplementation(c1); - c.getComponents().add(z); - - new CompositeCloneBuilderImpl(null).build(c); - - assertTrue(c.getComponents().get(0).getImplementation() != c1); - assertTrue(c.getComponents().get(1).getImplementation() != c2); - assertTrue(c.getComponents().get(2).getImplementation() != c1); - - Composite i = (Composite)c.getComponents().get(0).getImplementation(); - assertTrue(i.getComponents().get(0) != a); - assertTrue(i.getComponents().get(0).getName().equals("a")); - assertTrue(i.getServices().get(0).getName().equals("s")); - assertTrue(i.getServices().get(0) != s); - assertTrue(i.getReferences().get(0).getName().equals("r")); - assertTrue(i.getReferences().get(0) != r); - } - -} diff --git a/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java b/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java deleted file mode 100644 index 82b1fd8665..0000000000 --- a/sca-java-1.x/tags/1.5.1-RC4/modules/assembly/src/test/java/org/apache/tuscany/sca/assembly/builder/impl/PrintUtilTestCase.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.tuscany.sca.assembly.builder.impl; - -import java.io.PrintWriter; -import java.io.StringWriter; - -import javax.xml.namespace.QName; - -import org.apache.tuscany.sca.assembly.AbstractProperty; -import org.apache.tuscany.sca.assembly.AbstractReference; -import org.apache.tuscany.sca.assembly.AbstractService; -import org.apache.tuscany.sca.assembly.AssemblyFactory; -import org.apache.tuscany.sca.assembly.Component; -import org.apache.tuscany.sca.assembly.ComponentProperty; -import org.apache.tuscany.sca.assembly.ComponentReference; -import org.apache.tuscany.sca.assembly.ComponentService; -import org.apache.tuscany.sca.assembly.ComponentType; -import org.apache.tuscany.sca.assembly.Composite; -import org.apache.tuscany.sca.assembly.CompositeReference; -import org.apache.tuscany.sca.assembly.CompositeService; -import org.apache.tuscany.sca.assembly.ConstrainingType; -import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory; -import org.apache.tuscany.sca.assembly.Implementation; -import org.apache.tuscany.sca.assembly.Multiplicity; -import org.apache.tuscany.sca.assembly.Property; -import org.apache.tuscany.sca.assembly.Reference; -import org.apache.tuscany.sca.assembly.Service; -import org.apache.tuscany.sca.assembly.TestBinding; -import org.apache.tuscany.sca.assembly.TestImplementation; -import org.apache.tuscany.sca.assembly.TestInterfaceContract; -import org.apache.tuscany.sca.assembly.Wire; -import org.junit.Test; - -/** - * @version $Rev$ $Date$ - */ -public class PrintUtilTestCase { - - private AssemblyFactory factory = new DefaultAssemblyFactory(); - - /** - * Create a composite - */ - Composite createComposite() { - Composite c = factory.createComposite(); - - Component c1 = createComponent("AccountServiceComponent1"); - c.getComponents().add(c1); - Component c2 = createComponent("AccountServiceComponent2"); - c.getComponents().add(c2); - - Wire w = factory.createWire(); - w.setSource(c1.getReferences().get(0)); - w.setTarget(c2.getServices().get(0)); - c.getWires().add(w); - - CompositeService cs = factory.createCompositeService(); - cs.setName("AccountService"); - cs.setPromotedService(c1.getServices().get(0)); - cs.setInterfaceContract(new TestInterfaceContract(factory)); - c.getServices().add(cs); - cs.getBindings().add(new TestBinding(factory)); - - CompositeReference cr = factory.createCompositeReference(); - cr.setName("StockQuoteService"); - cr.getPromotedReferences().add(c2.getReferences().get(1)); - cr.setInterfaceContract(new TestInterfaceContract(factory)); - c.getReferences().add(cr); - cr.getBindings().add(new TestBinding(factory)); - - return c; - } - - /** - * Create a new component - */ - Component createComponent(String name) { - Component c = factory.createComponent(); - c.setName(name); - - ConstrainingType constraint = createConstrainingType(); - c.setConstrainingType(constraint); - - Implementation i = new TestImplementation(factory); - c.setImplementation(i); - - ComponentProperty p = factory.createComponentProperty(); - p.setName("currency"); - p.setValue("USD"); - p.setMustSupply(true); - p.setXSDType(new QName("", "")); - p.setProperty(i.getProperties().get(0)); - c.getProperties().add(p); - - ComponentReference ref1 = factory.createComponentReference(); - ref1.setName("accountDataService"); - ref1.setMultiplicity(Multiplicity.ONE_ONE); - ref1.setInterfaceContract(new TestInterfaceContract(factory)); - ref1.setReference(i.getReferences().get(0)); - c.getReferences().add(ref1); - ref1.getBindings().add(new TestBinding(factory)); - - ComponentReference ref2 = factory.createComponentReference(); - ref2.setName("stockQuoteService"); - ref2.setMultiplicity(Multiplicity.ONE_ONE); - ref2.setInterfaceContract(new TestInterfaceContract(factory)); - ref2.setReference(i.getReferences().get(1)); - c.getReferences().add(ref2); - ref2.getBindings().add(new TestBinding(factory)); - - ComponentService s = factory.createComponentService(); - s.setName("AccountService"); - s.setInterfaceContract(new TestInterfaceContract(factory)); - s.setService(i.getServices().get(0)); - c.getServices().add(s); - s.getBindings().add(new TestBinding(factory)); - - return c; - } - - /** - * Create a new component type - * - * @return - */ - ComponentType createComponentType() { - ComponentType ctype = factory.createComponentType(); - - Property p = factory.createProperty(); - p.setName("currency"); - p.setValue("USD"); - p.setMustSupply(true); - p.setXSDType(new QName("", "")); - ctype.getProperties().add(p); - - Reference ref1 = factory.createReference(); - ref1.setName("accountDataService"); - ref1.setInterfaceContract(new TestInterfaceContract(factory)); - ref1.setMultiplicity(Multiplicity.ONE_ONE); - ctype.getReferences().add(ref1); - ref1.getBindings().add(new TestBinding(factory)); - - Reference ref2 = factory.createReference(); - ref2.setName("stockQuoteService"); - ref2.setInterfaceContract(new TestInterfaceContract(factory)); - ref2.setMultiplicity(Multiplicity.ONE_ONE); - ctype.getReferences().add(ref2); - ref2.getBindings().add(new TestBinding(factory)); - - Service s = factory.createService(); - s.setName("AccountService"); - s.setInterfaceContract(new TestInterfaceContract(factory)); - ctype.getServices().add(s); - s.getBindings().add(new TestBinding(factory)); - - return ctype; - } - - /** - * Create a new constraining type - * - * @return - */ - ConstrainingType createConstrainingType() { - ConstrainingType ctype = factory.createConstrainingType(); - - AbstractProperty p = factory.createAbstractProperty(); - p.setName("currency"); - p.setValue("USD"); - p.setMustSupply(true); - p.setXSDType(new QName("", "")); - ctype.getProperties().add(p); - - AbstractReference ref1 = factory.createAbstractReference(); - ref1.setName("accountDataService"); - ref1.setInterfaceContract(new TestInterfaceContract(factory)); - ref1.setMultiplicity(Multiplicity.ONE_ONE); - ctype.getReferences().add(ref1); - - AbstractReference ref2 = factory.createAbstractReference(); - ref2.setName("stockQuoteService"); - ref2.setInterfaceContract(new TestInterfaceContract(factory)); - ref2.setMultiplicity(Multiplicity.ONE_ONE); - ctype.getReferences().add(ref2); - - AbstractService s = factory.createAbstractService(); - s.setName("AccountService"); - s.setInterfaceContract(new TestInterfaceContract(factory)); - ctype.getServices().add(s); - - return ctype; - } - - @Test - public void testPrint1() { - Composite composite = createComposite(); - StringWriter sw = new StringWriter(); - PrintUtil p = new PrintUtil(new PrintWriter(sw), true); - p.print(composite); - // System.out.println(sw.toString()); - } - - @Test - public void testPrint2() { - Composite composite = createComposite(); - StringWriter sw = new StringWriter(); - PrintUtil p = new PrintUtil(new PrintWriter(sw), false); - p.print(composite); - // System.out.println(sw.toString()); - } -} -- cgit v1.2.3