From fd34d4342b95600825720708d7ff6917bba1ee42 Mon Sep 17 00:00:00 2001 From: lresende Date: Wed, 27 Jan 2010 09:41:44 +0000 Subject: Java SCA 1.6 RC1 Release Tag git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@903579 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/test/java/services/Cart.java | 28 ++++++ .../src/test/java/services/Item.java | 66 ++++++++++++++ .../test/java/services/ShoppingCartClientImpl.java | 57 ++++++++++++ .../src/test/java/services/ShoppingCartImpl.java | 100 +++++++++++++++++++++ .../src/test/resources/assembly/assets.xml | 38 ++++++++ .../src/test/resources/assembly/client.xml | 34 +++++++ .../src/test/resources/assembly/store.xml | 34 +++++++ .../resources/assets/META-INF/sca-contribution.xml | 22 +++++ .../resources/client/META-INF/sca-contribution.xml | 24 +++++ .../src/test/resources/client/client.composite | 35 ++++++++ .../resources/store/META-INF/sca-contribution.xml | 24 +++++ .../src/test/resources/store/store.composite | 32 +++++++ 12 files changed, 494 insertions(+) create mode 100644 sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/java/services/Cart.java create mode 100644 sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/java/services/Item.java create mode 100644 sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/java/services/ShoppingCartClientImpl.java create mode 100644 sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/java/services/ShoppingCartImpl.java create mode 100644 sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/assembly/assets.xml create mode 100644 sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/assembly/client.xml create mode 100644 sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/assembly/store.xml create mode 100644 sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/assets/META-INF/sca-contribution.xml create mode 100644 sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/client/META-INF/sca-contribution.xml create mode 100644 sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/client/client.composite create mode 100644 sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/store/META-INF/sca-contribution.xml create mode 100644 sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/store/store.composite (limited to 'sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test') diff --git a/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/java/services/Cart.java b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/java/services/Cart.java new file mode 100644 index 0000000000..9e6226d963 --- /dev/null +++ b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/java/services/Cart.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 services; + +import org.apache.tuscany.sca.data.collection.Collection; +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface Cart extends Collection { + +} diff --git a/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/java/services/Item.java b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/java/services/Item.java new file mode 100644 index 0000000000..81cefcdbef --- /dev/null +++ b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/java/services/Item.java @@ -0,0 +1,66 @@ +/* + * 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; + + +public class Item { + private String name; + private String price; + private String origin; + + public Item() { + } + + public Item(String name, String price, String origin) { + this.name = name; + this.price = price; + this.origin = origin; + } + + 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; + } + + public String getOrigin() { + return origin; + } + + public void setOrigin(String origin) { + this.origin = origin; + } + +} diff --git a/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/java/services/ShoppingCartClientImpl.java b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/java/services/ShoppingCartClientImpl.java new file mode 100644 index 0000000000..c32853b3a9 --- /dev/null +++ b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/java/services/ShoppingCartClientImpl.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 services; + +import org.apache.tuscany.sca.data.collection.Entry; +import org.apache.tuscany.sca.data.collection.NotFoundException; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; + +@Scope("COMPOSITE") +public class ShoppingCartClientImpl implements Cart { + + @Reference + public Cart cart; + + public Entry[] getAll() { + return cart.getAll(); + } + + public Item get(String key) throws NotFoundException { + return cart.get(key); + } + + public String post(String key, Item item) { + return cart.post(key, item); + } + + public void put(String key, Item item) throws NotFoundException { + cart.put(key, item); + } + + public void delete(String key) throws NotFoundException { + cart.delete(key); + } + + public Entry[] query(String queryString) { + return cart.query(queryString); + } + +} diff --git a/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/java/services/ShoppingCartImpl.java b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/java/services/ShoppingCartImpl.java new file mode 100644 index 0000000000..30abfe77a0 --- /dev/null +++ b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/java/services/ShoppingCartImpl.java @@ -0,0 +1,100 @@ +/* + * 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; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.apache.tuscany.sca.data.collection.Entry; +import org.apache.tuscany.sca.data.collection.NotFoundException; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; + +@Scope("COMPOSITE") +public class ShoppingCartImpl implements Cart { + + private Map cart; + + @Init + public void init() { + cart = new HashMap(); + } + + public Entry[] getAll() { + Entry[] entries = new Entry[cart.size()]; + int i = 0; + for (Map.Entry e: cart.entrySet()) { + entries[i++] = new Entry(e.getKey(), e.getValue()); + } + return entries; + } + + public Item get(String key) throws NotFoundException { + Item item = cart.get(key); + if (item == null) { + throw new NotFoundException(key); + } else { + return item; + } + } + + public String post(String key, Item item) { + if (key == null) { + key ="cart-" + UUID.randomUUID().toString(); + } + cart.put(key, item); + return key; + } + + public void put(String key, Item item) throws NotFoundException { + if (!cart.containsKey(key)) { + throw new NotFoundException(key); + } + cart.put(key, item); + } + + public void delete(String key) throws NotFoundException { + if (key == null || key.equals("")) { + cart.clear(); + } else { + Item item = cart.remove(key); + if (item == null) + throw new NotFoundException(key); + } + } + + public Entry[] query(String queryString) { + List> entries = new ArrayList>(); + if (queryString.startsWith("name=")) { + String name = queryString.substring(5); + for (Map.Entry e: cart.entrySet()) { + Item item = e.getValue(); + if (item.getName().equals(name)) { + entries.add(new Entry(e.getKey(), e.getValue())); + } + } + } + return entries.toArray(new Entry[entries.size()]); + } + +} diff --git a/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/assembly/assets.xml b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/assembly/assets.xml new file mode 100644 index 0000000000..10693a89e6 --- /dev/null +++ b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/assembly/assets.xml @@ -0,0 +1,38 @@ + + + + assets + false + + jar + + + + + target/test-classes/assets + / + + + target/test-classes/services + /services + + + + diff --git a/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/assembly/client.xml b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/assembly/client.xml new file mode 100644 index 0000000000..5b34693bee --- /dev/null +++ b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/assembly/client.xml @@ -0,0 +1,34 @@ + + + + client + false + + jar + + + + + target/test-classes/client + / + + + + diff --git a/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/assembly/store.xml b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/assembly/store.xml new file mode 100644 index 0000000000..d19b7eb161 --- /dev/null +++ b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/assembly/store.xml @@ -0,0 +1,34 @@ + + + + store + false + + jar + + + + + target/test-classes/store + / + + + + diff --git a/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/assets/META-INF/sca-contribution.xml b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/assets/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..33fe814c3a --- /dev/null +++ b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/assets/META-INF/sca-contribution.xml @@ -0,0 +1,22 @@ + + + + + \ No newline at end of file diff --git a/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/client/META-INF/sca-contribution.xml b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/client/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..14e1cdb672 --- /dev/null +++ b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/client/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/client/client.composite b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/client/client.composite new file mode 100644 index 0000000000..1279b319c4 --- /dev/null +++ b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/client/client.composite @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + diff --git a/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/store/META-INF/sca-contribution.xml b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/store/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..52348106f2 --- /dev/null +++ b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/store/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + + \ No newline at end of file diff --git a/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/store/store.composite b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/store/store.composite new file mode 100644 index 0000000000..d4f18771d8 --- /dev/null +++ b/sca-java-1.x/tags/1.6-RC1/samples/domain-management/src/test/resources/store/store.composite @@ -0,0 +1,32 @@ + + + + + + + + + + + + -- cgit v1.2.3