Skip to content

Commit 3ee919a

Browse files
committed
Added Arquillian test for the cdi/nobeans-xml example
1 parent fbd7e37 commit 3ee919a

5 files changed

Lines changed: 49 additions & 182 deletions

File tree

cdi/nobeans-xml/src/main/java/org/javaee7/cdi/nobeans/xml/MyBean.java renamed to cdi/nobeans-xml/src/main/java/org/javaee7/cdi/nobeans/xml/ScopedBean.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
* @author Arun Gupta
4646
*/
4747
@RequestScoped
48-
public class MyBean {
48+
public class ScopedBean {
4949
public String sayHello(String name) {
5050
return "Hello " + name;
5151
}

cdi/nobeans-xml/src/main/java/org/javaee7/cdi/nobeans/xml/TestServlet.java

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

cdi/nobeans-xml/src/main/webapp/index.jsp

Lines changed: 0 additions & 55 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package org.javaee7.cdi.nobeans.xml;
2+
3+
import org.jboss.arquillian.container.test.api.Deployment;
4+
import org.jboss.arquillian.junit.Arquillian;
5+
import org.jboss.shrinkwrap.api.Archive;
6+
import org.jboss.shrinkwrap.api.ShrinkWrap;
7+
import org.jboss.shrinkwrap.api.spec.JavaArchive;
8+
import org.junit.Test;
9+
import org.junit.runner.RunWith;
10+
11+
import javax.inject.Inject;
12+
13+
import static org.hamcrest.CoreMatchers.is;
14+
import static org.hamcrest.CoreMatchers.notNullValue;
15+
import static org.junit.Assert.assertThat;
16+
17+
/**
18+
* @author Alexis Hassler
19+
*/
20+
@RunWith(Arquillian.class)
21+
public class ScopedBeanTest {
22+
@Deployment
23+
public static Archive<?> deploy() {
24+
return ShrinkWrap.create(JavaArchive.class)
25+
.addClass(ScopedBean.class);
26+
}
27+
28+
@Inject ScopedBean bean;
29+
30+
@Test
31+
public void should_scope_bean_be_injected() throws Exception {
32+
assertThat(bean, is(notNullValue()));
33+
}
34+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://jboss.org/schema/arquillian" xsi:schemaLocation="http://jboss.org/schema/arquillian
3+
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
4+
5+
<defaultProtocol type="Servlet 3.0"/>
6+
7+
<container qualifier="test" default="true">
8+
<configuration>
9+
<property name="jbossHome">${serverRoot:target/wildfly-8.0.0.Beta1}</property>
10+
<property name="serverConfig">${serverProfile:standalone-full.xml}</property>
11+
</configuration>
12+
</container>
13+
14+
</arquillian>

0 commit comments

Comments
 (0)