summaryrefslogtreecommitdiffstats
path: root/sandbox/bdaniel
diff options
context:
space:
mode:
authordims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
committerdims <dims@13f79535-47bb-0310-9956-ffa450edef68>2008-06-17 00:23:01 +0000
commitbdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch)
tree38a92061c0793434c4be189f1d70c3458b6bc41d /sandbox/bdaniel
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/bdaniel')
-rw-r--r--sandbox/bdaniel/propertyTest/pom.xml72
-rw-r--r--sandbox/bdaniel/propertyTest/src/main/java/testing/ABCDComponent.java9
-rw-r--r--sandbox/bdaniel/propertyTest/src/main/java/testing/ABCDComponentImpl.java36
-rw-r--r--sandbox/bdaniel/propertyTest/src/main/java/testing/ABComponent.java10
-rw-r--r--sandbox/bdaniel/propertyTest/src/main/java/testing/ABComponentImpl.java63
-rw-r--r--sandbox/bdaniel/propertyTest/src/main/java/testing/CDComponent.java11
-rw-r--r--sandbox/bdaniel/propertyTest/src/main/java/testing/CDComponentImpl.java66
-rw-r--r--sandbox/bdaniel/propertyTest/src/main/java/testing/OverrideService.java5
-rw-r--r--sandbox/bdaniel/propertyTest/src/main/java/testing/OverrideServiceImpl.java5
-rw-r--r--sandbox/bdaniel/propertyTest/src/main/java/testing/PropertyService.java5
-rw-r--r--sandbox/bdaniel/propertyTest/src/main/resources/META-INF/sca/default.scdl69
-rw-r--r--sandbox/bdaniel/propertyTest/src/main/resources/META-INF/sca/fileProperty.txt1
-rw-r--r--sandbox/bdaniel/propertyTest/src/test/java/testing/PropertyITest.java76
13 files changed, 428 insertions, 0 deletions
diff --git a/sandbox/bdaniel/propertyTest/pom.xml b/sandbox/bdaniel/propertyTest/pom.xml
new file mode 100644
index 0000000000..81e353a861
--- /dev/null
+++ b/sandbox/bdaniel/propertyTest/pom.xml
@@ -0,0 +1,72 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.tuscany.testing</groupId>
+ <artifactId>propertyTest</artifactId>
+ <version>SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.osoa</groupId>
+ <artifactId>sca-api-r0.95</artifactId>
+ <version>1.0-incubator-M2</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <defaultGoal>install</defaultGoal>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sca.plugins</groupId>
+ <artifactId>tuscany-itest-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>start</id>
+ <goals>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>test</id>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/*ITest.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ <execution>
+ <id>stop</id>
+ <goals>
+ <goal>stop</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>**/*ITest.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project> \ No newline at end of file
diff --git a/sandbox/bdaniel/propertyTest/src/main/java/testing/ABCDComponent.java b/sandbox/bdaniel/propertyTest/src/main/java/testing/ABCDComponent.java
new file mode 100644
index 0000000000..c3657adc4e
--- /dev/null
+++ b/sandbox/bdaniel/propertyTest/src/main/java/testing/ABCDComponent.java
@@ -0,0 +1,9 @@
+package testing;
+
+public interface ABCDComponent {
+ String getA();
+ String getB();
+ String getC();
+ String getD();
+}
+
diff --git a/sandbox/bdaniel/propertyTest/src/main/java/testing/ABCDComponentImpl.java b/sandbox/bdaniel/propertyTest/src/main/java/testing/ABCDComponentImpl.java
new file mode 100644
index 0000000000..ef979297b5
--- /dev/null
+++ b/sandbox/bdaniel/propertyTest/src/main/java/testing/ABCDComponentImpl.java
@@ -0,0 +1,36 @@
+package testing;
+
+import org.osoa.sca.annotations.Reference;
+import org.osoa.sca.annotations.Scope;
+
+@Scope("MODULE")
+public class ABCDComponentImpl implements ABCDComponent {
+ private ABComponent abComponent;
+ private CDComponent cdComponent;
+
+ @Reference
+ public void setAb(ABComponent component) {
+ this.abComponent = component;
+ }
+
+ @Reference
+ public void setCd(CDComponent component) {
+ this.cdComponent = component;
+ }
+
+ public String getA() {
+ return this.abComponent.getA();
+ }
+
+ public String getB() {
+ return this.abComponent.getB();
+ }
+
+ public String getC() {
+ return this.cdComponent.getC();
+ }
+
+ public String getD() {
+ return this.cdComponent.getD();
+ }
+}
diff --git a/sandbox/bdaniel/propertyTest/src/main/java/testing/ABComponent.java b/sandbox/bdaniel/propertyTest/src/main/java/testing/ABComponent.java
new file mode 100644
index 0000000000..c760883b5a
--- /dev/null
+++ b/sandbox/bdaniel/propertyTest/src/main/java/testing/ABComponent.java
@@ -0,0 +1,10 @@
+package testing;
+
+public interface ABComponent {
+
+ String getA();
+ String getB();
+ String getZ();
+ int getIntValue();
+ String getF();
+}
diff --git a/sandbox/bdaniel/propertyTest/src/main/java/testing/ABComponentImpl.java b/sandbox/bdaniel/propertyTest/src/main/java/testing/ABComponentImpl.java
new file mode 100644
index 0000000000..8a0de56400
--- /dev/null
+++ b/sandbox/bdaniel/propertyTest/src/main/java/testing/ABComponentImpl.java
@@ -0,0 +1,63 @@
+package testing;
+
+import org.osoa.sca.annotations.Property;
+
+public class ABComponentImpl implements ABComponent {
+
+ private String aProperty;
+ private String bProperty;
+ private int intValue;
+ // private Collection manyProp;
+ private String zProperty;
+ private String fProperty;
+
+ @Property(name="xpath")
+ public void setZProperty(final String value) {
+ this.zProperty = value;
+ }
+
+// @Property(name="foobar")
+// public void setCollectionProperty(final Collection value) {
+// this.manyProp = value;
+// }
+
+ @Property
+ public void setA(final String A) {
+ this.aProperty = A;
+ }
+
+ @Property
+ public void setB(final String B) {
+ this.bProperty = B;
+ }
+
+ @Property
+ public void setF(final String F) {
+ this.fProperty = F;
+ }
+
+ @Property
+ public void setOne(final int value) {
+ this.intValue = value;
+ }
+
+ public String getA() {
+ return this.aProperty;
+ }
+
+ public String getB() {
+ return this.bProperty;
+ }
+
+ public int getIntValue() {
+ return this.intValue;
+ }
+
+ public String getZ() {
+ return this.zProperty;
+ }
+
+ public String getF() {
+ return this.fProperty;
+ }
+}
diff --git a/sandbox/bdaniel/propertyTest/src/main/java/testing/CDComponent.java b/sandbox/bdaniel/propertyTest/src/main/java/testing/CDComponent.java
new file mode 100644
index 0000000000..3972cad23e
--- /dev/null
+++ b/sandbox/bdaniel/propertyTest/src/main/java/testing/CDComponent.java
@@ -0,0 +1,11 @@
+package testing;
+
+public interface CDComponent {
+
+ String getC();
+ String getC2();
+ String getD();
+ String getNoSource();
+ String getFileProperty();
+ int getOverrideValue();
+}
diff --git a/sandbox/bdaniel/propertyTest/src/main/java/testing/CDComponentImpl.java b/sandbox/bdaniel/propertyTest/src/main/java/testing/CDComponentImpl.java
new file mode 100644
index 0000000000..5dbd84de40
--- /dev/null
+++ b/sandbox/bdaniel/propertyTest/src/main/java/testing/CDComponentImpl.java
@@ -0,0 +1,66 @@
+package testing;
+
+import org.osoa.sca.annotations.Property;
+
+public class CDComponentImpl implements CDComponent {
+
+ private String cProperty;
+ private String dProperty;
+ private String nosource;
+ private String fileProperty;
+ private int overrideNumber;
+ private String cProperty2;
+
+ @Property(name="nonFileProperty")
+ public void setC2(final String value) {
+ this.cProperty2 = value;
+ }
+ @Property(name="two")
+ public void setOverrideNumber(final int value) {
+ this.overrideNumber = value;
+ }
+
+ @Property(name="fileProperty")
+ public void setFileProp(final String value) {
+ this.fileProperty = value;
+ }
+ @Property
+ public void setC(final String C) {
+ this.cProperty = C;
+ }
+
+ @Property
+ public void setD(final String D) {
+ this.dProperty = D;
+ }
+
+ @Property
+ public void setNosource(final String value) {
+ this.nosource = value;
+ }
+
+ public String getFileProperty() {
+ return this.fileProperty;
+ }
+
+ public String getC() {
+ return this.cProperty;
+ }
+
+ public String getC2() {
+ return this.cProperty2;
+ }
+
+ public String getD() {
+ return this.dProperty;
+ }
+
+ public String getNoSource() {
+ return this.nosource;
+ }
+
+ public int getOverrideValue() {
+ return this.overrideNumber;
+ }
+}
+
diff --git a/sandbox/bdaniel/propertyTest/src/main/java/testing/OverrideService.java b/sandbox/bdaniel/propertyTest/src/main/java/testing/OverrideService.java
new file mode 100644
index 0000000000..25e71f11f0
--- /dev/null
+++ b/sandbox/bdaniel/propertyTest/src/main/java/testing/OverrideService.java
@@ -0,0 +1,5 @@
+package testing;
+
+public interface OverrideService {
+
+}
diff --git a/sandbox/bdaniel/propertyTest/src/main/java/testing/OverrideServiceImpl.java b/sandbox/bdaniel/propertyTest/src/main/java/testing/OverrideServiceImpl.java
new file mode 100644
index 0000000000..3a5f3e11c2
--- /dev/null
+++ b/sandbox/bdaniel/propertyTest/src/main/java/testing/OverrideServiceImpl.java
@@ -0,0 +1,5 @@
+package testing;
+
+public class OverrideServiceImpl implements OverrideService {
+
+}
diff --git a/sandbox/bdaniel/propertyTest/src/main/java/testing/PropertyService.java b/sandbox/bdaniel/propertyTest/src/main/java/testing/PropertyService.java
new file mode 100644
index 0000000000..4e81982819
--- /dev/null
+++ b/sandbox/bdaniel/propertyTest/src/main/java/testing/PropertyService.java
@@ -0,0 +1,5 @@
+package testing;
+
+public interface PropertyService {
+
+}
diff --git a/sandbox/bdaniel/propertyTest/src/main/resources/META-INF/sca/default.scdl b/sandbox/bdaniel/propertyTest/src/main/resources/META-INF/sca/default.scdl
new file mode 100644
index 0000000000..00340fc1f9
--- /dev/null
+++ b/sandbox/bdaniel/propertyTest/src/main/resources/META-INF/sca/default.scdl
@@ -0,0 +1,69 @@
+<?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:foo="http://foo"
+ name="PropertyTest">
+
+ <!-- <property name="manyValued" type="xsd:string" many="true"/> -->
+
+ <property name="number" type="xsd:int">1</property>
+
+ <property name="complex" type="foo:MyComplexType">
+ <foo:a>a</foo:a>
+ <foo:b>b</foo:b>
+ <foo:c>c</foo:c>
+ <foo:d>d</foo:d>
+ <foo:x>
+ <y>y</y>
+ <z>z</z>
+ </foo:x>
+
+ </property>
+
+ <component name="ABCDComponent">
+ <implementation.java class="testing.ABCDComponentImpl"/>
+ <reference name="ab">ABComponent</reference>
+ <reference name="cd">CDComponent</reference>
+ </component>
+
+ <component name="ABComponent">
+ <implementation.java class="testing.ABComponentImpl"/>
+ <property name="a" source="$complex/foo:a"/>
+ <property name="b" source="$complex/foo:b"/>
+ <property name="f" source="$complex/foo:a">f</property>
+ <property name="xpath" source="$complex/foo:x/*[local-name()='z']"/>
+ <property name="one" source="$number"/>
+ </component>
+
+ <component name="CDComponent">
+ <implementation.java class="testing.CDComponentImpl"/>
+ <property name="c" source="$complex/foo:c"/>
+ <property name="d" source="$complex/foo:d"/>
+ <property name="nosource">aValue</property>
+ <property name="fileProperty" file="META-INF/sca/fileProperty.txt"/>
+ <property name="nonFileProperty" file="META-INF/sca/fileProperty.txt" source="$complex/foo:c"/>
+ <property name="two" source="$number">2</property>
+ </component>
+
+<!-- <component name="Override">
+ <implementation.composite name="OverrideComposite" scdlLocation="override.scdl"/>
+ </component>
+ -->
+</composite>
diff --git a/sandbox/bdaniel/propertyTest/src/main/resources/META-INF/sca/fileProperty.txt b/sandbox/bdaniel/propertyTest/src/main/resources/META-INF/sca/fileProperty.txt
new file mode 100644
index 0000000000..4e22b1bac4
--- /dev/null
+++ b/sandbox/bdaniel/propertyTest/src/main/resources/META-INF/sca/fileProperty.txt
@@ -0,0 +1 @@
+<filePropertyTest>fileValue</filePropertyTest>
diff --git a/sandbox/bdaniel/propertyTest/src/test/java/testing/PropertyITest.java b/sandbox/bdaniel/propertyTest/src/test/java/testing/PropertyITest.java
new file mode 100644
index 0000000000..79e58229a7
--- /dev/null
+++ b/sandbox/bdaniel/propertyTest/src/test/java/testing/PropertyITest.java
@@ -0,0 +1,76 @@
+package testing;
+
+import junit.framework.TestCase;
+
+import org.osoa.sca.CurrentCompositeContext;
+
+public class PropertyITest extends TestCase {
+ private ABComponent abService;
+ private CDComponent cdService;
+ private ABCDComponent abcdService;
+ // private PropertyService propertyService;
+
+
+ public void testA() {
+ assertEquals("a", abService.getA());
+ }
+
+ public void testB() {
+ assertEquals("b", abService.getB());
+ }
+
+ public void testC() {
+ assertEquals("c", cdService.getC());
+ }
+
+ public void testC2() {
+ assertEquals("c", cdService.getC2());
+ }
+ public void testD() {
+ assertEquals("d", cdService.getD());
+ }
+
+ public void testF() {
+ assertEquals("a", abService.getF());
+ }
+
+ public void testZ() {
+ assertEquals("z", abService.getZ());
+ }
+
+
+ public void testIntValue() {
+ assertEquals(1, abService.getIntValue());
+ }
+
+ public void testDefaultValue() {
+ assertEquals(1, abService.getIntValue());
+ }
+
+ public void testDefaultValueOverride() {
+ assertEquals(1, cdService.getOverrideValue());
+ }
+
+ public void testNoSource() {
+ assertEquals("aValue", cdService.getNoSource());
+ }
+
+ public void testFileProperty() {
+ assertEquals("fileValue", cdService.getFileProperty());
+ }
+
+ public void testABCD() {
+ assertEquals("a", abcdService.getA());
+ assertEquals("b", abcdService.getB());
+ assertEquals("c", abcdService.getC());
+ assertEquals("d", abcdService.getD());
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ abService = CurrentCompositeContext.getContext().locateService(ABComponent.class, "ABComponent");
+ cdService = CurrentCompositeContext.getContext().locateService(CDComponent.class, "CDComponent");
+ abcdService = CurrentCompositeContext.getContext().locateService(ABCDComponent.class, "ABCDComponent");
+ // propertyService = CurrentCompositeContext.getContext().locateService(PropertyService.class, "PropertyService");
+ }
+}