use of org.apache.cxf.jaxrs.resources.BookStore in project cxf by apache.
the class JAXRSClientFactoryBeanTest method testCreateClientWithUserResource.
@Test
public void testCreateClientWithUserResource() throws Exception {
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress("http://bar");
UserResource r = new UserResource();
r.setName(BookStore.class.getName());
r.setPath("/");
UserOperation op = new UserOperation();
op.setName("getDescription");
op.setVerb("GET");
r.setOperations(Collections.singletonList(op));
bean.setModelBeans(r);
assertTrue(bean.create() instanceof BookStore);
}
use of org.apache.cxf.jaxrs.resources.BookStore in project cxf by apache.
the class JAXRSClientFactoryBeanTest method testGetConduit.
@Test
public void testGetConduit() throws Exception {
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress("http://bar");
bean.setResourceClass(BookStore.class);
BookStore store = bean.create(BookStore.class);
Conduit conduit = WebClient.getConfig(store).getConduit();
assertTrue(conduit instanceof HTTPConduit);
}
use of org.apache.cxf.jaxrs.resources.BookStore in project cxf by apache.
the class WebClientTest method testProxyConfiguration.
@Test
public void testProxyConfiguration() {
// interface
BookInterface proxy = JAXRSClientFactory.create("http://foo", BookInterface.class);
assertNotNull(WebClient.getConfig(proxy) != null);
// cglib
BookStore proxy2 = JAXRSClientFactory.create("http://foo", BookStore.class);
assertNotNull(WebClient.getConfig(proxy2) != null);
}
use of org.apache.cxf.jaxrs.resources.BookStore in project cxf by apache.
the class JAXRSClientFactoryBeanTest method testCreateClientCustomLoader.
@Test
public void testCreateClientCustomLoader() throws Exception {
ProxyClassLoader loader = new ProxyClassLoader(BookStore.class.getClassLoader());
loader.addLoader(BookStore.class.getClassLoader());
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress("http://bar");
bean.setResourceClass(BookStore.class);
bean.setClassLoader(loader);
BookStore client = (BookStore) bean.createWithValues(BookStore.class);
assertNotNull(client);
assertSame(client.getClass().getClassLoader(), loader);
// tricky to test the loader has been used correctly with Maven
// given that the system loader loads all the test classes
}
use of org.apache.cxf.jaxrs.resources.BookStore in project cxf by apache.
the class UriBuilderImplTest method testAddPathClassMethod.
@Test
public void testAddPathClassMethod() throws Exception {
URI uri = new URI("http://foo/");
URI newUri = new UriBuilderImpl().uri(uri).path(BookStore.class).path(BookStore.class, "updateBook").path("bar").build();
assertEquals("URI is not built correctly", new URI("http://foo/bookstore/books/bar"), newUri);
}
Aggregations