You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2007/05/25 17:54:30 UTC
svn commit: r541699 - in /incubator/tuscany/java/sca/demos: ./ creditws/
creditws/src/main/java/credit/ creditws/src/main/resources/
creditws/src/main/resources/wsdl/ mortgage/
mortgage/src/main/java/mortgage/ mortgage/src/main/resources/
mortgage/src/...
Author: rfeng
Date: Fri May 25 08:54:28 2007
New Revision: 541699
URL: http://svn.apache.org/viewvc?view=rev&rev=541699
Log:
Add the loan approval demo application
Added:
incubator/tuscany/java/sca/demos/creditws/
- copied from r528745, incubator/tuscany/sandbox/rfeng/samples/creditws/
incubator/tuscany/java/sca/demos/creditws/src/main/java/credit/CreditCheckServer.java (with props)
incubator/tuscany/java/sca/demos/creditws/src/main/resources/CreditCheck.composite
incubator/tuscany/java/sca/demos/mortgage/
- copied from r528745, incubator/tuscany/sandbox/rfeng/samples/mortgage/
incubator/tuscany/java/sca/demos/mortgage/src/main/resources/Mortgage.composite
incubator/tuscany/java/sca/demos/mortgage/src/main/resources/Mortgage1.composite
Modified:
incubator/tuscany/java/sca/demos/creditws/pom.xml
incubator/tuscany/java/sca/demos/creditws/src/main/java/credit/CreditCheckImpl.java
incubator/tuscany/java/sca/demos/creditws/src/main/resources/wsdl/credit.wsdl
incubator/tuscany/java/sca/demos/mortgage/pom.xml
incubator/tuscany/java/sca/demos/mortgage/src/main/java/mortgage/LoanApprovalImpl.java
incubator/tuscany/java/sca/demos/mortgage/src/main/java/mortgage/MortgageClient.java
incubator/tuscany/java/sca/demos/mortgage/src/main/resources/wsdl/credit.wsdl
incubator/tuscany/java/sca/demos/mortgage/src/test/java/mortgage/MortgageClientTestCase.java
incubator/tuscany/java/sca/demos/pom.xml
Modified: incubator/tuscany/java/sca/demos/creditws/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/creditws/pom.xml?view=diff&rev=541699&r1=528745&r2=541699
==============================================================================
--- incubator/tuscany/java/sca/demos/creditws/pom.xml (original)
+++ incubator/tuscany/java/sca/demos/creditws/pom.xml Fri May 25 08:54:28 2007
@@ -18,86 +18,58 @@
* under the License.
-->
<project>
+ <modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.apache.tuscany.samples.sca</groupId>
- <artifactId>parent</artifactId>
- <version>1.0-incubator-SNAPSHOT</version>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-samples</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
</parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>sample-creditws</artifactId>
+ <artifactId>demo-credit-check</artifactId>
<packaging>war</packaging>
<name>Tuscany credit Web Service Sample</name>
<description>A sample credit Web Service.</description>
- <properties>
- <ws.type>axis2</ws.type>
- </properties>
-
<dependencies>
-
- <!-- SCA API dependencies -->
<dependency>
- <groupId>org.osoa</groupId>
- <artifactId>sca-api-r0.95</artifactId>
- <version>${tuscanyVersion}</version>
- <scope>compile</scope>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
</dependency>
-
- <!-- Tuscany API dependencies -->
+
<dependency>
- <groupId>org.apache.tuscany.sca.kernel</groupId>
- <artifactId>tuscany-api</artifactId>
- <version>${tuscanyVersion}</version>
- <scope>compile</scope>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <scope>runtime</scope>
</dependency>
- <!-- runtime is need for webapp integration to include jar -->
<dependency>
- <groupId>org.apache.tuscany.sca.runtime</groupId>
- <artifactId>webapp</artifactId>
- <version>${tuscanyVersion}</version>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-http-tomcat</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
- <!-- Unit testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>3.8.1</version>
+ <version>4.2</version>
<scope>test</scope>
</dependency>
</dependencies>
-
+
<build>
- <defaultGoal>install</defaultGoal>
- <finalName>credit</finalName>
- <plugins>
- <plugin>
- <groupId>org.apache.tuscany.sca.plugins</groupId>
- <artifactId>tuscany-war-plugin</artifactId>
- <version>${tuscanyVersion}</version>
- <executions>
- <execution>
- <id>tuscany-war</id>
- <goals>
- <goal>tuscany-war</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <!-- Set to true to embed external jars for extensions in the WAR -->
- <!-- Set to false to leave external jars for extensions to be resolved from maven repository -->
- <loadExtensionDependencies>false</loadExtensionDependencies>
- <extensions>
- <dependency>
- <groupId>org.apache.tuscany.sca.services.bindings</groupId>
- <artifactId>axis2</artifactId>
- <version>${tuscanyVersion}</version>
- </dependency>
- </extensions>
- </configuration>
- </plugin>
- </plugins>
+ <finalName>${artifactId}</finalName>
</build>
+
+
</project>
Modified: incubator/tuscany/java/sca/demos/creditws/src/main/java/credit/CreditCheckImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/creditws/src/main/java/credit/CreditCheckImpl.java?view=diff&rev=541699&r1=528745&r2=541699
==============================================================================
--- incubator/tuscany/java/sca/demos/creditws/src/main/java/credit/CreditCheckImpl.java (original)
+++ incubator/tuscany/java/sca/demos/creditws/src/main/java/credit/CreditCheckImpl.java Fri May 25 08:54:28 2007
@@ -18,13 +18,11 @@
*/
package credit;
-import org.osoa.sca.annotations.Scope;
import org.osoa.sca.annotations.Service;
/**
* An implementation of the CreditReportService service
*/
-@Scope("MODULE")
@Service(CreditCheck.class)
public class CreditCheckImpl implements CreditCheck {
Added: incubator/tuscany/java/sca/demos/creditws/src/main/java/credit/CreditCheckServer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/creditws/src/main/java/credit/CreditCheckServer.java?view=auto&rev=541699
==============================================================================
--- incubator/tuscany/java/sca/demos/creditws/src/main/java/credit/CreditCheckServer.java (added)
+++ incubator/tuscany/java/sca/demos/creditws/src/main/java/credit/CreditCheckServer.java Fri May 25 08:54:28 2007
@@ -0,0 +1,40 @@
+/*
+ * 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 credit;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class CreditCheckServer {
+ public static void main(String[] args) throws Exception {
+
+ System.out.println("Starting the CreditCheck Service...");
+
+ SCADomain domain = SCADomain.newInstance("http://localhost:8080", "/", "CreditCheck.composite");
+
+ System.out.println("Press Enter to Exit...");
+ System.in.read();
+
+ domain.close();
+ System.out.println("Bye");
+ }
+}
Propchange: incubator/tuscany/java/sca/demos/creditws/src/main/java/credit/CreditCheckServer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/tuscany/java/sca/demos/creditws/src/main/java/credit/CreditCheckServer.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: incubator/tuscany/java/sca/demos/creditws/src/main/resources/CreditCheck.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/creditws/src/main/resources/CreditCheck.composite?view=auto&rev=541699
==============================================================================
--- incubator/tuscany/java/sca/demos/creditws/src/main/resources/CreditCheck.composite (added)
+++ incubator/tuscany/java/sca/demos/creditws/src/main/resources/CreditCheck.composite Fri May 25 08:54:28 2007
@@ -0,0 +1,31 @@
+<?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://credit" name="CreditComposite">
+
+ <service name="CreditCheckService" promote="CreditCheckServiceComponent">
+ <interface.wsdl interface="http://credit#wsdl.interface(CreditCheck)" />
+ <binding.ws wsdlElement="http://credit#wsdl.endpoint(CreditCheckService/CreditCheckSoapPort)" />
+ </service>
+
+ <component name="CreditCheckServiceComponent">
+ <implementation.java class="credit.CreditCheckImpl" />
+ </component>
+
+</composite>
Modified: incubator/tuscany/java/sca/demos/creditws/src/main/resources/wsdl/credit.wsdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/creditws/src/main/resources/wsdl/credit.wsdl?view=diff&rev=541699&r1=528745&r2=541699
==============================================================================
--- incubator/tuscany/java/sca/demos/creditws/src/main/resources/wsdl/credit.wsdl (original)
+++ incubator/tuscany/java/sca/demos/creditws/src/main/resources/wsdl/credit.wsdl Fri May 25 08:54:28 2007
@@ -74,7 +74,7 @@
<wsdl:service name="CreditCheckService">
<wsdl:port binding="tns:CreditCheckSoapBinding" name="CreditCheckSoapPort">
- <wsdlsoap:address location="http://localhost:8080/credit/services/CreditCheckWebService" />
+ <wsdlsoap:address location="http://localhost:8080/CreditCheckServiceComponent/CreditCheckService" />
</wsdl:port>
</wsdl:service>
Modified: incubator/tuscany/java/sca/demos/mortgage/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/mortgage/pom.xml?view=diff&rev=541699&r1=528745&r2=541699
==============================================================================
--- incubator/tuscany/java/sca/demos/mortgage/pom.xml (original)
+++ incubator/tuscany/java/sca/demos/mortgage/pom.xml Fri May 25 08:54:28 2007
@@ -18,58 +18,55 @@
* under the License.
-->
<project>
+ <modelVersion>4.0.0</modelVersion>
<parent>
- <groupId>org.apache.tuscany.samples.sca</groupId>
- <artifactId>parent</artifactId>
- <version>1.0-incubator-SNAPSHOT</version>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-samples</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
</parent>
- <modelVersion>4.0.0</modelVersion>
- <artifactId>sample-mortgage</artifactId>
+ <artifactId>demo-mortgage</artifactId>
<packaging>jar</packaging>
<name>Tuscany Mortgage Sample</name>
<description>A sample Mortgage application made of several SCA components wired together.</description>
<properties>
- <property name="tuscanyVersion">1.0-incubator-SNAPSHOT</property>
+ <property name="tuscanyVersion">1.0-incubating-SNAPSHOT</property>
</properties>
-
+
<dependencies>
<dependency>
- <groupId>org.osoa</groupId>
- <artifactId>sca-api-r0.95</artifactId>
- <version>${tuscanyVersion}</version>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-webapp</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
</dependency>
+
<dependency>
<groupId>org.apache.tuscany.sca</groupId>
- <artifactId>test</artifactId>
- <version>${tuscanyVersion}</version>
- <scope>test</scope>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
</dependency>
+
<dependency>
- <groupId>org.apache.tuscany.sca.services.containers</groupId>
- <artifactId>javascript</artifactId>
- <version>${tuscanyVersion}</version>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
+
<dependency>
- <groupId>org.apache.tuscany.sca.services.bindings</groupId>
- <artifactId>axis2</artifactId>
- <version>${tuscanyVersion}</version>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-binding-ws-axis2</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
<dependency>
- <groupId>org.apache.tuscany.sca.services.databinding</groupId>
- <artifactId>databinding-axiom</artifactId>
- <version>${tuscanyVersion}</version>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-script</artifactId>
+ <version>1.0-incubating-SNAPSHOT</version>
<scope>runtime</scope>
</dependency>
- <dependency>
- <groupId>org.apache.tuscany.samples.sca</groupId>
- <artifactId>sample-creditws</artifactId>
- <version>${tuscanyVersion}</version>
- <type>war</type>
- <scope>provided</scope>
- </dependency>
+
</dependencies>
<build>
@@ -85,56 +82,6 @@
<mainClass>mortgage.MortgageClient</mainClass>
</manifest>
</archive>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.cargo</groupId>
- <artifactId>cargo-maven2-plugin</artifactId>
- <executions>
- <execution>
- <id>start-container</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>start</goal>
- </goals>
- </execution>
- <execution>
- <id>stop-container</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
- </executions>
-
- <configuration>
- <wait>false</wait>
-
- <!-- Container configuration -->
- <container>
- <containerId>tomcat5x</containerId>
- <home>C:/Apache/apache-tomcat-5.5.20</home>
- <!--
- <zipUrlInstaller>
- <url>http://www.orionserver.com/distributions/orion2.0.5.zip</url>
- <installDir>${java.io.tmpdir}/cargoinstalls</installDir>
- </zipUrlInstaller>
- -->
-
- </container>
-
- <!-- Configuration to use with the container -->
- <configuration>
- <home>${project.build.directory}/tomcat5x</home>
- <deployables>
- <deployable>
- <groupId>org.apache.tuscany.samples.sca</groupId>
- <artifactId>sample-creditws</artifactId>
- <type>war</type>
- </deployable>
- </deployables>
- </configuration>
-
</configuration>
</plugin>
</plugins>
Modified: incubator/tuscany/java/sca/demos/mortgage/src/main/java/mortgage/LoanApprovalImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/mortgage/src/main/java/mortgage/LoanApprovalImpl.java?view=diff&rev=541699&r1=528745&r2=541699
==============================================================================
--- incubator/tuscany/java/sca/demos/mortgage/src/main/java/mortgage/LoanApprovalImpl.java (original)
+++ incubator/tuscany/java/sca/demos/mortgage/src/main/java/mortgage/LoanApprovalImpl.java Fri May 25 08:54:28 2007
@@ -25,7 +25,8 @@
/**
* An implementation of the LoanApproval service.
*/
-@Service(LoanApproval.class) // Service declaration
+@Service(LoanApproval.class)
+// Service declaration
public class LoanApprovalImpl implements LoanApproval {
private CreditCheck[] creditCheck;
private MortgageCalculator mortgageCalculator;
@@ -38,7 +39,7 @@
private int minimumCreditScore = 650;
// Property declaration using a setter method
- @Property(name = "minimumCreditScore", override = "may")
+ @Property(name = "minimumCreditScore")
public void setMinimumCreditScore(int minimumCreditScore) {
this.minimumCreditScore = minimumCreditScore;
}
@@ -60,10 +61,16 @@
}
public boolean approve(Customer customer, double loanAmount, int years) {
- int score = creditCheck[0].getCreditScore(customer.getSsn());
+ int score = 0;
+ for (int i = 0; i < creditCheck.length; i++) {
+ score += creditCheck[0].getCreditScore(customer.getSsn());
+ }
+ if (score != 0) {
+ score = score / creditCheck.length;
+ }
if (score < minimumCreditScore) {
return false;
- }
+ }
float rate = interestRateQuote.getRate(customer.getState(), loanAmount, years);
double monthlyPayment = mortgageCalculator.getMonthlyPayment(loanAmount, years, rate);
double ratio = monthlyPayment / customer.getMonthlyIncome();
Modified: incubator/tuscany/java/sca/demos/mortgage/src/main/java/mortgage/MortgageClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/mortgage/src/main/java/mortgage/MortgageClient.java?view=diff&rev=541699&r1=528745&r2=541699
==============================================================================
--- incubator/tuscany/java/sca/demos/mortgage/src/main/java/mortgage/MortgageClient.java (original)
+++ incubator/tuscany/java/sca/demos/mortgage/src/main/java/mortgage/MortgageClient.java Fri May 25 08:54:28 2007
@@ -18,8 +18,7 @@
*/
package mortgage;
-import org.osoa.sca.CompositeContext;
-import org.osoa.sca.CurrentCompositeContext;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
/**
* This client program to invoke the Mortgage LoanApproval service
@@ -27,9 +26,8 @@
public class MortgageClient {
public static void main(String[] args) throws Exception {
- // Locate the service using SCA APIs
- CompositeContext context = CurrentCompositeContext.getContext();
- LoanApproval loanApplication = context.locateService(LoanApproval.class, "LoanApprovalComponent");
+ SCADomain domain = SCADomain.newInstance("Mortgage1.composite");
+ LoanApproval loanApplication = domain.getService(LoanApproval.class, "LoanApprovalComponent");
// Create the customer
Customer customer = new Customer();
Added: incubator/tuscany/java/sca/demos/mortgage/src/main/resources/Mortgage.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/mortgage/src/main/resources/Mortgage.composite?view=auto&rev=541699
==============================================================================
--- incubator/tuscany/java/sca/demos/mortgage/src/main/resources/Mortgage.composite (added)
+++ incubator/tuscany/java/sca/demos/mortgage/src/main/resources/Mortgage.composite Fri May 25 08:54:28 2007
@@ -0,0 +1,47 @@
+<?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://mortgage" name="MortgageComposite">
+
+ <component name="LoanApprovalComponent">
+ <implementation.java class="mortgage.LoanApprovalImpl" />
+ <property name="minimumCreditScore">600</property>
+ <reference name="creditCheck" target="CreditCheckComponent" />
+ <reference name="interestRateQuote" target="InterestRateQuoteComponent" />
+ <reference name="riskAssessment" target="RiskAssessmentComponent" />
+ <reference name="mortgageCalculator" target="MortgageCalculatorComponent" />
+ </component>
+
+ <component name="CreditCheckComponent">
+ <implementation.java class="mortgage.CreditCheckImpl" />
+ </component>
+
+ <component name="InterestRateQuoteComponent">
+ <implementation.java class="mortgage.InterestRateQuoteImpl" />
+ </component>
+
+ <component name="RiskAssessmentComponent">
+ <implementation.java class="mortgage.RiskAssessmentImpl" />
+ </component>
+
+ <component name="MortgageCalculatorComponent">
+ <implementation.java class="mortgage.MortgageCalculatorImpl" />
+ </component>
+
+</composite>
Added: incubator/tuscany/java/sca/demos/mortgage/src/main/resources/Mortgage1.composite
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/mortgage/src/main/resources/Mortgage1.composite?view=auto&rev=541699
==============================================================================
--- incubator/tuscany/java/sca/demos/mortgage/src/main/resources/Mortgage1.composite (added)
+++ incubator/tuscany/java/sca/demos/mortgage/src/main/resources/Mortgage1.composite Fri May 25 08:54:28 2007
@@ -0,0 +1,54 @@
+<?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://mortgage" name="MortgageComposite">
+
+ <component name="LoanApprovalComponent">
+ <implementation.java class="mortgage.LoanApprovalImpl" />
+ <property name="minimumCreditScore">600</property>
+ <!--
+ <reference name="creditCheck" target="CreditCheckComponent" />
+ -->
+ <reference name="interestRateQuote" target="InterestRateQuoteComponent" />
+ <reference name="riskAssessment" target="RiskAssessmentComponent" />
+ <reference name="mortgageCalculator" target="MortgageCalculatorJSComponent" />
+ </component>
+
+ <component name="CreditCheckComponent">
+ <implementation.java class="mortgage.CreditCheckImpl" />
+ </component>
+
+ <component name="InterestRateQuoteComponent">
+ <implementation.java class="mortgage.InterestRateQuoteImpl" />
+ </component>
+
+ <component name="RiskAssessmentComponent">
+ <implementation.java class="mortgage.RiskAssessmentImpl" />
+ </component>
+
+ <component name="MortgageCalculatorJSComponent">
+ <implementation.script script="MortgageCalculator.js" />
+ </component>
+
+ <reference name="CreditCheckReference" promote="LoanApprovalComponent/creditCheck">
+ <interface.java interface="mortgage.CreditCheck" />
+ <binding.ws wsdlElement="http://credit#wsdl.port(CreditCheckService/CreditCheckSoapPort)" />
+ </reference>
+
+</composite>
Modified: incubator/tuscany/java/sca/demos/mortgage/src/main/resources/wsdl/credit.wsdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/mortgage/src/main/resources/wsdl/credit.wsdl?view=diff&rev=541699&r1=528745&r2=541699
==============================================================================
--- incubator/tuscany/java/sca/demos/mortgage/src/main/resources/wsdl/credit.wsdl (original)
+++ incubator/tuscany/java/sca/demos/mortgage/src/main/resources/wsdl/credit.wsdl Fri May 25 08:54:28 2007
@@ -74,11 +74,8 @@
<wsdl:service name="CreditCheckService">
<wsdl:port binding="tns:CreditCheckSoapBinding" name="CreditCheckSoapPort">
- <wsdlsoap:address location="http://localhost:8080/credit/services/CreditCheckWebService" />
+ <wsdlsoap:address location="http://localhost:8080/CreditCheckServiceComponent/CreditCheckService" />
</wsdl:port>
- <wsdl:port binding="tns:CreditCheckSoapBinding" name="CreditCheckSoapPort1">
- <wsdlsoap:address location="http://localhost:8080/axis2/services/CreditCheckService" />
- </wsdl:port>
</wsdl:service>
</wsdl:definitions>
Modified: incubator/tuscany/java/sca/demos/mortgage/src/test/java/mortgage/MortgageClientTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/mortgage/src/test/java/mortgage/MortgageClientTestCase.java?view=diff&rev=541699&r1=528745&r2=541699
==============================================================================
--- incubator/tuscany/java/sca/demos/mortgage/src/test/java/mortgage/MortgageClientTestCase.java (original)
+++ incubator/tuscany/java/sca/demos/mortgage/src/test/java/mortgage/MortgageClientTestCase.java Fri May 25 08:54:28 2007
@@ -18,33 +18,27 @@
*/
package mortgage;
-import mortgage.Customer;
-import mortgage.LoanApproval;
+import junit.framework.TestCase;
-import org.apache.tuscany.test.SCATestCase;
-import org.osoa.sca.CompositeContext;
-import org.osoa.sca.CurrentCompositeContext;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
/**
* This shows how to test the Calculator service component.
*/
-public class MortgageClientTestCase extends SCATestCase {
-
+public class MortgageClientTestCase extends TestCase {
+ private SCADomain domain;
private LoanApproval loanApproval;
protected void setUp() throws Exception {
- // version 1: One composite with local components
- setApplicationSCDL(LoanApproval.class, "META-INF/sca/default.scdl");
- // version 2: two composites, one for mortgage and the other for credit
- // setApplicationSCDL(LoanApproval.class, "META-INF/sca/default1.scdl");
- // version 3: one composite and an external web service for credit
- // setApplicationSCDL(LoanApproval.class, "META-INF/sca/default2.scdl");
- ClassLoader classLoader = getClass().getClassLoader();
- // addExtension("binding.axis2", classLoader.getResource("META-INF/sca/binding.axis2.scdl"));
- // addExtension("container.js", classLoader.getResource("META-INF/sca/js.system.scdl"));
- super.setUp();
- CompositeContext context = CurrentCompositeContext.getContext();
- loanApproval = context.locateService(LoanApproval.class, "LoanApprovalComponent");
+ domain = SCADomain.newInstance("Mortgage.composite");
+ loanApproval = domain.getService(LoanApproval.class, "LoanApprovalComponent");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ if (domain != null) {
+ domain.close();
+ }
}
public void testApprove() throws Exception {
Modified: incubator/tuscany/java/sca/demos/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/demos/pom.xml?view=diff&rev=541699&r1=541698&r2=541699
==============================================================================
--- incubator/tuscany/java/sca/demos/pom.xml (original)
+++ incubator/tuscany/java/sca/demos/pom.xml Fri May 25 08:54:28 2007
@@ -39,6 +39,8 @@
<module>bigbank-account</module>
<module>bigbank-calculator</module>
<module>bigbank-stockquote</module>
+ <module>mortgage</module>
+ <module>creditws</module>
</modules>
</profile>
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org