You can clone with HTTPS or SSH.
@RunWith(Arquillian.class) public class CustomerResourceClientTest { private static final String REST_PATH = "rest"; @Deployment(testable = false) public static Archive<?> createDeployment() { return ShrinkWrap.create(WebArchive.class) .addPackage(Customer.class.getPackage()) .addClasses(CustomerResource.class) .addDirectory("WEB-INF/lib") // RESTEASY-507 .addWebResource("import.sql", "classes/import.sql") .addWebResource(EmptyAsset.INSTANCE, "beans.xml") .addManifestResource(new StringAsset( Descriptors.create(PersistenceDescriptor.class) .version("1.0") .persistenceUnit("sellmore") .provider(HIBERNATE) .jtaDataSource("java:/DefaultDS") .schemaGenerationMode(CREATE_DROP) .showSql() .exportAsString() ), "persistence.xml") .setWebXML(new StringAsset( Descriptors.create(WebAppDescriptor.class) .version("3.0") .contextParam("resteasy.scan", "true") .contextParam("resteasy.servlet.mapping.prefix", REST_PATH) .exportAsString() )); } @Test public void testGetCustomerByIdUsingClientRequest(@ArquillianResource URL base) throws Exception { // GET http://localhost:8080/test/rest/customer/1 ClientRequest request = new ClientRequest(new URL(base, REST_PATH + "/customer/1").toExternalForm()); request.header("Accept", MediaType.APPLICATION_XML); // we're expecting a String back ClientResponse<String> responseObj = request.get(String.class); Assert.assertEquals(200, responseObj.getStatus()); System.out.println("GET /customer/1 HTTP/1.1\n\n" + responseObj.getEntity()); Assert.assertEquals( "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + "<customer><id>1</id><name>Acme Corporation</name></customer>", responseObj.getEntity()); } }
Perfect, exactly what I wanted.
Perfect, exactly what I wanted.