Author: jliu
Date: Thu Jun 14 01:08:02 2007
New Revision: 547164
URL: http://svn.apache.org/viewvc?view=rev&rev=547164
Log:
Test case for CXF-558: JAX-WS Context not injected for RESTful service
implementations
Modified:
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/CustomerService.java
Modified:
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/CustomerService.java
URL:
http://svn.apache.org/viewvc/incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/CustomerService.java?view=diff&rev=547164&r1=547163&r2=547164
==============================================================================
---
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/CustomerService.java
(original)
+++
incubator/cxf/trunk/testutils/src/main/java/org/apache/cxf/customer/bare/CustomerService.java
Thu Jun 14 01:08:02 2007
@@ -21,9 +21,12 @@
import java.util.HashMap;
import java.util.Map;
+import javax.annotation.Resource;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.WebServiceException;
import org.apache.cxf.customer.Customer;
import org.apache.cxf.customer.CustomerNotFoundDetails;
@@ -40,7 +43,10 @@
public class CustomerService {
long currentId = 1;
Map<Long, Customer> customers = new HashMap<Long, Customer>();
-
+
+ @Resource
+ private WebServiceContext context;
+
public CustomerService() {
Customer customer = createCustomer();
customers.put(customer.getId(), customer);
@@ -52,6 +58,11 @@
public Customers getCustomers(@WebParam(name = "GetCustomers")
GetCustomers req) {
Customers cbean = new Customers();
cbean.setCustomer(customers.values());
+
+ if (context == null || context.getMessageContext() == null) {
+ throw new WebServiceException("WebServiceContext is null!");
+ }
+
return cbean;
}