[jboss-svn-commits] JBoss Common SVN: r4400 - in arquillian/trunk/containers/openwebbeans-embedded: src/test/java and 5 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu May 20 06:48:29 EDT 2010
Author: aslak
Date: 2010-05-20 06:48:29 -0400 (Thu, 20 May 2010)
New Revision: 4400
Added:
arquillian/trunk/containers/openwebbeans-embedded/src/test/java/org/
arquillian/trunk/containers/openwebbeans-embedded/src/test/java/org/jboss/
arquillian/trunk/containers/openwebbeans-embedded/src/test/java/org/jboss/arquillian/
arquillian/trunk/containers/openwebbeans-embedded/src/test/java/org/jboss/arquillian/openwebbeans/
arquillian/trunk/containers/openwebbeans-embedded/src/test/java/org/jboss/arquillian/openwebbeans/OpenWebBeansIntegrationTestCase.java
arquillian/trunk/containers/openwebbeans-embedded/src/test/java/org/jboss/arquillian/openwebbeans/beans/
arquillian/trunk/containers/openwebbeans-embedded/src/test/java/org/jboss/arquillian/openwebbeans/beans/MyBean.java
Modified:
arquillian/trunk/containers/openwebbeans-embedded/pom.xml
Log:
ARQ-143 Added integration test case. MyBean is not ApplicationScoped due to https://issues.apache.org/jira/browse/OWB-339. Fix set to 1.0 release of OWB
Modified: arquillian/trunk/containers/openwebbeans-embedded/pom.xml
===================================================================
--- arquillian/trunk/containers/openwebbeans-embedded/pom.xml 2010-05-20 10:15:34 UTC (rev 4399)
+++ arquillian/trunk/containers/openwebbeans-embedded/pom.xml 2010-05-20 10:48:29 UTC (rev 4400)
@@ -105,11 +105,19 @@
<version>1.2</version>
</dependency>
+ <!-- Test dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-junit</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
</project>
Added: arquillian/trunk/containers/openwebbeans-embedded/src/test/java/org/jboss/arquillian/openwebbeans/OpenWebBeansIntegrationTestCase.java
===================================================================
--- arquillian/trunk/containers/openwebbeans-embedded/src/test/java/org/jboss/arquillian/openwebbeans/OpenWebBeansIntegrationTestCase.java (rev 0)
+++ arquillian/trunk/containers/openwebbeans-embedded/src/test/java/org/jboss/arquillian/openwebbeans/OpenWebBeansIntegrationTestCase.java 2010-05-20 10:48:29 UTC (rev 4400)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.arquillian.openwebbeans;
+
+import javax.inject.Inject;
+
+import junit.framework.Assert;
+
+import org.jboss.arquillian.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.openwebbeans.beans.MyBean;
+import org.jboss.shrinkwrap.api.ArchivePaths;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.impl.base.asset.ByteArrayAsset;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+/**
+ * OpenWebBeansIntegrationTestCase
+ *
+ * @author <a href="mailto:aslak at redhat.com">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+ at RunWith(Arquillian.class)
+public class OpenWebBeansIntegrationTestCase
+{
+ @Deployment
+ public static JavaArchive createdeployment()
+ {
+ return ShrinkWrap.create("test.jar", JavaArchive.class)
+ .addClasses(
+ OpenWebBeansIntegrationTestCase.class,
+ MyBean.class)
+ .addManifestResource(
+ new ByteArrayAsset("<beans/>".getBytes()), ArchivePaths.create("beans.xml"));
+ }
+
+ @Inject
+ private MyBean instanceVariable;
+
+ @Test
+ public void shouldBeAbleToInjectBeanAsInstanceVariable() throws Exception
+ {
+ Assert.assertNotNull(
+ "Verify that the Bean has been injected",
+ instanceVariable);
+
+ Assert.assertEquals("aslak", instanceVariable.getName());
+ }
+
+ @Test
+ public void shouldBeAbleToInjectBeanAsArgumentVariable(MyBean argumentVariable) throws Exception
+ {
+ Assert.assertNotNull(
+ "Verify that the Bean has been injected",
+ argumentVariable);
+
+ Assert.assertEquals("aslak", argumentVariable.getName());
+ }
+}
Added: arquillian/trunk/containers/openwebbeans-embedded/src/test/java/org/jboss/arquillian/openwebbeans/beans/MyBean.java
===================================================================
--- arquillian/trunk/containers/openwebbeans-embedded/src/test/java/org/jboss/arquillian/openwebbeans/beans/MyBean.java (rev 0)
+++ arquillian/trunk/containers/openwebbeans-embedded/src/test/java/org/jboss/arquillian/openwebbeans/beans/MyBean.java 2010-05-20 10:48:29 UTC (rev 4400)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.arquillian.openwebbeans.beans;
+
+
+/**
+ * MyBean
+ *
+ * @author <a href="mailto:aslak at redhat.com">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+//@ApplicationScoped // https://issues.apache.org/jira/browse/OWB-339 Non-Contextual injection cause nullpointer
+public class MyBean
+{
+ public String getName()
+ {
+ return "aslak";
+ }
+}
More information about the jboss-svn-commits
mailing list