|
5 | 5 | */ |
6 | 6 | package org.javaee7.jaxrs.asyncclient; |
7 | 7 |
|
| 8 | +import static org.junit.Assert.assertEquals; |
| 9 | +import static org.junit.Assert.fail; |
| 10 | + |
| 11 | +import java.net.MalformedURLException; |
8 | 12 | import java.net.URL; |
9 | 13 | import java.util.concurrent.ExecutionException; |
10 | 14 | import java.util.concurrent.Future; |
| 15 | + |
11 | 16 | import javax.ws.rs.client.Client; |
12 | 17 | import javax.ws.rs.client.ClientBuilder; |
13 | 18 | import javax.ws.rs.client.InvocationCallback; |
14 | 19 | import javax.ws.rs.client.WebTarget; |
15 | 20 | import javax.ws.rs.core.Response; |
| 21 | + |
| 22 | +import org.jboss.arquillian.container.test.api.Deployment; |
| 23 | +import org.jboss.arquillian.junit.Arquillian; |
16 | 24 | 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; |
20 | 27 | import org.junit.Before; |
| 28 | +import org.junit.Test; |
| 29 | +import org.junit.runner.RunWith; |
21 | 30 |
|
22 | 31 | /** |
23 | 32 | * @author Arun Gupta |
24 | 33 | */ |
| 34 | +@RunWith(Arquillian.class) |
25 | 35 | public class MyResourceTest { |
26 | 36 |
|
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; |
28 | 45 |
|
29 | 46 | private static WebTarget target; |
30 | 47 |
|
31 | 48 | @Before |
32 | | - public void setUpClass() { |
| 49 | + public void setUpClass() throws MalformedURLException { |
33 | 50 | 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()); |
35 | 52 | } |
36 | 53 |
|
37 | 54 | /** |
|
0 commit comments