Map<String, Object> props = new HashMap<String, Object>();
props.put("contextMatchStrategy", "stem");
sf.setProperties(props);
ServerImpl svr = (ServerImpl) sf.create();
URIMapper mapper = (URIMapper) svr.getEndpoint().getService().get(URIMapper.class.getName());
assertNotNull(mapper);
BindingOperationInfo bop = mapper.getOperation("/customers", "GET", null);
assertNotNull(bop);
assertEquals("getCustomers", bop.getName().getLocalPart());
assertTrue(bop.isUnwrappedCapable());
bop = mapper.getOperation("/customers", "POST", null);
assertNotNull(bop);
assertEquals("addCustomer", bop.getName().getLocalPart());
bop = mapper.getOperation("/customers/123", "GET", null);
assertNotNull(bop);
assertEquals("getCustomer", bop.getName().getLocalPart());
bop = mapper.getOperation("/customers/123", "PUT", null);
assertNotNull(bop);
assertEquals("updateCustomer", bop.getName().getLocalPart());
// TEST POST/GETs
Document res = get("http://localhost:9001/customers");
assertNotNull(res);
addNamespace("c", "http://cxf.apache.org/jra");
assertValid("/c:getCustomersResponse/c:customers", res);
assertValid("/c:getCustomersResponse/c:customers/c:customer/c:id[text()='123']", res);
assertValid("/c:getCustomersResponse/c:customers/c:customer/c:name[text()='Dan Diephouse']", res);
res = get("http://localhost:9001/customers/123");
assertNotNull(res);
addNamespace("c", "http://cxf.apache.org/jra");
assertValid("/c:getCustomerResponse/c:customer", res);
assertValid("/c:getCustomerResponse/c:customer/c:id[text()='123']", res);
assertValid("/c:getCustomerResponse/c:customer/c:name[text()='Dan Diephouse']", res);
res = put("http://localhost:9001/customers/123", "update.xml");
assertNotNull(res);
assertValid("/c:updateCustomerResponse", res);
res = post("http://localhost:9001/customers", "add.xml");
assertNotNull(res);
assertValid("/c:addCustomerResponse", res);
// Get the updated document
res = get("http://localhost:9001/customers/123");
assertNotNull(res);
assertValid("/c:getCustomerResponse/c:customer", res);
assertValid("/c:getCustomerResponse/c:customer/c:id[text()='123']", res);
assertValid("/c:getCustomerResponse/c:customer/c:name[text()='Danno Manno']", res);
svr.stop();
}