Last active
April 24, 2016 09:52
-
-
Save agritsik/2c3b23c1995dd34ba79b87520c524a94 to your computer and use it in GitHub Desktop.
JEE integration testing with Arquillian and Glassfish
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import junit.framework.TestCase; | |
import org.jboss.arquillian.container.test.api.Deployment; | |
import org.jboss.arquillian.junit.Arquillian; | |
import org.jboss.shrinkwrap.api.Archive; | |
import org.jboss.shrinkwrap.api.ShrinkWrap; | |
import org.jboss.shrinkwrap.api.asset.EmptyAsset; | |
import org.jboss.shrinkwrap.api.spec.WebArchive; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
@RunWith(Arquillian.class) | |
public class ServiceTest extends TestCase { | |
// EJB injection is available here | |
// @EJB MyService myService; | |
@Deployment | |
public static Archive<?> createDeployment() { | |
return ShrinkWrap.create(WebArchive.class, "test.war") | |
.addPackages(true, "${package}") | |
.addAsResource("test-persistence.xml", "META-INF/persistence.xml") | |
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); | |
} | |
@Test | |
public void testCRUD() throws Exception { | |
// Write tests here ... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment