Skip to content

Commit cc180fd

Browse files
committed
Convert JAX-RS samples to Arquillian: Async Client
Issue: #78
1 parent b493c3a commit cc180fd

3 files changed

Lines changed: 23 additions & 233 deletions

File tree

jaxrs/async-client/src/main/java/org/javaee7/jaxrs/asyncclient/TestServlet.java

Lines changed: 0 additions & 172 deletions
This file was deleted.

jaxrs/async-client/src/main/webapp/index.jsp

Lines changed: 0 additions & 55 deletions
This file was deleted.

jaxrs/async-client/src/test/java/org/javaee7/jaxrs/asyncclient/MyResourceTest.java

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,50 @@
55
*/
66
package org.javaee7.jaxrs.asyncclient;
77

8+
import static org.junit.Assert.assertEquals;
9+
import static org.junit.Assert.fail;
10+
11+
import java.net.MalformedURLException;
812
import java.net.URL;
913
import java.util.concurrent.ExecutionException;
1014
import java.util.concurrent.Future;
15+
1116
import javax.ws.rs.client.Client;
1217
import javax.ws.rs.client.ClientBuilder;
1318
import javax.ws.rs.client.InvocationCallback;
1419
import javax.ws.rs.client.WebTarget;
1520
import javax.ws.rs.core.Response;
21+
22+
import org.jboss.arquillian.container.test.api.Deployment;
23+
import org.jboss.arquillian.junit.Arquillian;
1624
import org.jboss.arquillian.test.api.ArquillianResource;
17-
import org.junit.BeforeClass;
18-
import org.junit.Test;
19-
import static org.junit.Assert.*;
25+
import org.jboss.shrinkwrap.api.ShrinkWrap;
26+
import org.jboss.shrinkwrap.api.spec.WebArchive;
2027
import org.junit.Before;
28+
import org.junit.Test;
29+
import org.junit.runner.RunWith;
2130

2231
/**
2332
* @author Arun Gupta
2433
*/
34+
@RunWith(Arquillian.class)
2535
public class MyResourceTest {
2636

27-
// @ArquillianResource URL baseURL;
37+
@Deployment(testable = false)
38+
public static WebArchive createDeployment() {
39+
return ShrinkWrap.create(WebArchive.class)
40+
.addClasses(MyApplication.class, MyResource.class);
41+
}
42+
43+
@ArquillianResource
44+
private URL base;
2845

2946
private static WebTarget target;
3047

3148
@Before
32-
public void setUpClass() {
49+
public void setUpClass() throws MalformedURLException {
3350
Client client = ClientBuilder.newClient();
34-
target = client.target("http://localhost:8080/async-client/webresources/fruits");
51+
target = client.target(new URL(base, "webresources/fruits").toExternalForm());
3552
}
3653

3754
/**

0 commit comments

Comments
 (0)