diff options
Diffstat (limited to 'sca-java-2.x/tags/2.0-Beta1-RC1/modules/binding-rest-runtime/src/test/java/services/store')
6 files changed, 0 insertions, 281 deletions
diff --git a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/binding-rest-runtime/src/test/java/services/store/Catalog.java b/sca-java-2.x/tags/2.0-Beta1-RC1/modules/binding-rest-runtime/src/test/java/services/store/Catalog.java deleted file mode 100644 index 7e579c6aba..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/binding-rest-runtime/src/test/java/services/store/Catalog.java +++ /dev/null @@ -1,51 +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 services.store; - -import javax.ws.rs.DELETE; -import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; -import javax.ws.rs.Path; -import javax.ws.rs.PathParam; - -import org.oasisopen.sca.annotation.Remotable; - - -@Remotable -public interface Catalog { - - @GET - Items getItem(); - - @GET - @Path("{id}") - Item getItemById(@PathParam("id") String itemId); - - @POST - void addItem(Item item); - - @PUT - void updateItem(Item item); - - @DELETE - @Path("{id}") - void deleteItem(@PathParam("id") String itemId); -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/binding-rest-runtime/src/test/java/services/store/CurrencyConverter.java b/sca-java-2.x/tags/2.0-Beta1-RC1/modules/binding-rest-runtime/src/test/java/services/store/CurrencyConverter.java deleted file mode 100644 index 45f8949633..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/binding-rest-runtime/src/test/java/services/store/CurrencyConverter.java +++ /dev/null @@ -1,29 +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 services.store; - -import org.oasisopen.sca.annotation.Remotable; - -@Remotable -public interface CurrencyConverter { - public double getConversion(String fromCurrenycCode, String toCurrencyCode, double amount); - - public String getCurrencySymbol(String currencyCode); -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/binding-rest-runtime/src/test/java/services/store/CurrencyConverterImpl.java b/sca-java-2.x/tags/2.0-Beta1-RC1/modules/binding-rest-runtime/src/test/java/services/store/CurrencyConverterImpl.java deleted file mode 100644 index 9956e207e1..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/binding-rest-runtime/src/test/java/services/store/CurrencyConverterImpl.java +++ /dev/null @@ -1,38 +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 services.store; - -public class CurrencyConverterImpl implements CurrencyConverter { - public double getConversion(String fromCurrencyCode, String toCurrencyCode, double amount) { - if (toCurrencyCode.equals("USD")) - return amount; - else if (toCurrencyCode.equals("EUR")) - return ((double)Math.round(amount * 0.7256 * 100)) /100; - return 0; - } - - public String getCurrencySymbol(String currencyCode) { - if (currencyCode.equals("USD")) - return "$"; - else if (currencyCode.equals("EUR")) - return "E"; //"€"; - return "?"; - } -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/binding-rest-runtime/src/test/java/services/store/FruitsCatalogImpl.java b/sca-java-2.x/tags/2.0-Beta1-RC1/modules/binding-rest-runtime/src/test/java/services/store/FruitsCatalogImpl.java deleted file mode 100644 index afe3d3863e..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/binding-rest-runtime/src/test/java/services/store/FruitsCatalogImpl.java +++ /dev/null @@ -1,76 +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 services.store; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.oasisopen.sca.annotation.Init; -import org.oasisopen.sca.annotation.Property; -import org.oasisopen.sca.annotation.Reference; -import org.oasisopen.sca.annotation.Scope; - -@Scope("COMPOSITE") -public class FruitsCatalogImpl implements Catalog { - - @Property - public String currencyCode = "USD"; - - @Reference - public CurrencyConverter currencyConverter; - - private Map<String, Item> catalog = new HashMap<String, Item>(); - - @Init - public void init() { - String currencySymbol = currencyConverter.getCurrencySymbol(currencyCode); - catalog.put("Apple", new Item("Apple", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 2.99))); - catalog.put("Orange", new Item("Orange", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 3.55))); - catalog.put("Pear", new Item("Pear", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 1.55))); - } - - public Items getItem() { - Items items = new Items(); - items.setItems(new ArrayList<Item>(catalog.values())); - return items; - } - - public Item getItemById(String itemId) { - return catalog.get(itemId); - } - - public void addItem(Item item) { - catalog.put(item.getName(),item); - } - - public void updateItem(Item item) { - if(catalog.get(item.getName()) != null) { - catalog.put(item.getName(), item); - } - } - - public void deleteItem(String itemId) { - if(catalog.get(itemId) != null) { - catalog.remove(itemId); - } - } -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/binding-rest-runtime/src/test/java/services/store/Item.java b/sca-java-2.x/tags/2.0-Beta1-RC1/modules/binding-rest-runtime/src/test/java/services/store/Item.java deleted file mode 100644 index d5a298eee5..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/binding-rest-runtime/src/test/java/services/store/Item.java +++ /dev/null @@ -1,50 +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 services.store; - -public class Item { - private String name; - private String price; - - public Item() { - } - - public Item(String name, String price) { - this.name = name; - this.price = price; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getPrice() { - return price; - } - - public void setPrice(String price) { - this.price = price; - } - -} diff --git a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/binding-rest-runtime/src/test/java/services/store/Items.java b/sca-java-2.x/tags/2.0-Beta1-RC1/modules/binding-rest-runtime/src/test/java/services/store/Items.java deleted file mode 100644 index 82a995943d..0000000000 --- a/sca-java-2.x/tags/2.0-Beta1-RC1/modules/binding-rest-runtime/src/test/java/services/store/Items.java +++ /dev/null @@ -1,37 +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 services.store; - -import java.util.List; - -/** - * - */ -public class Items { - private List<Item> items; - - public List<Item> getItems() { - return items; - } - - public void setItems(List<Item> items) { - this.items = items; - } -} |