summaryrefslogtreecommitdiffstats
path: root/java/sca-contrib/samples/calculator-script/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/sca-contrib/samples/calculator-script/src')
-rw-r--r--java/sca-contrib/samples/calculator-script/src/main/java/calculator/AddService.java28
-rw-r--r--java/sca-contrib/samples/calculator-script/src/main/java/calculator/CalculatorClient.java43
-rw-r--r--java/sca-contrib/samples/calculator-script/src/main/java/calculator/CalculatorService.java34
-rw-r--r--java/sca-contrib/samples/calculator-script/src/main/java/calculator/CalculatorServiceImpl.java69
-rw-r--r--java/sca-contrib/samples/calculator-script/src/main/java/calculator/DivideService.java28
-rw-r--r--java/sca-contrib/samples/calculator-script/src/main/java/calculator/MultiplyService.java28
-rw-r--r--java/sca-contrib/samples/calculator-script/src/main/java/calculator/SubtractService.java28
-rw-r--r--java/sca-contrib/samples/calculator-script/src/main/resources/Calculator.composite50
-rw-r--r--java/sca-contrib/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.js22
-rw-r--r--java/sca-contrib/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.groovy22
-rw-r--r--java/sca-contrib/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.py20
-rw-r--r--java/sca-contrib/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.rb21
-rw-r--r--java/sca-contrib/samples/calculator-script/src/test/java/calculator/CalculatorTestCase.java52
13 files changed, 0 insertions, 445 deletions
diff --git a/java/sca-contrib/samples/calculator-script/src/main/java/calculator/AddService.java b/java/sca-contrib/samples/calculator-script/src/main/java/calculator/AddService.java
deleted file mode 100644
index a235e648c7..0000000000
--- a/java/sca-contrib/samples/calculator-script/src/main/java/calculator/AddService.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 calculator;
-
-/**
- * The interface for the add service
- */
-public interface AddService {
-
- double add(double n1, double n2);
-
-}
diff --git a/java/sca-contrib/samples/calculator-script/src/main/java/calculator/CalculatorClient.java b/java/sca-contrib/samples/calculator-script/src/main/java/calculator/CalculatorClient.java
deleted file mode 100644
index 243d1562dc..0000000000
--- a/java/sca-contrib/samples/calculator-script/src/main/java/calculator/CalculatorClient.java
+++ /dev/null
@@ -1,43 +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 calculator;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-/**
- * This client program shows how to create an SCA runtime, start it,
- * and locate and invoke a SCA component
- */
-public class CalculatorClient {
- public static void main(String[] args) throws Exception {
-
- SCADomain scaDomain = SCADomain.newInstance("Calculator.composite");
- CalculatorService calculatorService =
- scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
-
- System.out.println("3 + 2=" + calculatorService.add(3, 2));
- System.out.println("3 - 2=" + calculatorService.subtract(3, 2));
- System.out.println("3 * 2=" + calculatorService.multiply(3, 2));
- System.out.println("3 / 2=" + calculatorService.divide(3, 2));
-
- scaDomain.close();
- }
-
-}
diff --git a/java/sca-contrib/samples/calculator-script/src/main/java/calculator/CalculatorService.java b/java/sca-contrib/samples/calculator-script/src/main/java/calculator/CalculatorService.java
deleted file mode 100644
index c89043276e..0000000000
--- a/java/sca-contrib/samples/calculator-script/src/main/java/calculator/CalculatorService.java
+++ /dev/null
@@ -1,34 +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 calculator;
-
-/**
- * The Calculator service interface.
- */
-public interface CalculatorService {
-
- double add(double n1, double n2);
-
- double subtract(double n1, double n2);
-
- double multiply(double n1, double n2);
-
- double divide(double n1, double n2);
-
-}
diff --git a/java/sca-contrib/samples/calculator-script/src/main/java/calculator/CalculatorServiceImpl.java b/java/sca-contrib/samples/calculator-script/src/main/java/calculator/CalculatorServiceImpl.java
deleted file mode 100644
index 39f55ca31f..0000000000
--- a/java/sca-contrib/samples/calculator-script/src/main/java/calculator/CalculatorServiceImpl.java
+++ /dev/null
@@ -1,69 +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 calculator;
-
-import org.oasisopen.sca.annotation.Reference;
-
-/**
- * An implementation of the Calculator service.
- */
-public class CalculatorServiceImpl implements CalculatorService {
-
- private AddService addService;
- private SubtractService subtractService;
- private MultiplyService multiplyService;
- private DivideService divideService;
-
- @Reference
- public void setAddService(AddService addService) {
- this.addService = addService;
- }
-
- @Reference
- public void setSubtractService(SubtractService subtractService) {
- this.subtractService = subtractService;
- }
-
- @Reference
- public void setDivideService(DivideService divideService) {
- this.divideService = divideService;
- }
-
- @Reference
- public void setMultiplyService(MultiplyService multiplyService) {
- this.multiplyService = multiplyService;
- }
-
- public double add(double n1, double n2) {
- return addService.add(n1, n2);
- }
-
- public double subtract(double n1, double n2) {
- return subtractService.subtract(n1, n2);
- }
-
- public double multiply(double n1, double n2) {
- return multiplyService.multiply(n1, n2);
- }
-
- public double divide(double n1, double n2) {
- return divideService.divide(n1, n2);
- }
-
-}
diff --git a/java/sca-contrib/samples/calculator-script/src/main/java/calculator/DivideService.java b/java/sca-contrib/samples/calculator-script/src/main/java/calculator/DivideService.java
deleted file mode 100644
index 497dafd4fd..0000000000
--- a/java/sca-contrib/samples/calculator-script/src/main/java/calculator/DivideService.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 calculator;
-
-/**
- * The interface for the divide service
- */
-public interface DivideService {
-
- double divide(double n1, double n2);
-
-}
diff --git a/java/sca-contrib/samples/calculator-script/src/main/java/calculator/MultiplyService.java b/java/sca-contrib/samples/calculator-script/src/main/java/calculator/MultiplyService.java
deleted file mode 100644
index 5290605938..0000000000
--- a/java/sca-contrib/samples/calculator-script/src/main/java/calculator/MultiplyService.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 calculator;
-
-/**
- * The interface for the multiply service
- */
-public interface MultiplyService {
-
- double multiply(double n1, double n2);
-
-}
diff --git a/java/sca-contrib/samples/calculator-script/src/main/java/calculator/SubtractService.java b/java/sca-contrib/samples/calculator-script/src/main/java/calculator/SubtractService.java
deleted file mode 100644
index 376b3e5bb9..0000000000
--- a/java/sca-contrib/samples/calculator-script/src/main/java/calculator/SubtractService.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 calculator;
-
-/**
- * The interface for the subtract service
- */
-public interface SubtractService {
-
- double subtract(double n1, double n2);
-
-}
diff --git a/java/sca-contrib/samples/calculator-script/src/main/resources/Calculator.composite b/java/sca-contrib/samples/calculator-script/src/main/resources/Calculator.composite
deleted file mode 100644
index 8a765e6153..0000000000
--- a/java/sca-contrib/samples/calculator-script/src/main/resources/Calculator.composite
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
--->
-<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
- xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0"
- targetNamespace="http://sample"
- xmlns:sample="http://sample"
- name="Calculator">
-
- <component name="CalculatorServiceComponent">
- <implementation.java class="calculator.CalculatorServiceImpl"/>
- <reference name="addService" target="AddServiceComponent" />
- <reference name="subtractService" target="SubtractServiceComponent" />
- <reference name="multiplyService" target="MultiplyServiceComponent" />
- <reference name="divideService" target="DivideServiceComponent" />
- </component>
-
- <component name="AddServiceComponent">
- <tuscany:implementation.script script="calculator/AddServiceImpl.js"/>
- </component>
-
- <component name="SubtractServiceComponent">
- <tuscany:implementation.script script="calculator/SubtractServiceImpl.rb"/>
- </component>
-
- <component name="MultiplyServiceComponent">
- <tuscany:implementation.script script="calculator/MultiplyServiceImpl.py"/>
- </component>
-
- <component name="DivideServiceComponent">
- <tuscany:implementation.script script="calculator/DivideServiceImpl.groovy"/>
- </component>
-
-</composite>
diff --git a/java/sca-contrib/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.js b/java/sca-contrib/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.js
deleted file mode 100644
index 1d4d221364..0000000000
--- a/java/sca-contrib/samples/calculator-script/src/main/resources/calculator/AddServiceImpl.js
+++ /dev/null
@@ -1,22 +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.
- */
-
-function add(n1, n2) {
- return n1 + n2;
-} \ No newline at end of file
diff --git a/java/sca-contrib/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.groovy b/java/sca-contrib/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.groovy
deleted file mode 100644
index c31c1e8fd6..0000000000
--- a/java/sca-contrib/samples/calculator-script/src/main/resources/calculator/DivideServiceImpl.groovy
+++ /dev/null
@@ -1,22 +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.
- */
-
-def divide(n1, n2) {
- return n1 / n2
-} \ No newline at end of file
diff --git a/java/sca-contrib/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.py b/java/sca-contrib/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.py
deleted file mode 100644
index d6f27ca7f5..0000000000
--- a/java/sca-contrib/samples/calculator-script/src/main/resources/calculator/MultiplyServiceImpl.py
+++ /dev/null
@@ -1,20 +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.
-#
-
-def multiply(n1, n2):
- return n1 * n2 \ No newline at end of file
diff --git a/java/sca-contrib/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.rb b/java/sca-contrib/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.rb
deleted file mode 100644
index 132a1d13b0..0000000000
--- a/java/sca-contrib/samples/calculator-script/src/main/resources/calculator/SubtractServiceImpl.rb
+++ /dev/null
@@ -1,21 +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.
-#
-
-def subtract(n1, n2)
- return n1 - n2
-end \ No newline at end of file
diff --git a/java/sca-contrib/samples/calculator-script/src/test/java/calculator/CalculatorTestCase.java b/java/sca-contrib/samples/calculator-script/src/test/java/calculator/CalculatorTestCase.java
deleted file mode 100644
index fea8f62110..0000000000
--- a/java/sca-contrib/samples/calculator-script/src/test/java/calculator/CalculatorTestCase.java
+++ /dev/null
@@ -1,52 +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 calculator;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.host.embedded.SCADomain;
-
-/**
- * This shows how to test the Calculator service component.
- */
-public class CalculatorTestCase extends TestCase {
-
- private SCADomain scaDomain;
- private CalculatorService calculatorService;
-
- @Override
- protected void setUp() throws Exception {
- scaDomain = SCADomain.newInstance("Calculator.composite");
- calculatorService = scaDomain.getService(CalculatorService.class, "CalculatorServiceComponent");
- }
-
- @Override
- protected void tearDown() throws Exception {
- scaDomain.close();
- }
-
- public void testCalculator() throws Exception {
- // Calculate
- assertEquals(calculatorService.add(3, 2), 5.0);
- assertEquals(calculatorService.subtract(3, 2), 1.0);
- assertEquals(calculatorService.multiply(3, 2), 6.0);
- assertEquals(calculatorService.divide(3, 2), 1.5);
-
- }
-}