From bc0919b6fea37a236748fd1f7a480b6aad3baf46 Mon Sep 17 00:00:00 2001 From: slaws Date: Mon, 28 Jul 2008 08:04:28 +0000 Subject: Rename and reorganize git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@680280 13f79535-47bb-0310-9956-ffa450edef68 --- .../META-INF/sca-contribution.xml | 22 ++++++++ sandbox/travelsample/currency-contribution/pom.xml | 63 ++++++++++++++++++++++ .../currencyconverter/CurrencyConverter.java | 33 ++++++++++++ .../currencyconverter/CurrencyConverterImpl.java | 37 +++++++++++++ sandbox/travelsample/currencyconverter/pom.xml | 57 -------------------- .../java/currencyconverter/CurrencyConverter.java | 28 ---------- .../currencyconverter/CurrencyConverterImpl.java | 35 ------------ .../src/main/resources/currencyconverter.composite | 29 ---------- .../CurrencyConverterTestCase.java | 47 ---------------- 9 files changed, 155 insertions(+), 196 deletions(-) create mode 100644 sandbox/travelsample/currency-contribution/META-INF/sca-contribution.xml create mode 100644 sandbox/travelsample/currency-contribution/pom.xml create mode 100644 sandbox/travelsample/currency-contribution/src/scatours/currencyconverter/CurrencyConverter.java create mode 100644 sandbox/travelsample/currency-contribution/src/scatours/currencyconverter/CurrencyConverterImpl.java delete mode 100644 sandbox/travelsample/currencyconverter/pom.xml delete mode 100644 sandbox/travelsample/currencyconverter/src/main/java/currencyconverter/CurrencyConverter.java delete mode 100644 sandbox/travelsample/currencyconverter/src/main/java/currencyconverter/CurrencyConverterImpl.java delete mode 100644 sandbox/travelsample/currencyconverter/src/main/resources/currencyconverter.composite delete mode 100644 sandbox/travelsample/currencyconverter/src/test/java/currencyconverter/CurrencyConverterTestCase.java (limited to 'sandbox/travelsample') diff --git a/sandbox/travelsample/currency-contribution/META-INF/sca-contribution.xml b/sandbox/travelsample/currency-contribution/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..549a3bc7a3 --- /dev/null +++ b/sandbox/travelsample/currency-contribution/META-INF/sca-contribution.xml @@ -0,0 +1,22 @@ + + + + + \ No newline at end of file diff --git a/sandbox/travelsample/currency-contribution/pom.xml b/sandbox/travelsample/currency-contribution/pom.xml new file mode 100644 index 0000000000..bf0f7adbc6 --- /dev/null +++ b/sandbox/travelsample/currency-contribution/pom.xml @@ -0,0 +1,63 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.4-SNAPSHOT + + + scatours-currency-contribution + Apache Tuscany SCA Tours Currency Converter Contribution + + + + org.apache.tuscany.sca + tuscany-host-embedded + 1.4-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.4-SNAPSHOT + runtime + + + + junit + junit + 4.2 + test + + + + + + ${artifactId} + ${basedir}/src + + + ${basedir}/resources + + + + diff --git a/sandbox/travelsample/currency-contribution/src/scatours/currencyconverter/CurrencyConverter.java b/sandbox/travelsample/currency-contribution/src/scatours/currencyconverter/CurrencyConverter.java new file mode 100644 index 0000000000..9b3851721f --- /dev/null +++ b/sandbox/travelsample/currency-contribution/src/scatours/currencyconverter/CurrencyConverter.java @@ -0,0 +1,33 @@ +/* + * 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 scatours.currencyconverter; + +/** + * The CurrencyConverter service interface + */ +public interface CurrencyConverter { + + double getExchangeRate(String fromCurrencyCode, + String toCurrencyCode); + + double convert(String fromCurrencyCode, + String toCurrencyCode, + double amount); + +} diff --git a/sandbox/travelsample/currency-contribution/src/scatours/currencyconverter/CurrencyConverterImpl.java b/sandbox/travelsample/currency-contribution/src/scatours/currencyconverter/CurrencyConverterImpl.java new file mode 100644 index 0000000000..06d1d23535 --- /dev/null +++ b/sandbox/travelsample/currency-contribution/src/scatours/currencyconverter/CurrencyConverterImpl.java @@ -0,0 +1,37 @@ +/* + * 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 scatours.currencyconverter; + +import org.osoa.sca.annotations.Service; + +/** + * An implementation of the CurrencyConverter service + */ +@Service(interfaces={CurrencyConverter.class}) +public class CurrencyConverterImpl implements CurrencyConverter { + + public double getExchangeRate(String fromCurrencyCode, String toCurrencyCode){ + // regardless of which currencies are specified return the same value + return 1.98; + } + + public double convert(String fromCurrencyCode, String toCurrencyCode, double amount){ + return amount * getExchangeRate(fromCurrencyCode, toCurrencyCode); + } +} diff --git a/sandbox/travelsample/currencyconverter/pom.xml b/sandbox/travelsample/currencyconverter/pom.xml deleted file mode 100644 index 3209790341..0000000000 --- a/sandbox/travelsample/currencyconverter/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - 4.0.0 - - org.apache.tuscany.sca - tuscany-sca - 2.0-incubating-SNAPSHOT - ../../pom.xml - - scatours-currencyconverter - Apache Tuscany SCA Tours Currency Converter Component - - - - org.apache.tuscany.sca - tuscany-host-embedded - 2.0-incubating-SNAPSHOT - - - - org.apache.tuscany.sca - tuscany-implementation-java-runtime - 2.0-incubating-SNAPSHOT - runtime - - - - junit - junit - 4.2 - test - - - - - - ${artifactId} - - diff --git a/sandbox/travelsample/currencyconverter/src/main/java/currencyconverter/CurrencyConverter.java b/sandbox/travelsample/currencyconverter/src/main/java/currencyconverter/CurrencyConverter.java deleted file mode 100644 index b73f35c40c..0000000000 --- a/sandbox/travelsample/currencyconverter/src/main/java/currencyconverter/CurrencyConverter.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package currencyconverter; - -/** - * The CurrencyConverter service interface - */ -public interface CurrencyConverter { - - double getExchangeRate(String fromCurrency, String toCurrency); - -} diff --git a/sandbox/travelsample/currencyconverter/src/main/java/currencyconverter/CurrencyConverterImpl.java b/sandbox/travelsample/currencyconverter/src/main/java/currencyconverter/CurrencyConverterImpl.java deleted file mode 100644 index 6769239b56..0000000000 --- a/sandbox/travelsample/currencyconverter/src/main/java/currencyconverter/CurrencyConverterImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package currencyconverter; - - -/** - * An implementation of the CurrencyConverter service - */ -public class CurrencyConverterImpl implements CurrencyConverter { - - public double getExchangeRate(String fromCurrencyCode, String toCurrencyCode){ - // regardless of which currencies are specified return the same value - return 1.98; - } - - public double convert(String fromCurrencyCode, String toCurrencyCode, double amount){ - return amount * getExchangeRate(fromCurrencyCode, toCurrencyCode); - } -} diff --git a/sandbox/travelsample/currencyconverter/src/main/resources/currencyconverter.composite b/sandbox/travelsample/currencyconverter/src/main/resources/currencyconverter.composite deleted file mode 100644 index ae94401f6c..0000000000 --- a/sandbox/travelsample/currencyconverter/src/main/resources/currencyconverter.composite +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - diff --git a/sandbox/travelsample/currencyconverter/src/test/java/currencyconverter/CurrencyConverterTestCase.java b/sandbox/travelsample/currencyconverter/src/test/java/currencyconverter/CurrencyConverterTestCase.java deleted file mode 100644 index 6bdf32dd0d..0000000000 --- a/sandbox/travelsample/currencyconverter/src/test/java/currencyconverter/CurrencyConverterTestCase.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package currencyconverter; - -import junit.framework.TestCase; - -import org.apache.tuscany.sca.host.embedded.SCADomain; - -/** - * This shows how to test the Calculator service component. - */ -public class CurrencyConverterTestCase extends TestCase { - - private CurrencyConverter currencyConverter; - private SCADomain scaDomain; - - @Override - protected void setUp() throws Exception { - scaDomain = SCADomain.newInstance("currencyconverter.composite"); - currencyConverter = scaDomain.getService(CurrencyConverter.class, "CurrencyConverterComponent"); - } - - @Override - protected void tearDown() throws Exception { - scaDomain.close(); - } - - public void testCurrecncyConverter() throws Exception { - System.out.println(currencyConverter.getExchangeRate("GBP", "USD")); - } -} -- cgit v1.2.3