summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery
diff options
context:
space:
mode:
authorlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:06:58 +0000
committerlresende <lresende@13f79535-47bb-0310-9956-ffa450edef68>2009-11-11 23:06:58 +0000
commit3dd7e2c4da9c80b8182a2d04dc129a67aa7910df (patch)
tree71b970aa1c5987564405511d3912044387118fd4 /sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery
parent0f3f9b59b310833f31ba234ee4aefa808649833c (diff)
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835121 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery')
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/pom.xml168
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java29
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java29
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java27
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java30
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java29
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java28
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java42
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java31
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java31
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java67
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/TestHelper.java144
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join.xq37
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_external_references.xq49
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq48
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/wsdl/AvailQuote.xsd39
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/wsdl/PriceQuote.xsd49
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/wsdl/Quote.xsd40
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/wsdl/availquoteprovider.wsdl80
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/wsdl/quotejoin.wsdl89
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/xqueryquotews.composite49
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite108
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java145
-rw-r--r--sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteTestServer.java50
27 files changed, 1528 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/pom.xml b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/pom.xml
new file mode 100644
index 0000000000..387a25eaea
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/pom.xml
@@ -0,0 +1,168 @@
+<?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.
+-->
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-sca</artifactId>
+ <version>0.99-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+ <artifactId>sample-quote-xquery</artifactId>
+ <name>Apache Tuscany XQuery Quote Implementation Sample</name>
+
+ <repositories>
+ <repository>
+ <id>apache.incubator</id>
+ <url>http://people.apache.org/repo/m2-incubating-repository</url>
+ </repository>
+ </repositories>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>0.99-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>0.99-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-xquery</artifactId>
+ <version>0.99-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>0.99-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-lib</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-impl</artifactId>
+ <version>1.0-incubating</version>
+ </dependency>
+
+ <dependency>
+ <groupId>net.sf.saxon</groupId>
+ <artifactId>saxon</artifactId>
+ <version>8.9</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-databinding-sdo</artifactId>
+ <version>0.99-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-http-jetty</artifactId>
+ <version>0.99-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.2</version>
+ <scope>compile</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.0</version>
+ <executions>
+ <execution>
+ <id>add-source</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>target/sdo-source</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tuscany.sdo</groupId>
+ <artifactId>tuscany-sdo-plugin</artifactId>
+ <version>1.0-incubating</version>
+ <executions>
+ <execution>
+ <id>generate-quote-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl/Quote.xsd</schemaFile>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>generate-avail-quote-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl/AvailQuote.xsd</schemaFile>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>generate-price-quote-sdo</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <schemaFile>${basedir}/src/main/resources/wsdl/PriceQuote.xsd</schemaFile>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java
new file mode 100644
index 0000000000..146939c190
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java
@@ -0,0 +1,30 @@
+/*
+ * 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 xquery.quote;
+
+import org.example.avail.AvailQuote;
+import org.osoa.sca.annotations.Service;
+
+@Service(AvailQuoteProviderService.class)
+public class AvailQuoteProviderImpl implements AvailQuoteProviderService {
+
+ public AvailQuote provideAvailQuote(String dummyString) {
+ return TestHelper.buildAvailQuoteData();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java
new file mode 100644
index 0000000000..ac55c02efa
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java
@@ -0,0 +1,30 @@
+/*
+ * 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 xquery.quote;
+
+import net.sf.saxon.om.NodeInfo;
+
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+@Remotable
+@Service
+public interface AvailQuoteProviderNodeInfo {
+ NodeInfo provideAvailQuote(String dummyString);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java
new file mode 100644
index 0000000000..2715be19a9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java
@@ -0,0 +1,29 @@
+/*
+ * 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 xquery.quote;
+
+import org.example.avail.AvailQuote;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+@Remotable
+@Service
+public interface AvailQuoteProviderService {
+ AvailQuote provideAvailQuote(String dummyString);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java
new file mode 100644
index 0000000000..84abb5c520
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java
@@ -0,0 +1,29 @@
+/*
+ * 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 xquery.quote;
+
+import org.example.quote.Quote;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+@Remotable
+@Service
+public interface ExternalReferencesQuoteJoin {
+ public Quote joinPriceAndAvailQuotes(float taxRate);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java
new file mode 100644
index 0000000000..a8bfc6ca1f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java
@@ -0,0 +1,30 @@
+/*
+ * 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 xquery.quote;
+
+import org.example.price.PriceQuote;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+@Remotable
+@Service
+public interface PriceQuoteProvider {
+
+ public PriceQuote providePriceQuote();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java
new file mode 100644
index 0000000000..cbd71f6279
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java
@@ -0,0 +1,27 @@
+/*
+ * 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 xquery.quote;
+
+import org.example.price.PriceQuote;
+
+public class PriceQuoteProviderImpl implements PriceQuoteProvider {
+ public PriceQuote providePriceQuote() {
+ return TestHelper.buildPriceQuoteData();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java
new file mode 100644
index 0000000000..c95c979c64
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java
@@ -0,0 +1,30 @@
+/*
+ * 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 xquery.quote;
+
+import net.sf.saxon.om.NodeInfo;
+
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+@Remotable
+@Service
+public interface PriceQuoteProviderNodeInfo {
+ public NodeInfo providePriceQuote();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java
new file mode 100644
index 0000000000..3a70f619a0
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java
@@ -0,0 +1,29 @@
+/*
+ * 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 xquery.quote;
+
+import org.example.quote.Quote;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+@Remotable
+@Service
+public interface PropertiesQuoteJoin {
+ public Quote joinPriceAndAvailQuotes();
+}
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java
new file mode 100644
index 0000000000..0b90c9fb0f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java
@@ -0,0 +1,28 @@
+/*
+ * 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 xquery.quote;
+
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+@Remotable
+@Service
+public interface QuoteCalculator {
+ public float calculateTotalPrice(float taxRate, int quantity, float price, boolean fillOrder);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java
new file mode 100644
index 0000000000..34fd24fbe5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java
@@ -0,0 +1,42 @@
+/*
+ * 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 xquery.quote;
+
+public class QuoteCalculatorImpl implements QuoteCalculator {
+
+ public float calculateTotalPrice(float taxRate, int quantity, float price,
+ boolean fillOrder) {
+ float totalTax, costNoTax, totalCost;
+ if (fillOrder)
+ {
+ // Calculate the total tax
+ totalTax = taxRate * quantity * price;
+ // Calculate the total cost without tax
+ costNoTax = quantity * price;
+ // Add the tax and the cost to get the total cost
+ totalCost = totalTax + costNoTax;
+ }
+ else
+ {
+ totalCost = 0;
+ }
+ return totalCost;
+ }
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java
new file mode 100644
index 0000000000..fd16c4b4c5
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java
@@ -0,0 +1,31 @@
+/*
+ * 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 xquery.quote;
+
+import org.example.avail.AvailQuote;
+import org.example.price.PriceQuote;
+import org.example.quote.Quote;
+import org.osoa.sca.annotations.Remotable;
+import org.osoa.sca.annotations.Service;
+
+@Remotable
+@Service
+public interface QuoteJoin {
+ public Quote joinPriceAndAvailQuotes(PriceQuote priceQuote, AvailQuote availQuote, float taxRate);
+}
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java
new file mode 100644
index 0000000000..5d1c7066fe
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java
@@ -0,0 +1,31 @@
+/*
+ * 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 xquery.quote;
+
+import org.example.avail.AvailQuote;
+import org.example.price.PriceQuote;
+import org.example.quote.Quote;
+
+public interface QuoteJoinLocal {
+ public Quote joinPriceAndAvailQuotes(PriceQuote priceQuote, AvailQuote availQuote, float taxRate);
+ public Quote joinPriceAndAvailQuotesWs(PriceQuote priceQuote, AvailQuote availQuote, float taxRate);
+ public Quote joinPriceAndAvailQuotes();
+ public Quote joinPriceAndAvailQuotes(float taxRate);
+
+}
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java
new file mode 100644
index 0000000000..2eff74fbc1
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java
@@ -0,0 +1,67 @@
+/*
+ * 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 xquery.quote;
+
+import org.example.avail.AvailQuote;
+import org.example.price.PriceQuote;
+import org.example.quote.Quote;
+import org.osoa.sca.annotations.Reference;
+
+public class QuoteJoinLocalImpl implements QuoteJoinLocal {
+ private QuoteJoin quoteJoin;
+ private QuoteJoin quoteJoinWs;
+ private PropertiesQuoteJoin propertiesQuoteJoin;
+ private ExternalReferencesQuoteJoin externalServicesQuoteJoin;
+
+ @Reference
+ public void setQuoteJoin(QuoteJoin quoteJoin) {
+ this.quoteJoin = quoteJoin;
+ }
+
+ @Reference
+ public void setQuoteJoinWs(QuoteJoin quoteJoinWs) {
+ this.quoteJoinWs = quoteJoinWs;
+ }
+
+ @Reference
+ public void setPropertiesQuoteJoin(PropertiesQuoteJoin propertiesQuoteJoin) {
+ this.propertiesQuoteJoin = propertiesQuoteJoin;
+ }
+
+ @Reference
+ public void setExternalServicesQuoteJoin(ExternalReferencesQuoteJoin externalServicesQuoteJoin) {
+ this.externalServicesQuoteJoin = externalServicesQuoteJoin;
+ }
+
+ public Quote joinPriceAndAvailQuotes(PriceQuote priceQuote, AvailQuote availQuote, float taxRate) {
+ return quoteJoin.joinPriceAndAvailQuotes(priceQuote, availQuote, taxRate);
+ }
+
+ public Quote joinPriceAndAvailQuotesWs(PriceQuote priceQuote, AvailQuote availQuote, float taxRate) {
+ return quoteJoinWs.joinPriceAndAvailQuotes(priceQuote, availQuote, taxRate);
+ }
+
+ public Quote joinPriceAndAvailQuotes(float taxRate) {
+ return externalServicesQuoteJoin.joinPriceAndAvailQuotes(taxRate);
+ }
+
+ public Quote joinPriceAndAvailQuotes() {
+ return propertiesQuoteJoin.joinPriceAndAvailQuotes();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/TestHelper.java b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/TestHelper.java
new file mode 100644
index 0000000000..65b4df0468
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/TestHelper.java
@@ -0,0 +1,144 @@
+/*
+ * 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 xquery.quote;
+
+
+import java.io.IOException;
+import java.math.BigInteger;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.example.avail.AvailFactory;
+import org.example.avail.AvailQuote;
+import org.example.avail.AvailRequest;
+import org.example.price.PriceFactory;
+import org.example.price.PriceQuote;
+import org.example.price.PriceRequest;
+import org.example.price.PriceRequests;
+import org.example.price.ShipAddress;
+import org.example.quote.Quote;
+import org.example.quote.QuoteResponse;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.helper.XMLHelper;
+import commonj.sdo.impl.HelperProvider;
+
+public class TestHelper {
+
+ public static AvailQuote buildAvailQuoteData() {
+ AvailQuote availQuote = AvailFactory.INSTANCE.createAvailQuote();
+ AvailRequest availRequest = AvailFactory.INSTANCE.createAvailRequest();
+ availRequest.setWidgetId(BigInteger.valueOf(12));
+ availRequest.setRequestedQuantity(10);
+ availRequest.setQuantityAvail(true);
+ availRequest.setShipDate("2003-03-22");
+ availQuote.getAvailRequest().add(availRequest);
+
+ availRequest = AvailFactory.INSTANCE.createAvailRequest();
+ availRequest.setWidgetId(BigInteger.valueOf(134));
+ availRequest.setRequestedQuantity(345);
+ availRequest.setQuantityAvail(false);
+ availRequest.setShipDate("BackOrder");
+ availQuote.getAvailRequest().add(availRequest);
+
+ availRequest = AvailFactory.INSTANCE.createAvailRequest();
+ availRequest.setWidgetId(BigInteger.valueOf(211));
+ availRequest.setRequestedQuantity(100);
+ availRequest.setQuantityAvail(true);
+ availRequest.setShipDate("2003-04-21");
+ availQuote.getAvailRequest().add(availRequest);
+
+ return availQuote;
+ }
+
+ public static PriceQuote buildPriceQuoteData() {
+ PriceQuote priceQuote = PriceFactory.INSTANCE.createPriceQuote();
+ priceQuote.setCustomerName("Acme Inc");
+
+ ShipAddress shipAddress = PriceFactory.INSTANCE.createShipAddress();
+ shipAddress.setStreet("12 Springs Rd");
+ shipAddress.setCity("Morris Plains");
+ shipAddress.setState("nj");
+ shipAddress.setZip("07960");
+ priceQuote.setShipAddress(shipAddress);
+
+ PriceRequests priceRequests = PriceFactory.INSTANCE.createPriceRequests();
+ PriceRequest priceRequest = PriceFactory.INSTANCE.createPriceRequest();
+ priceRequest.setWidgetId(BigInteger.valueOf(12));
+ priceRequest.setPrice(1.00f);
+ priceRequests.getPriceRequest().add(priceRequest);
+
+ priceRequest = PriceFactory.INSTANCE.createPriceRequest();
+ priceRequest.setWidgetId(BigInteger.valueOf(134));
+ priceRequest.setPrice(34.10f);
+ priceRequests.getPriceRequest().add(priceRequest);
+
+ priceRequest = PriceFactory.INSTANCE.createPriceRequest();
+ priceRequest.setWidgetId(BigInteger.valueOf(211));
+ priceRequest.setPrice(10.00f);
+ priceRequests.getPriceRequest().add(priceRequest);
+
+ priceQuote.setPriceRequests(priceRequests);
+
+ return priceQuote;
+ }
+
+ public static void assertQuote(AvailQuote availQuote, PriceQuote priceQuote, Quote quote, float taxRate) {
+ QuoteCalculatorImpl quoteCalculatorImpl = new QuoteCalculatorImpl();
+
+ TestCase.assertEquals(priceQuote.getCustomerName(), quote.getName());
+ ShipAddress shipAddress = priceQuote.getShipAddress();
+ TestCase.assertEquals(shipAddress.getStreet()+","+shipAddress.getCity()+","+shipAddress.getState().toUpperCase()+","+shipAddress.getZip(), quote.getAddress());
+ List availRequests = availQuote.getAvailRequest();
+ List priceRequests = priceQuote.getPriceRequests().getPriceRequest();
+ List quoteResponses = quote.getQuoteResponse();
+ TestCase.assertEquals(availRequests.size(), priceRequests.size());
+ TestCase.assertEquals(availRequests.size(), quoteResponses.size());
+
+ for(int i=0; i<availRequests.size(); i++) {
+ AvailRequest availRequest = (AvailRequest)availRequests.get(i);
+ PriceRequest priceRequest = (PriceRequest)priceRequests.get(i);
+ QuoteResponse quoteResponse = (QuoteResponse)quoteResponses.get(i);
+ TestCase.assertEquals(availRequest.getWidgetId(), quoteResponse.getWidgetId());
+ TestCase.assertEquals(priceRequest.getPrice(), quoteResponse.getUnitPrice());
+ TestCase.assertEquals(availRequest.getRequestedQuantity(), quoteResponse.getRequestedQuantity());
+ TestCase.assertEquals(availRequest.isQuantityAvail(), quoteResponse.isFillOrder());
+ if(availRequest.getShipDate()==null) {
+ TestCase.assertNull(quoteResponse.getShipDate());
+ } else {
+ TestCase.assertEquals(availRequest.getShipDate(), quoteResponse.getShipDate());
+ }
+ TestCase.assertEquals(taxRate, quoteResponse.getTaxRate());
+ TestCase.assertEquals(quoteCalculatorImpl.calculateTotalPrice(taxRate, availRequest.getRequestedQuantity(), priceRequest.getPrice(), availRequest.isQuantityAvail()), quoteResponse.getTotalCost());
+ }
+ }
+
+ public static void serializeToSystemOut(DataObject object, String name) {
+ XMLHelper helper = HelperProvider.INSTANCE.xmlHelper();
+
+ try {
+ helper.save(object, null, name, System.out);
+ System.out.println();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join.xq b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join.xq
new file mode 100644
index 0000000000..9c521ae67b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join.xq
@@ -0,0 +1,37 @@
+declare namespace quoteJoin="scaservice:java/xquery.quote.QuoteJoin";
+
+declare namespace quoteCalculator="scareference:java/xquery.quote.QuoteCalculator";
+
+declare variable $quoteCalculator external;
+
+declare function quoteJoin:joinPriceAndAvailQuotes($priceQuoteDoc, $availQuoteDoc, $taxRate) {
+<quote>
+ <name>{ data($priceQuoteDoc/priceQuote/customerName) }</name>
+ <address>{ concat($priceQuoteDoc/priceQuote/shipAddress/@street , ",", $priceQuoteDoc/priceQuote/shipAddress/@city ,",", fn:upper-case($priceQuoteDoc/priceQuote/shipAddress/@state) , ",", $priceQuoteDoc/priceQuote/shipAddress/@zip) }</address>
+ {
+ for $priceRequest in $priceQuoteDoc/priceQuote/priceRequests/priceRequest,
+ $availRequest in $availQuoteDoc/availQuote/availRequest
+ where data($priceRequest/widgetId) = data($availRequest/widgetId)
+ return
+ <quoteResponse>
+ <widgetId>{ data($priceRequest/widgetId) }</widgetId>
+ <unitPrice>{ data($priceRequest/price) }</unitPrice>
+ <requestedQuantity>{ data($availRequest/requestedQuantity) }</requestedQuantity>
+ <fillOrder>{ data($availRequest/quantityAvail) }</fillOrder>
+ {
+ for $shipDate in $availRequest/shipDate
+ return
+ <shipDate>{ data($shipDate) }</shipDate>
+ }
+ <taxRate>{ $taxRate }</taxRate>
+ <totalCost>{ quoteCalculator:calculateTotalPrice(
+ $quoteCalculator,
+
+ $taxRate,
+ $availRequest/requestedQuantity,
+ $priceRequest/price,
+ $availRequest/quantityAvail) }</totalCost>
+ </quoteResponse>
+ }
+ </quote>
+}; \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_external_references.xq b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_external_references.xq
new file mode 100644
index 0000000000..d6c6356080
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_external_references.xq
@@ -0,0 +1,49 @@
+declare namespace quoteJoin="scaservice:java/xquery.quote.ExternalReferencesQuoteJoin";
+
+declare namespace quoteCalculator="scareference:java/xquery.quote.QuoteCalculator";
+
+declare namespace priceQuoteProvider="scareference:java/xquery.quote.PriceQuoteProviderNodeInfo";
+declare namespace availQuoteProvider="scareference:java/xquery.quote.AvailQuoteProviderNodeInfo";
+
+declare variable $quoteCalculator external;
+
+declare variable $priceQuoteProvider external;
+declare variable $availQuoteProvider external;
+
+declare function quoteJoin:joinPriceAndAvailQuotes($taxRate) {
+let $priceQuoteDoc := priceQuoteProvider:providePriceQuote($priceQuoteProvider)
+let $availQuoteDoc := availQuoteProvider:provideAvailQuote($availQuoteProvider, 'dummy')
+return
+<quote>
+ <name>{ data($priceQuoteDoc/priceQuote/customerName) }</name>
+ <address>{ concat($priceQuoteDoc/priceQuote/shipAddress/@street , ",", $priceQuoteDoc/priceQuote/shipAddress/@city ,",", fn:upper-case($priceQuoteDoc/priceQuote/shipAddress/@state) , ",", $priceQuoteDoc/priceQuote/shipAddress/@zip) }</address>
+ {
+ for $priceRequest in $priceQuoteDoc/priceQuote/priceRequests/priceRequest,
+ $availRequest in $availQuoteDoc/availQuote/availRequest
+ where data($priceRequest/widgetId) = data($availRequest/widgetId)
+ return
+ <quoteResponse>
+ <widgetId>{ data($priceRequest/widgetId) }</widgetId>
+ <unitPrice>{ data($priceRequest/price) }</unitPrice>
+ <requestedQuantity>{ data($availRequest/requestedQuantity) }</requestedQuantity>
+ <fillOrder>{ data($availRequest/quantityAvail) }</fillOrder>
+ {
+ for $shipDate in $availRequest/shipDate
+ return
+ <shipDate>{ data($shipDate) }</shipDate>
+ }
+ <taxRate>{ $taxRate }</taxRate>
+ <totalCost>{ quoteCalculator:calculateTotalPrice(
+ $quoteCalculator,
+
+ $taxRate,
+
+ $availRequest/requestedQuantity,
+
+ $priceRequest/price,
+
+ $availRequest/quantityAvail) }</totalCost>
+ </quoteResponse>
+ }
+ </quote>
+}; \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq
new file mode 100644
index 0000000000..62275b41f8
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/META-INF/sca/quote_join_properties.xq
@@ -0,0 +1,48 @@
+declare namespace quoteJoin="scaservice:java/xquery.quote.PropertiesQuoteJoin";
+
+declare namespace quoteCalculator="scareference:java/xquery.quote.QuoteCalculator";
+
+declare namespace priceQuoteDoc="scaproperty:xml/http://www.example.org/price:priceQuote";
+declare namespace availQuoteDoc="scaproperty:xml/http://www.example.org/avail:availQuote";
+declare namespace taxRate="scaproperty:java/java.lang.Float";
+
+declare variable $quoteCalculator external;
+
+declare variable $priceQuoteDoc external;
+declare variable $availQuoteDoc external;
+declare variable $taxRate external;
+
+declare function quoteJoin:joinPriceAndAvailQuotes() {
+<quote>
+ <name>{ data($priceQuoteDoc/priceQuote/customerName) }</name>
+ <address>{ concat($priceQuoteDoc/priceQuote/shipAddress/@street , ",", $priceQuoteDoc/priceQuote/shipAddress/@city ,",", fn:upper-case($priceQuoteDoc/priceQuote/shipAddress/@state) , ",", $priceQuoteDoc/priceQuote/shipAddress/@zip) }</address>
+ {
+ for $priceRequest in $priceQuoteDoc/priceQuote/priceRequests/priceRequest,
+ $availRequest in $availQuoteDoc/availQuote/availRequest
+ where data($priceRequest/widgetId) = data($availRequest/widgetId)
+ return
+ <quoteResponse>
+ <widgetId>{ data($priceRequest/widgetId) }</widgetId>
+ <unitPrice>{ data($priceRequest/price) }</unitPrice>
+ <requestedQuantity>{ data($availRequest/requestedQuantity) }</requestedQuantity>
+ <fillOrder>{ data($availRequest/quantityAvail) }</fillOrder>
+ {
+ for $shipDate in $availRequest/shipDate
+ return
+ <shipDate>{ data($shipDate) }</shipDate>
+ }
+ <taxRate>{ $taxRate }</taxRate>
+ <totalCost>{ quoteCalculator:calculateTotalPrice(
+ $quoteCalculator,
+
+ $taxRate,
+
+ $availRequest/requestedQuantity,
+
+ $priceRequest/price,
+
+ $availRequest/quantityAvail) }</totalCost>
+ </quoteResponse>
+ }
+ </quote>
+}; \ No newline at end of file
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/wsdl/AvailQuote.xsd b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/wsdl/AvailQuote.xsd
new file mode 100644
index 0000000000..e7f3e67068
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/wsdl/AvailQuote.xsd
@@ -0,0 +1,39 @@
+<?xml version="1.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.
+-->
+<xsd:schema targetNamespace="http://www.example.org/avail" xmlns:ava="http://www.example.org/avail" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified">
+ <xsd:element name="availQuote" type="ava:AvailQuote"/>
+ <xsd:complexType name="AvailRequest">
+ <xsd:sequence>
+ <xsd:element name="widgetId" type="xsd:integer"/>
+ <xsd:element name="requestedQuantity" type="xsd:int"/>
+ <xsd:element name="quantityAvail" type="xsd:boolean"/>
+ <xsd:element name="shipDate" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="AvailQuote">
+ <xsd:sequence>
+ <xsd:element name="availRequest" type="ava:AvailRequest" minOccurs="1" maxOccurs="10">
+ </xsd:element>
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:schema>
+
+
+
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/wsdl/PriceQuote.xsd b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/wsdl/PriceQuote.xsd
new file mode 100644
index 0000000000..4c437586ef
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/wsdl/PriceQuote.xsd
@@ -0,0 +1,49 @@
+<?xml version="1.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.
+-->
+<xsd:schema targetNamespace="http://www.example.org/price" xmlns:pri="http://www.example.org/price" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified">
+ <xsd:element name="priceQuote" type="pri:PriceQuote"/>
+ <xsd:complexType name="PriceRequest">
+ <xsd:sequence>
+ <xsd:element name="widgetId" type="xsd:integer"/>
+ <xsd:element name="price" type="xsd:float"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="PriceRequests">
+ <xsd:sequence>
+ <xsd:element name="priceRequest" type="pri:PriceRequest" minOccurs="1" maxOccurs="10"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="ShipAddress">
+ <xsd:attribute name="street" type="xsd:string"/>
+ <xsd:attribute name="city" type="xsd:string"/>
+ <xsd:attribute name="state" type="xsd:string"/>
+ <xsd:attribute name="zip" type="xsd:string"/>
+ </xsd:complexType>
+ <xsd:complexType name="PriceQuote">
+ <xsd:sequence>
+ <xsd:element name="customerName" type="xsd:string" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="shipAddress" type="pri:ShipAddress" minOccurs="1" maxOccurs="1"/>
+ <xsd:element name="priceRequests" type="pri:PriceRequests"/>
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:schema>
+
+
+
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/wsdl/Quote.xsd b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/wsdl/Quote.xsd
new file mode 100644
index 0000000000..4f64850056
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/wsdl/Quote.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.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.
+-->
+<xsd:schema targetNamespace="http://www.example.org/quote" xmlns:quo="http://www.example.org/quote" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" attributeFormDefault="unqualified">
+ <xsd:element name="quote" type="quo:Quote"/>
+ <xsd:complexType name="Quote">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string"/>
+ <xsd:element name="address" type="xsd:string"/>
+ <xsd:element name="quoteResponse" type="quo:QuoteResponse" minOccurs="1" maxOccurs="10"/>
+ </xsd:sequence>
+ </xsd:complexType>
+ <xsd:complexType name="QuoteResponse">
+ <xsd:sequence>
+ <xsd:element name="widgetId" type="xsd:integer"/>
+ <xsd:element name="unitPrice" type="xsd:float" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="requestedQuantity" type="xsd:int"/>
+ <xsd:element name="fillOrder" type="xsd:boolean"/>
+ <xsd:element name="shipDate" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="taxRate" type="xsd:float" minOccurs="0" maxOccurs="1"/>
+ <xsd:element name="totalCost" type="xsd:float" minOccurs="0" maxOccurs="1"/>
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:schema>
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/wsdl/availquoteprovider.wsdl b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/wsdl/availquoteprovider.wsdl
new file mode 100644
index 0000000000..f4744c8a14
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/wsdl/availquoteprovider.wsdl
@@ -0,0 +1,80 @@
+<?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.
+-->
+<wsdl:definitions targetNamespace="http://quote.xquery" xmlns:tns="http://quote.xquery"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:ava="http://www.example.org/avail" name="quotejoin">
+
+ <wsdl:import namespace="http://www.example.org/avail" location="AvailQuote.xsd"/>
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://quote.xquery"
+ xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ava="http://www.example.org/avail">
+
+ <element name="provideAvailQuote">
+ <complexType>
+ <sequence>
+ <element name="provideAvailQuote" type="xsd:String" />
+ </sequence>
+ </complexType>
+ </element>
+ <element name="provideAvailQuoteResponse">
+ <complexType>
+ <sequence>
+ <element name="provideAvailQuoteReturn" type="ava:AvailQuote" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="provideAvailQuoteRequest">
+ <wsdl:part element="tns:provideAvailQuote" name="parameters" />
+ </wsdl:message>
+ <wsdl:message name="provideAvailQuoteResponse">
+ <wsdl:part element="tns:provideAvailQuoteResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:portType name="AvailQuoteProvider">
+ <wsdl:operation name="provideAvailQuote">
+ <wsdl:input message="tns:provideAvailQuoteRequest" name="provideAvailQuoteRequest" />
+ <wsdl:output message="tns:provideAvailQuoteResponse" name="provideAvailQuoteResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="AvailQuoteProviderSoapBinding" type="tns:AvailQuoteProvider">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="provideAvailQuote">
+ <wsdlsoap:operation soapAction="" />
+ <wsdl:input name="provideAvailQuoteRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="provideAvailQuoteResponse">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="AvailQuoteProviderService">
+ <wsdl:port binding="tns:AvailQuoteProviderSoapBinding" name="AvailQuoteProviderSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/AvailQuoteProviderService" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/wsdl/quotejoin.wsdl b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/wsdl/quotejoin.wsdl
new file mode 100644
index 0000000000..b48dc2117b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/wsdl/quotejoin.wsdl
@@ -0,0 +1,89 @@
+<?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.
+-->
+<wsdl:definitions targetNamespace="http://quote.xquery" xmlns:tns="http://quote.xquery"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:ava="http://www.example.org/avail"
+ xmlns:pri="http://www.example.org/price"
+ xmlns:quo="http://www.example.org/quote" name="quotejoin">
+
+ <wsdl:import namespace="http://www.example.org/avail" location="AvailQuote.xsd"/>
+ <wsdl:import namespace="http://www.example.org/price" location="PriceQuote.xsd"/>
+ <wsdl:import namespace="http://www.example.org/quote" location="Quote.xsd"/>
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://quote.xquery"
+ xmlns="http://www.w3.org/2001/XMLSchema" xmlns:ava="http://www.example.org/avail"
+ xmlns:pri="http://www.example.org/price" xmlns:quo="http://www.example.org/quote">
+
+ <element name="joinPriceAndAvailQuotes">
+ <complexType>
+ <sequence>
+ <element name="priceQuote" type="pri:PriceQuote" />
+ <element name="availQuote" type="ava:AvailQuote" />
+ <element name="taxRate" type="xsd:float" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="joinPriceAndAvailQuotesResponse">
+ <complexType>
+ <sequence>
+ <element name="joinPriceAndAvailQuotesReturn" type="quo:Quote" />
+ </sequence>
+ </complexType>
+ </element>
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="joinPriceAndAvailQuotesRequest">
+ <wsdl:part element="tns:joinPriceAndAvailQuotes" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="joinPriceAndAvailQuotesResponse">
+ <wsdl:part element="tns:joinPriceAndAvailQuotesResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:portType name="QuoteJoin">
+ <wsdl:operation name="joinPriceAndAvailQuotes">
+ <wsdl:input message="tns:joinPriceAndAvailQuotesRequest" name="joinPriceAndAvailQuotesRequest" />
+ <wsdl:output message="tns:joinPriceAndAvailQuotesResponse" name="joinPriceAndAvailQuotesResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="QuoteJoinSoapBinding" type="tns:QuoteJoin">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="joinPriceAndAvailQuotes">
+ <wsdlsoap:operation soapAction="" />
+ <wsdl:input name="joinPriceAndAvailQuotesRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="joinPriceAndAvailQuotesResponse">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="QuoteJoinService">
+ <wsdl:port binding="tns:QuoteJoinSoapBinding" name="QuoteJoinSoapPort">
+ <wsdlsoap:address location="http://localhost:8085/QuoteJoinService" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/xqueryquotews.composite b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/xqueryquotews.composite
new file mode 100644
index 0000000000..fc360d7d6f
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/xqueryquotews.composite
@@ -0,0 +1,49 @@
+<?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" targetNamespace="http://quote.xquery"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0" xmlns:xq="http://quote.xquery"
+ name="xqueryquotews">
+
+ <dbsdo:import.sdo factory="org.example.avail.AvailFactory"/>
+ <dbsdo:import.sdo factory="org.example.price.PriceFactory"/>
+ <dbsdo:import.sdo factory="org.example.quote.QuoteFactory"/>
+
+ <component name="QuoteJoinServerComponent">
+ <service name="QuoteJoin">
+ <interface.java interface="xquery.quote.QuoteJoin" />
+ <binding.ws wsdlElement="http://quote.xquery#wsdl.port(QuoteJoinService/QuoteJoinSoapPort)"/>
+ </service>
+ <implementation.xquery location="META-INF/sca/quote_join.xq"/>
+ <reference name="quoteCalculator" target="QuoteCalculatorServerComponent" />
+ </component>
+
+ <component name="QuoteCalculatorServerComponent">
+ <implementation.java class="xquery.quote.QuoteCalculatorImpl"/>
+ </component>
+
+ <component name="AvailQuoteProviderComponent">
+ <service name="AvailQuoteProvider">
+ <interface.java interface="xquery.quote.AvailQuoteProviderService" />
+ <binding.ws wsdlElement="http://quote.xquery#wsdl.port(AvailQuoteProviderService/AvailQuoteProviderSoapPort)"/>
+ </service>
+ <implementation.java class="xquery.quote.AvailQuoteProviderImpl" />
+ </component>
+
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite
new file mode 100644
index 0000000000..dbdf2b677c
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/main/resources/xqueryquotewsclient.composite
@@ -0,0 +1,108 @@
+<?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" targetNamespace="http://quote.xquery/client"
+ xmlns:dbsdo="http://tuscany.apache.org/xmlns/sca/databinding/sdo/1.0"
+ xmlns:xq="http://quote.xquery/client" name="xqueryquotewsclient">
+
+ <dbsdo:import.sdo factory="org.example.avail.AvailFactory"/>
+ <dbsdo:import.sdo factory="org.example.price.PriceFactory"/>
+ <dbsdo:import.sdo factory="org.example.quote.QuoteFactory"/>
+
+ <component name="QuoteJoinLocalComponent">
+ <implementation.java class="xquery.quote.QuoteJoinLocalImpl"/>
+ <reference name="quoteJoin" target="QuoteJoinComponent"/>
+ <reference name="propertiesQuoteJoin" target="QuoteJoinPropertiesComponent"/>
+ <reference name="externalServicesQuoteJoin" target="QuoteJoinExternalReferencesComponent"/>
+ </component>
+
+ <component name="QuoteJoinComponent">
+ <implementation.xquery location="META-INF/sca/quote_join.xq"/>
+ <reference name="quoteCalculator" target="QuoteCalculatorComponent" />
+ </component>
+ <component name="QuoteJoinPropertiesComponent">
+ <implementation.xquery location="META-INF/sca/quote_join_properties.xq"/>
+ <property name="priceQuoteDoc">
+ <pri:priceQuote xmlns:pri="http://www.example.org/price">
+ <pri:customerName>Acme Inc</pri:customerName>
+ <pri:shipAddress pri:street="12 Springs Rd" pri:city="Morris Plains" pri:state="nj" pri:zip="07960"/>
+ <pri:priceRequests>
+ <pri:priceRequest>
+ <pri:widgetId>12</pri:widgetId>
+ <pri:price>1.0</pri:price>
+ </pri:priceRequest>
+ <pri:priceRequest>
+ <pri:widgetId>134</pri:widgetId>
+ <pri:price>34.1</pri:price>
+ </pri:priceRequest>
+ <pri:priceRequest>
+ <pri:widgetId>211</pri:widgetId>
+ <pri:price>10.0</pri:price>
+ </pri:priceRequest>
+ </pri:priceRequests>
+ </pri:priceQuote>
+ </property>
+ <property name="availQuoteDoc">
+ <ava:availQuote xmlns:ava="http://www.example.org/avail">
+ <ava:availRequest>
+ <ava:widgetId>12</ava:widgetId>
+ <ava:requestedQuantity>10</ava:requestedQuantity>
+ <ava:quantityAvail>true</ava:quantityAvail>
+ <ava:shipDate>2003-03-22</ava:shipDate>
+ </ava:availRequest>
+ <ava:availRequest>
+ <ava:widgetId>134</ava:widgetId>
+ <ava:requestedQuantity>345</ava:requestedQuantity>
+ <ava:quantityAvail>false</ava:quantityAvail>
+ <ava:shipDate>BackOrder</ava:shipDate>
+ </ava:availRequest>
+ <ava:availRequest>
+ <ava:widgetId>211</ava:widgetId>
+ <ava:requestedQuantity>100</ava:requestedQuantity>
+ <ava:quantityAvail>true</ava:quantityAvail>
+ <ava:shipDate>2003-04-21</ava:shipDate>
+ </ava:availRequest>
+ </ava:availQuote>
+ </property>
+ <property name="taxRate">0.1</property>
+ <reference name="quoteCalculator" target="QuoteCalculatorComponent" />
+ </component>
+ <component name="QuoteJoinExternalReferencesComponent">
+ <implementation.xquery location="META-INF/sca/quote_join_external_references.xq"/>
+ <reference name="quoteCalculator" target="QuoteCalculatorComponent" />
+ <reference name="priceQuoteProvider" target="PriceQuoteProviderComponent" />
+ </component>
+
+ <component name="QuoteCalculatorComponent">
+ <implementation.java class="xquery.quote.QuoteCalculatorImpl"/>
+ </component>
+
+ <component name="PriceQuoteProviderComponent">
+ <implementation.java class="xquery.quote.PriceQuoteProviderImpl"/>
+ </component>
+
+ <reference name="availQuoteProvider" promote="QuoteJoinExternalReferencesComponent/availQuoteProvider">
+ <interface.java interface="xquery.quote.AvailQuoteProviderService" />
+ <binding.ws wsdlElement="http://quote.xquery#wsdl.port(AvailQuoteProviderService/AvailQuoteProviderSoapPort)" />
+ </reference>
+ <reference name="quoteJoinWs" promote="QuoteJoinLocalComponent/quoteJoinWs">
+ <interface.java interface="xquery.quote.QuoteJoin" />
+ <binding.ws wsdlElement="http://quote.xquery#wsdl.port(QuoteJoinService/QuoteJoinSoapPort)" />
+ </reference>
+</composite>
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java
new file mode 100644
index 0000000000..97febf65e9
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteClientTestCase.java
@@ -0,0 +1,145 @@
+/*
+ * 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 xquery.quote;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.apache.tuscany.sca.host.embedded.SCATestCaseRunner;
+import org.example.avail.AvailQuote;
+import org.example.price.PriceQuote;
+import org.example.quote.Quote;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import commonj.sdo.DataObject;
+
+/**
+ * Integration test for the XQuery implementation type
+ * @version $Rev$ $Date$
+ * This test covers the most important integration scenarios for the xquery
+ * implementation type and its corresponding saxon data bindings:
+ *
+ * 1. There is a central component for invoking the different
+ * scenarios: QuoteJoinLocalComponent
+ * 2. It provides the following tests:
+ * - invoke XQuery component in the current assembly, by providing all needed
+ * information as input parameters
+ * - invoke XQuery component in external assembly, which is exposed as a web
+ * service
+ * - invoke XQuery component in the current assembly, which retrieves the needed
+ * information from the component properties
+ * - invoke XQuery component in the current assembly, which retrieves the needed
+ * information from its references to other components:
+ * - one of the components is in the current assembly
+ * - the other component is in anther assembly and it is exposed (and accessed)
+ * as web service
+ *
+ * 3. All of the XQuery components have reference to a component for calculation of the
+ * total price
+ * 4. SDO is used for data interchange
+ */
+public class XQueryQuoteClientTestCase {
+
+ public static boolean SHOW_DEBUG_MSG = false;
+
+ private SCADomain scaDomain;
+ private SCATestCaseRunner server;
+
+ private QuoteJoinLocal quoteJoinLocal;
+
+ @Before
+ public void startClient() throws Exception {
+ try {
+ scaDomain = SCADomain.newInstance("xqueryquotewsclient.composite");
+
+ quoteJoinLocal = scaDomain.getService(QuoteJoinLocal.class, "QuoteJoinLocalComponent");
+
+ server = new SCATestCaseRunner(XQueryQuoteTestServer.class);
+ server.before();
+ } catch(Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testQuoteJoin() {
+ AvailQuote availQuote = TestHelper.buildAvailQuoteData();
+ PriceQuote priceQuote = TestHelper.buildPriceQuoteData();
+
+ if(SHOW_DEBUG_MSG) {
+ System.out.println("Input quote for the price list:");
+ TestHelper.serializeToSystemOut((DataObject)priceQuote, "priceQuote");
+ System.out.println();
+ System.out.println("Input quote for the availability:");
+ TestHelper.serializeToSystemOut((DataObject)availQuote, "availQuote");
+ System.out.println();
+ }
+
+ Quote quote = quoteJoinLocal.joinPriceAndAvailQuotes(priceQuote, availQuote, 0.1f);
+ TestHelper.assertQuote(availQuote, priceQuote, quote, 0.1f);
+ if(SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from local join:");
+ TestHelper.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+
+ quote = quoteJoinLocal.joinPriceAndAvailQuotes(priceQuote, availQuote, 0.2f);
+ TestHelper.assertQuote(availQuote, priceQuote, quote, 0.2f);
+ if(SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from local join (second invokation):");
+ TestHelper.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+
+ quote = quoteJoinLocal.joinPriceAndAvailQuotesWs(priceQuote, availQuote, 0.1f);
+ TestHelper.assertQuote(availQuote, priceQuote, quote, 0.1f);
+ if(SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from web service join:");
+ TestHelper.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+
+ quote = quoteJoinLocal.joinPriceAndAvailQuotes();
+ TestHelper.assertQuote(availQuote, priceQuote, quote, 0.1f);
+ if(SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from properties join:");
+ TestHelper.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+
+ quote = quoteJoinLocal.joinPriceAndAvailQuotes(0.1f);
+ TestHelper.assertQuote(availQuote, priceQuote, quote, 0.1f);
+ if(SHOW_DEBUG_MSG) {
+ System.out.println();
+ System.out.println("Output quote from external references join:");
+ TestHelper.serializeToSystemOut((DataObject)quote, "quote");
+ System.out.println();
+ }
+ }
+
+ @After
+ public void stopClient() throws Exception {
+ server.after();
+ scaDomain.close();
+ }
+}
diff --git a/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteTestServer.java b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteTestServer.java
new file mode 100644
index 0000000000..cc78f4103b
--- /dev/null
+++ b/sca-java-1.x/branches/sca-java-0.99/samples/quote-xquery/src/test/java/xquery/quote/XQueryQuoteTestServer.java
@@ -0,0 +1,50 @@
+/*
+ * 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 xquery.quote;
+
+import java.io.IOException;
+import java.net.Socket;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+public class XQueryQuoteTestServer {
+ private SCADomain scaDomain;
+
+ @Before
+ public void startServer() throws Exception {
+ try {
+ scaDomain = SCADomain.newInstance("xqueryquotews.composite");
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testPing() throws IOException {
+ new Socket("127.0.0.1", 8085);
+ }
+
+ @After
+ public void stopServer() throws Exception {
+ scaDomain.close();
+ }
+}