diff options
author | dims <dims@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-17 00:23:01 +0000 |
---|---|---|
committer | dims <dims@13f79535-47bb-0310-9956-ffa450edef68> | 2008-06-17 00:23:01 +0000 |
commit | bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a (patch) | |
tree | 38a92061c0793434c4be189f1d70c3458b6bc41d /sandbox/rfeng/geronimo-demo/bigbank/src |
Move Tuscany from Incubator to top level.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/rfeng/geronimo-demo/bigbank/src')
16 files changed, 709 insertions, 0 deletions
diff --git a/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/account/AccountReport.java b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/account/AccountReport.java new file mode 100644 index 0000000000..3f207e2f79 --- /dev/null +++ b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/account/AccountReport.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 bigbank.account; + +import java.util.List; + +/** + */ +public class AccountReport { + private List<String> summaries; + private String currency; + + public AccountReport(String currency, List<String> summaries) { + this.currency = currency; + this.summaries = summaries; + } + + public List getAccountSummaries() { return summaries; } + + public String getCurrency() { return currency; } + + public String toString() { + return "currency: "+ currency + ", " + summaries; + } + +} diff --git a/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/account/AccountService.java b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/account/AccountService.java new file mode 100644 index 0000000000..ca15b795e3 --- /dev/null +++ b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/account/AccountService.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 bigbank.account; + +import org.osoa.sca.annotations.Remotable; + +/** + * Interface for a account service + */ +@Remotable +public interface AccountService { + public String getAccountReport(String customerID); +} diff --git a/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/account/AccountServiceImpl.java b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/account/AccountServiceImpl.java new file mode 100644 index 0000000000..f1e3f60049 --- /dev/null +++ b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/account/AccountServiceImpl.java @@ -0,0 +1,72 @@ +/* + * 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 bigbank.account; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; + +import bigbank.accountdata.AccountDataService; +import bigbank.accountdata.CheckingAccount; +import bigbank.accountdata.SavingsAccount; +import bigbank.accountdata.StockAccount; +import bigbank.stockquote.StockQuoteService; + +/** + * Account service implementation + */ +public class AccountServiceImpl implements AccountService { + + @Reference + public AccountDataService accountDataService; + + @Reference + public StockQuoteService stockQuoteService; + + @Property + public String currency; + + public String getAccountReport(String s) { + List<String> summaries = new ArrayList<String>(); + + CheckingAccount ca = accountDataService.getCheckingAccount(s); + summaries.add(ca.getSummary()); + + SavingsAccount sa = accountDataService.getSavingsAccount(s); + summaries.add(sa.getSummary()); + + StockAccount sk = accountDataService.getStockAccount(s); + + double balance = 0.0; + for (Map.Entry<String, Integer> st : sk.getStocks().entrySet()) { + double price = stockQuoteService.getQuote(st.getKey()); + balance += price * st.getValue(); + } + sk.setBalance(balance); + summaries.add(sk.getSummary()); + + AccountReport report = new AccountReport(currency, summaries); + + return report.toString(); + } + +} diff --git a/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/accountdata/Account.java b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/accountdata/Account.java new file mode 100644 index 0000000000..a5ae7b3955 --- /dev/null +++ b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/accountdata/Account.java @@ -0,0 +1,26 @@ +/* + * 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 bigbank.accountdata; + +/** + * Interface for a account service + */ +public interface Account { + String getSummary(); +} diff --git a/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/accountdata/AccountDataService.java b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/accountdata/AccountDataService.java new file mode 100644 index 0000000000..c354de387b --- /dev/null +++ b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/accountdata/AccountDataService.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 bigbank.accountdata; + +/** + * Interface for a account data service + */ +public interface AccountDataService { + public CheckingAccount getCheckingAccount(String customerID); + public SavingsAccount getSavingsAccount(String customerID); + public StockAccount getStockAccount(String customerID); +} diff --git a/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java new file mode 100644 index 0000000000..fb422a18c4 --- /dev/null +++ b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/accountdata/AccountDataServiceImpl.java @@ -0,0 +1,57 @@ +/* + * 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 bigbank.accountdata; + +import org.osoa.sca.annotations.Reference; + +/** + * Account data service implementation + */ +public class AccountDataServiceImpl implements AccountDataService { + @Reference + public BrokerService brokerService; + + public CheckingAccount getCheckingAccount(String customerID) { + + CheckingAccount checkingAccount = new CheckingAccount(); + checkingAccount.setAccountNumber(customerID + "_" + "CHA12345"); + checkingAccount.setBalance(1500.0f); + + return checkingAccount; + } + + public SavingsAccount getSavingsAccount(String customerID) { + + SavingsAccount savingsAccount = new SavingsAccount(); + savingsAccount.setAccountNumber(customerID + "_" + "SAA12345"); + savingsAccount.setBalance(1500.0f); + + return savingsAccount; + } + + public StockAccount getStockAccount(String customerID) { + + StockAccount stockAccount = new StockAccount(); + stockAccount.setAccountNumber(customerID + "_" + "STA12345"); + java.util.Map<String, Integer> list = brokerService.getPortfolio(customerID); + stockAccount.getStocks().putAll(list); + + return stockAccount; + } +} diff --git a/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/accountdata/BrokerService.java b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/accountdata/BrokerService.java new file mode 100644 index 0000000000..321e090f8d --- /dev/null +++ b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/accountdata/BrokerService.java @@ -0,0 +1,35 @@ +/* + * 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 bigbank.accountdata; + +import java.util.Map; + +import org.osoa.sca.annotations.Remotable; + +/** + * Interface for a account data service + */ +@Remotable +public interface BrokerService { + /** + * @param customerID + * @return A map of stocks (key: symbol, value: qty) + */ + public Map<String, Integer> getPortfolio(String customerID); +} diff --git a/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java new file mode 100644 index 0000000000..11bdff757e --- /dev/null +++ b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/accountdata/CheckingAccount.java @@ -0,0 +1,35 @@ +/* + * 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 bigbank.accountdata; + +/** + * An account service implementation for a checking account + */ +public class CheckingAccount implements Account { + private String accountNumber; + private double balance; + + public String getAccountNumber() { return accountNumber; } + public void setAccountNumber(String n) { this.accountNumber = n; } + + public double getBalance() { return balance; } + public void setBalance(double b) { this.balance = b; } + + public String getSummary() { return "ID:" + accountNumber + ", balance:" + balance; } +} diff --git a/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java new file mode 100644 index 0000000000..b791024076 --- /dev/null +++ b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/accountdata/SavingsAccount.java @@ -0,0 +1,35 @@ +/* + * 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 bigbank.accountdata; + +/** + * An account service implementation for a savings account + */ +public class SavingsAccount implements Account { + private String accountNumber; + private double balance; + + public String getAccountNumber() { return accountNumber; } + public void setAccountNumber(String n) { this.accountNumber = n; } + + public double getBalance() { return balance; } + public void setBalance(double b) { this.balance = b; } + + public String getSummary() { return "ID:" + accountNumber + ", balance:" + balance; } +} diff --git a/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/accountdata/StockAccount.java b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/accountdata/StockAccount.java new file mode 100644 index 0000000000..57f1682bd8 --- /dev/null +++ b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/accountdata/StockAccount.java @@ -0,0 +1,58 @@ +/* + * 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 bigbank.accountdata; + +import java.util.HashMap; +import java.util.Map; + +/** + * An account service implementation for a stock account + */ +public class StockAccount implements Account { + private String accountNumber; + private Map<String, Integer> stocks = new HashMap<String, Integer>(); + private double balance; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String n) { + this.accountNumber = n; + } + + public double getBalance() { + return balance; + } + + public void setBalance(double balance) { + this.balance = balance; + } + + public String getSummary() { + return "ID:" + accountNumber + ", stocks:" + stocks + ", balance:" + balance; + } + + /** + * @return the stocks + */ + public Map<String, Integer> getStocks() { + return stocks; + } +} diff --git a/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/client/BigBankClient.java b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/client/BigBankClient.java new file mode 100644 index 0000000000..edbf910d37 --- /dev/null +++ b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/client/BigBankClient.java @@ -0,0 +1,43 @@ +/* + * 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 bigbank.client; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +import bigbank.account.AccountService; + +/** + * This client program shows how to create an SCA runtime, start it, + * and locate and invoke a SCA component + */ +public class BigBankClient { + public static void main(String[] args) throws Exception { + + SCADomain scaDomain = SCADomain.newInstance("BigBank.composite"); + + AccountService accountService = scaDomain.getService(AccountService.class, + "AccountServiceComponent"); + + System.out.println("Account summary: " + accountService.getAccountReport("Foo") ); + + scaDomain.close(); + } + +} diff --git a/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/stockquote/StockQuoteImpl.java b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/stockquote/StockQuoteImpl.java new file mode 100644 index 0000000000..0512d40b0b --- /dev/null +++ b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/stockquote/StockQuoteImpl.java @@ -0,0 +1,36 @@ +/* + * 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 bigbank.stockquote; + + +/** + * This class implements the StockQuote service. + */ +public class StockQuoteImpl implements StockQuoteService { + + public double getQuote(String symbol) { + double price = 104.0 + Math.random(); + price = ((int)(price * 100)) / 100.0; + + System.out.println("Getting stock quote for: " + symbol + ", value: "+ price); + + return price; + } + +} diff --git a/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/stockquote/StockQuoteService.java b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/stockquote/StockQuoteService.java new file mode 100644 index 0000000000..7961279352 --- /dev/null +++ b/sandbox/rfeng/geronimo-demo/bigbank/src/main/java/bigbank/stockquote/StockQuoteService.java @@ -0,0 +1,32 @@ +/* + * 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 bigbank.stockquote; + +import org.osoa.sca.annotations.Remotable; + + +/** + * This is the business interface of the StockQuote service. + */ +@Remotable +public interface StockQuoteService { + + public double getQuote(String symbol); +} + diff --git a/sandbox/rfeng/geronimo-demo/bigbank/src/main/resources/BigBank.composite b/sandbox/rfeng/geronimo-demo/bigbank/src/main/resources/BigBank.composite new file mode 100644 index 0000000000..0fd97e2103 --- /dev/null +++ b/sandbox/rfeng/geronimo-demo/bigbank/src/main/resources/BigBank.composite @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0" targetNamespace="http://bigbank" xmlns:a="http://account"
+ xmlns:s="http://stockquote" name="BigBank">
+
+ <component name="StockQuoteServiceComponent">
+ <implementation.java class="bigbank.stockquote.StockQuoteImpl" />
+ </component>
+
+ <component name="AccountServiceComponent">
+ <implementation.java class="bigbank.account.AccountServiceImpl" />
+ <reference name="accountDataService" target="AccountDataServiceComponent" />
+ <reference name="stockQuoteService" target="StockQuoteServiceComponent" />
+ <property name="currency">USD</property>
+ <!--
+ <service name="AccountService">
+ <interface.wsdl interface="http://account#wsdl.interface(Account)" />
+ <binding.ws wsdlElement="http://account#wsdl.port(AccountService/AccountSoapPort)" />
+ <binding.sca/>
+ </service>
+ -->
+ </component>
+
+ <component name="AccountDataServiceComponent">
+ <implementation.java class="bigbank.accountdata.AccountDataServiceImpl" />
+ <reference name="brokerService">
+ <binding.ejb uri="corbaname:iiop:1.2@localhost:1050#BrokerServiceBean" />
+ </reference>
+ </component>
+
+ <service name="AccountWebService" promote="AccountServiceComponent/AccountService">
+ <binding.ws wsdlElement="http://account#wsdl.port(AccountService/AccountSoapPort)" />
+ </service>
+
+</composite>
diff --git a/sandbox/rfeng/geronimo-demo/bigbank/src/main/resources/wsdl/account.wsdl b/sandbox/rfeng/geronimo-demo/bigbank/src/main/resources/wsdl/account.wsdl new file mode 100644 index 0000000000..46bbf3d7bd --- /dev/null +++ b/sandbox/rfeng/geronimo-demo/bigbank/src/main/resources/wsdl/account.wsdl @@ -0,0 +1,81 @@ +<?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://account" xmlns:tns="http://account"
+ xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="account">
+
+ <wsdl:types>
+ <schema elementFormDefault="qualified" targetNamespace="http://account"
+ xmlns="http://www.w3.org/2001/XMLSchema">
+
+ <element name="getAccountReport">
+ <complexType>
+ <sequence>
+ <element name="name" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ <element name="getAccountReportResponse">
+ <complexType>
+ <sequence>
+ <element name="getAccountReportReturn" type="xsd:string" />
+ </sequence>
+ </complexType>
+ </element>
+
+ </schema>
+ </wsdl:types>
+
+ <wsdl:message name="getAccountReportRequest">
+ <wsdl:part element="tns:getAccountReport" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:message name="getAccountReportResponse">
+ <wsdl:part element="tns:getAccountReportResponse" name="parameters" />
+ </wsdl:message>
+
+ <wsdl:portType name="Account">
+ <wsdl:operation name="getAccountReport">
+ <wsdl:input message="tns:getAccountReportRequest" name="getAccountReportRequest" />
+ <wsdl:output message="tns:getAccountReportResponse" name="getAccountReportResponse" />
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:binding name="AccountSoapBinding" type="tns:Account">
+ <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
+ <wsdl:operation name="getAccountReport">
+ <wsdlsoap:operation soapAction="" />
+ <wsdl:input name="getAccountReportRequest">
+ <wsdlsoap:body use="literal" />
+ </wsdl:input>
+ <wsdl:output name="getAccountReportResponse">
+ <wsdlsoap:body use="literal" />
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+
+ <wsdl:service name="AccountService">
+ <wsdl:port binding="tns:AccountSoapBinding" name="AccountSoapPort">
+ <wsdlsoap:address location="http://localhost:8080/bigbank/AccountService" />
+ </wsdl:port>
+ </wsdl:service>
+
+</wsdl:definitions>
diff --git a/sandbox/rfeng/geronimo-demo/bigbank/src/test/java/bigbank/BigBankTestCase.java b/sandbox/rfeng/geronimo-demo/bigbank/src/test/java/bigbank/BigBankTestCase.java new file mode 100644 index 0000000000..42d780953d --- /dev/null +++ b/sandbox/rfeng/geronimo-demo/bigbank/src/test/java/bigbank/BigBankTestCase.java @@ -0,0 +1,48 @@ +/* + * 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 bigbank; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +import bigbank.account.AccountService; + +/** + * Tests out the big bank service + * + */ +public class BigBankTestCase extends TestCase { + + private SCADomain scaDomain; + AccountService accountService; + + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("BigBank.composite"); + accountService = scaDomain.getService(AccountService.class, "AccountServiceComponent"); + } + + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void test() throws Exception { + System.out.println("Account summary: " + accountService.getAccountReport("Foo") ); + } +} |