Advertisement
helloalbin

Code

May 9th, 2014
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 1.25 KB | None | 0 0
  1. @RunWith(Arquillian.class)
  2. public class UserResourceTest {
  3.     @ArquillianResource
  4.     private URL deploymentURL;
  5.        
  6.     private UserResource userResource;
  7.  
  8.     @Deployment
  9.     public static WebArchive create() {
  10.         WebArchive war = ShrinkWrap.create(WebArchive.class, "Test.war")
  11.                 .addPackage(UserResource.class.getPackage())
  12.                 .addClasses(UserResource.class)
  13.                 .addAsResource("test-persistance.xml", "META-INF/persistence.xml")
  14.                 .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
  15.         return war;
  16.     }
  17.  
  18.     /**
  19.      * Sets up the test environment.
  20.      */
  21.     @BeforeClass
  22.     public static void setUpClass() {
  23.         // initializes the rest easy client framework
  24.         RegisterBuiltin.register(ResteasyProviderFactory.getInstance());
  25.     }
  26.  
  27.      /**
  28.      * Sets up class.
  29.      */
  30.     @Before
  31.     public void setUp() {
  32.         System.err.println("Insde setUp");
  33.         userResource = ProxyFactory.create(UserResource.class, deploymentURL + "user");
  34.         System.err.println("userResource "+userResource);
  35.     }
  36.  
  37.    
  38.     @Test
  39.     @RunAsClient
  40.     public final void testLoginUser(@ArquillianResteasyResource UserResource userResource1) throws ApplicationException {
  41.         System.err.println("Login Got userResource ["
  42.                 + userResource1 + "] and this ["+this.userResource+"]");
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement