Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
208 additions
and
0 deletions.
There are no files selected for viewing
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
49 changes: 49 additions & 0 deletions
49
...archetype-resources/__rootArtifactId__-ejb/src/test/java/test/MemberRegistrationTest.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package ${package}.test; | ||
|
||
import static org.junit.Assert.assertNotNull; | ||
|
||
import java.util.logging.Logger; | ||
|
||
import javax.inject.Inject; | ||
|
||
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; | ||
|
||
import ${package}.controller.MemberRegistration; | ||
import ${package}.model.Member; | ||
import ${package}.util.Resources; | ||
|
||
@RunWith(Arquillian.class) | ||
public class MemberRegistrationTest { | ||
@Deployment | ||
public static Archive<?> createTestArchive() { | ||
return ShrinkWrap.create(WebArchive.class, "test.war") | ||
.addClasses(Member.class, MemberRegistration.class, Resources.class) | ||
.addAsResource("META-INF/persistence.xml", "META-INF/persistence.xml") | ||
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml"); | ||
} | ||
|
||
@Inject | ||
MemberRegistration memberRegistration; | ||
|
||
@Inject | ||
Logger log; | ||
|
||
@Test | ||
public void testRegister() throws Exception { | ||
Member newMember = memberRegistration.getNewMember(); | ||
newMember.setName("Jane Doe"); | ||
newMember.setEmail("jane@mailinator.com"); | ||
newMember.setPhoneNumber("2125551234"); | ||
memberRegistration.register(); | ||
assertNotNull(newMember.getId()); | ||
log.info(newMember.getName() + " was persisted with id " + newMember.getId()); | ||
} | ||
|
||
} |
22 changes: 22 additions & 0 deletions
22
...in/resources/archetype-resources/__rootArtifactId__-ejb/src/test/resources/arquillian.xml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<arquillian xmlns="http://jboss.org/schema/arquillian" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://jboss.org/schema/arquillian | ||
http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> | ||
|
||
<!-- Uncomment to have test archives exported to the file system for inspection --> | ||
<!-- <engine> --> | ||
<!-- <property name="deploymentExportPath">target/</property> --> | ||
<!-- </engine> --> | ||
|
||
<!-- Example configuration for a remote JBoss AS 7 instance --> | ||
<container qualifier="jboss" default="true"> | ||
<protocol type="jmx-as7"> | ||
<property name="executionType">REMOTE</property> | ||
</protocol> | ||
<configuration> | ||
<property name="jbossHome">/path/to/jboss/as</property> | ||
</configuration> | ||
</container> | ||
|
||
</arquillian> |