[jboss-svn-commits] JBoss Common SVN: r3784 - in arquillian/trunk/junit/src: main/resources/META-INF/services and 5 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Nov 25 08:36:28 EST 2009


Author: aslak
Date: 2009-11-25 08:36:28 -0500 (Wed, 25 Nov 2009)
New Revision: 3784

Added:
   arquillian/trunk/junit/src/main/java/org/jboss/arquillian/junit/JUnitDeploymentAppender.java
   arquillian/trunk/junit/src/main/resources/META-INF/services/org.jboss.arquillian.spi.DeploymentAppender
   arquillian/trunk/junit/src/test/java/org/
   arquillian/trunk/junit/src/test/java/org/jboss/
   arquillian/trunk/junit/src/test/java/org/jboss/arquillian/
   arquillian/trunk/junit/src/test/java/org/jboss/arquillian/junit/
   arquillian/trunk/junit/src/test/java/org/jboss/arquillian/junit/JUnitDeploymentAppenderTestCase.java
Log:
ARQ-25 JUnit in container dependencies

Added: arquillian/trunk/junit/src/main/java/org/jboss/arquillian/junit/JUnitDeploymentAppender.java
===================================================================
--- arquillian/trunk/junit/src/main/java/org/jboss/arquillian/junit/JUnitDeploymentAppender.java	                        (rev 0)
+++ arquillian/trunk/junit/src/main/java/org/jboss/arquillian/junit/JUnitDeploymentAppender.java	2009-11-25 13:36:28 UTC (rev 3784)
@@ -0,0 +1,61 @@
+/*
+ * 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.junit;
+
+import org.jboss.arquillian.spi.DeploymentAppender;
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.Archives;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+
+/**
+ * JUnitDeploymentAppender
+ * 
+ * Package up the JUnit / Arquillian JUnit related dependencies.
+ *
+ * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @version $Revision: $
+ */
+public class JUnitDeploymentAppender implements DeploymentAppender
+{
+
+   /* (non-Javadoc)
+    * @see org.jboss.arquillian.spi.DeploymentAppender#createArchive()
+    */
+   @Override
+   public Archive<?> createArchive()
+   {
+      JavaArchive archive = Archives.create("arquillian-junit.jar", JavaArchive.class)
+                        .addPackages(
+                              true, 
+                              Package.getPackage("org.junit"),
+                              Package.getPackage("org.hamcrest"),
+                              Package.getPackage("org.jboss.arquillian.junit"))
+                        .addManifestResource(
+                              "META-INF/services/org.jboss.arquillian.spi.TestRunner",
+                              "services/org.jboss.arquillian.spi.TestRunner");
+      try {
+         archive.addPackages(
+               true, 
+               Package.getPackage("junit.framework"));
+      } catch (Exception e) {
+         // TODO: ignore, junit.framework is obsolete ?
+      }
+      
+      return archive;
+   }
+
+}

Added: arquillian/trunk/junit/src/main/resources/META-INF/services/org.jboss.arquillian.spi.DeploymentAppender
===================================================================
--- arquillian/trunk/junit/src/main/resources/META-INF/services/org.jboss.arquillian.spi.DeploymentAppender	                        (rev 0)
+++ arquillian/trunk/junit/src/main/resources/META-INF/services/org.jboss.arquillian.spi.DeploymentAppender	2009-11-25 13:36:28 UTC (rev 3784)
@@ -0,0 +1 @@
+org.jboss.arquillian.junit.JUnitDeploymentAppender
\ No newline at end of file

Added: arquillian/trunk/junit/src/test/java/org/jboss/arquillian/junit/JUnitDeploymentAppenderTestCase.java
===================================================================
--- arquillian/trunk/junit/src/test/java/org/jboss/arquillian/junit/JUnitDeploymentAppenderTestCase.java	                        (rev 0)
+++ arquillian/trunk/junit/src/test/java/org/jboss/arquillian/junit/JUnitDeploymentAppenderTestCase.java	2009-11-25 13:36:28 UTC (rev 3784)
@@ -0,0 +1,28 @@
+package org.jboss.arquillian.junit;
+
+import junit.framework.Assert;
+
+import org.jboss.shrinkwrap.api.Archive;
+import org.jboss.shrinkwrap.api.Paths;
+import org.junit.Test;
+
+
+public class JUnitDeploymentAppenderTestCase
+{
+
+   @Test
+   public void shouldGenerateDependencies() throws Exception {
+      
+      Archive<?> archive = new JUnitDeploymentAppender().createArchive();
+      
+      Assert.assertTrue(
+            "Should have added TestRunner SPI",
+            archive.contains(Paths.create("/META-INF/services/org.jboss.arquillian.spi.TestRunner")));
+      
+      Assert.assertTrue(
+            "Should have added TestRunner Impl",
+            archive.contains(Paths.create("/org/jboss/arquillian/junit/JUnitTestRunner.class")));
+
+      System.out.println(archive.toString(true));      
+   }
+}



More information about the jboss-svn-commits mailing list