diff options
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services')
8 files changed, 167 insertions, 5 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/customer/Customer.java b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/customer/Customer.java new file mode 100644 index 0000000000..08506ebd48 --- /dev/null +++ b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/customer/Customer.java @@ -0,0 +1,70 @@ +/* + * 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.customer; + + +/** + * Customer data + */ +public class Customer { + private String id; + private String email; + private String name; + + public Customer() { + super(); + } + + public Customer(String id, String name, String email) { + super(); + this.id = id; + this.email = email; + this.name = name; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String toString() { + return "id: " + id + " name: " + name + " e-mail: " + email; + } + +} diff --git a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/customer/CustomerService.java b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/customer/CustomerService.java new file mode 100644 index 0000000000..9d640376e7 --- /dev/null +++ b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/customer/CustomerService.java @@ -0,0 +1,41 @@ +/* + * 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.customer; + +import javax.jws.WebResult; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; + +import org.oasisopen.sca.annotation.Remotable; + +@Remotable +public interface CustomerService { + + @GET + @WebResult(name = "Customer", targetNamespace = "") + Customer get(); + + @POST + void addCustomer(Customer customer); + + @PUT + void updateCustomer(Customer customer); +} diff --git a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/customer/CustomerServiceImpl.java b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/customer/CustomerServiceImpl.java new file mode 100644 index 0000000000..70c718a656 --- /dev/null +++ b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/customer/CustomerServiceImpl.java @@ -0,0 +1,50 @@ +/* + * 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.customer; + +import java.util.HashMap; +import java.util.Map; + +import org.oasisopen.sca.annotation.Init; +import org.oasisopen.sca.annotation.Scope; + +@Scope("COMPOSITE") +public class CustomerServiceImpl implements CustomerService { + private Map<String, Customer> customers = new HashMap<String, Customer>(); + + @Init + public void init() { + customers.put("John", new Customer("John", "John", "john@domain.com")); + } + + public Customer get() { + return customers.values().iterator().next(); + } + + public void addCustomer(Customer customer) { + customers.put(customer.getName(), customer); + } + + public void updateCustomer(Customer customer) { + if(customers.get(customer.getName()) != null) { + customers.put(customer.getName(), customer); + } + } +} diff --git a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/Catalog.java b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/store/Catalog.java index 0c880b499e..f30176f70a 100644 --- a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/Catalog.java +++ b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/store/Catalog.java @@ -17,7 +17,7 @@ * under the License. */ -package services; +package services.store; import javax.ws.rs.GET; import javax.ws.rs.POST; @@ -25,6 +25,7 @@ import javax.ws.rs.PUT; import org.oasisopen.sca.annotation.Remotable; + @Remotable public interface Catalog { diff --git a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/CurrencyConverter.java b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/store/CurrencyConverter.java index a064f3dd69..45f8949633 100644 --- a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/CurrencyConverter.java +++ b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/store/CurrencyConverter.java @@ -17,7 +17,7 @@ * under the License. */ -package services; +package services.store; import org.oasisopen.sca.annotation.Remotable; diff --git a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/CurrencyConverterImpl.java b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/store/CurrencyConverterImpl.java index c354aed447..9956e207e1 100644 --- a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/CurrencyConverterImpl.java +++ b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/store/CurrencyConverterImpl.java @@ -17,7 +17,7 @@ * under the License. */ -package services; +package services.store; public class CurrencyConverterImpl implements CurrencyConverter { public double getConversion(String fromCurrencyCode, String toCurrencyCode, double amount) { diff --git a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/FruitsCatalogImpl.java b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/store/FruitsCatalogImpl.java index b97db14149..b71bb28596 100644 --- a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/FruitsCatalogImpl.java +++ b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/store/FruitsCatalogImpl.java @@ -17,7 +17,7 @@ * under the License. */ -package services; +package services.store; import java.util.HashMap; import java.util.Map; diff --git a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/Item.java b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/store/Item.java index fe32cfc828..d5a298eee5 100644 --- a/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/Item.java +++ b/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/store/Item.java @@ -17,7 +17,7 @@ * under the License. */ -package services; +package services.store; public class Item { private String name; |