deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject git commit: DELTASPIKE-536 aligned creation of test-archives
Date Fri, 07 Mar 2014 09:54:02 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 80ea63f28 -> c015a6c2e


DELTASPIKE-536 aligned creation of test-archives


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/c015a6c2
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/c015a6c2
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/c015a6c2

Branch: refs/heads/master
Commit: c015a6c2e36b9647e212cda1ed8f7e63a8b7bb2e
Parents: 80ea63f
Author: gpetracek <gpetracek@apache.org>
Authored: Fri Mar 7 10:29:33 2014 +0100
Committer: gpetracek <gpetracek@apache.org>
Committed: Fri Mar 7 10:29:33 2014 +0100

----------------------------------------------------------------------
 .../test/servlet/impl/Deployments.java          | 76 --------------------
 .../event/context/ServletContextEventsTest.java |  7 +-
 .../request/RequestResponseEventsTest.java      |  7 +-
 .../impl/event/session/SessionEventsTest.java   |  7 +-
 .../producer/ServletContextInjectionTest.java   |  7 +-
 .../producer/ServletObjectInjectionTest.java    |  6 +-
 .../resourceloader/WebResourceProviderTest.java |  7 +-
 .../test/servlet/impl/util/ArchiveUtils.java    | 53 ++++++++++++++
 8 files changed, 71 insertions(+), 99 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/c015a6c2/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/Deployments.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/Deployments.java
b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/Deployments.java
deleted file mode 100644
index 3289be8..0000000
--- a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/Deployments.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.apache.deltaspike.test.servlet.impl;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.importer.ExplodedImporter;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-
-public class Deployments
-{
-
-    public static Collection<JavaArchive> getDeltaSpikeCoreArchives()
-    {
-
-        JavaArchive coreApiArchive = ShrinkWrap.create(JavaArchive.class)
-                .as(ExplodedImporter.class)
-                .importDirectory("../../../core/api/target/classes")
-                .as(JavaArchive.class);
-
-        JavaArchive coreImplArchive = ShrinkWrap.create(JavaArchive.class)
-                .as(ExplodedImporter.class)
-                .importDirectory("../../../core/impl/target/classes")
-                .as(JavaArchive.class);
-
-        return Arrays.asList(coreApiArchive, coreImplArchive);
-    
-    }
-
-    public static Collection<JavaArchive> getDeltaSpikeServletArchives()
-    {
-
-        JavaArchive servletApiArchive = ShrinkWrap.create(JavaArchive.class)
-                .as(ExplodedImporter.class)
-                .importDirectory("../api/target/classes")
-                .as(JavaArchive.class);
-
-        JavaArchive servletImplArchive = ShrinkWrap.create(JavaArchive.class)
-                .as(ExplodedImporter.class)
-                .importDirectory("../impl/target/classes")
-                .as(JavaArchive.class);
-
-        return Arrays.asList(servletApiArchive, servletImplArchive);
-
-    }
-
-    /**
-     * @return
-     */
-    public static JavaArchive getTestSupportArchives()
-    {
-        return ShrinkWrap.create(JavaArchive.class, "utils.jar")
-                .addPackages(true, "org.apache.http")  
-                .addPackages(true, "org.apache.deltaspike.test.category")
-                ;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/c015a6c2/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/context/ServletContextEventsTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/context/ServletContextEventsTest.java
b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/context/ServletContextEventsTest.java
index 50ad6c0..ba3c74a 100644
--- a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/context/ServletContextEventsTest.java
+++ b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/context/ServletContextEventsTest.java
@@ -24,7 +24,7 @@ import static org.junit.Assert.assertTrue;
 import javax.inject.Inject;
 
 import org.apache.deltaspike.test.category.WebProfileCategory;
-import org.apache.deltaspike.test.servlet.impl.Deployments;
+import org.apache.deltaspike.test.servlet.impl.util.ArchiveUtils;
 import org.jboss.arquillian.container.test.api.Deployment;
 import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.shrinkwrap.api.ShrinkWrap;
@@ -50,9 +50,8 @@ public class ServletContextEventsTest
     public static WebArchive getDeployment()
     {
         return ShrinkWrap.create(WebArchive.class, ServletContextEventsTest.class.getSimpleName()
+ ".war")
-                .addAsLibraries(Deployments.getDeltaSpikeCoreArchives())
-                .addAsLibraries(Deployments.getDeltaSpikeServletArchives())
-                .addAsLibraries(Deployments.getTestSupportArchives())
+                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndServletModuleArchive())
+                .addAsResource("META-INF/web-fragment.xml", "META-INF/web-fragment.xml")
                 .addClass(ServletContextEventsObserver.class)
                 .addAsWebInfResource(new StringAsset("<beans/>"), "beans.xml")
                 .addAsWebResource(new StringAsset("foobar"), "foobar.txt")

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/c015a6c2/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/request/RequestResponseEventsTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/request/RequestResponseEventsTest.java
b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/request/RequestResponseEventsTest.java
index 2c6f599..d15e855 100644
--- a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/request/RequestResponseEventsTest.java
+++ b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/request/RequestResponseEventsTest.java
@@ -26,7 +26,7 @@ import java.net.URL;
 import javax.inject.Inject;
 
 import org.apache.deltaspike.test.category.WebProfileCategory;
-import org.apache.deltaspike.test.servlet.impl.Deployments;
+import org.apache.deltaspike.test.servlet.impl.util.ArchiveUtils;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.impl.client.DefaultHttpClient;
@@ -54,9 +54,8 @@ public class RequestResponseEventsTest
     public static WebArchive getDeployment()
     {
         return ShrinkWrap.create(WebArchive.class, RequestResponseEventsTest.class.getSimpleName()
+ ".war")
-                .addAsLibraries(Deployments.getDeltaSpikeCoreArchives())
-                .addAsLibraries(Deployments.getDeltaSpikeServletArchives())
-                .addAsLibraries(Deployments.getTestSupportArchives())
+                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndServletModuleArchive())
+                .addAsResource("META-INF/web-fragment.xml", "META-INF/web-fragment.xml")
                 .addClass(RequestResponseEventsObserver.class)
                 .addAsWebInfResource(new StringAsset("<beans/>"), "beans.xml")
                 .addAsWebResource(new StringAsset("foobar"), "foobar.txt");

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/c015a6c2/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/session/SessionEventsTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/session/SessionEventsTest.java
b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/session/SessionEventsTest.java
index 9234e1b..dadb566 100644
--- a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/session/SessionEventsTest.java
+++ b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/event/session/SessionEventsTest.java
@@ -26,7 +26,7 @@ import java.net.URL;
 import javax.inject.Inject;
 
 import org.apache.deltaspike.test.category.WebProfileCategory;
-import org.apache.deltaspike.test.servlet.impl.Deployments;
+import org.apache.deltaspike.test.servlet.impl.util.ArchiveUtils;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.params.ClientPNames;
@@ -61,9 +61,8 @@ public class SessionEventsTest
     public static WebArchive getDeployment()
     {
         return ShrinkWrap.create(WebArchive.class, SessionEventsTest.class.getSimpleName()
+ ".war")
-                .addAsLibraries(Deployments.getDeltaSpikeCoreArchives())
-                .addAsLibraries(Deployments.getDeltaSpikeServletArchives())
-                .addAsLibraries(Deployments.getTestSupportArchives())
+                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndServletModuleArchive())
+                .addAsResource("META-INF/web-fragment.xml", "META-INF/web-fragment.xml")
                 .addClass(SessionEventsObserver.class)
                 .addClass(CreateSessionServlet.class)
                 .addClass(DestroySessionServlet.class)

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/c015a6c2/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/producer/ServletContextInjectionTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/producer/ServletContextInjectionTest.java
b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/producer/ServletContextInjectionTest.java
index beec47c..e2f456c 100644
--- a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/producer/ServletContextInjectionTest.java
+++ b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/producer/ServletContextInjectionTest.java
@@ -26,7 +26,7 @@ import javax.servlet.ServletContext;
 
 import org.apache.deltaspike.core.api.common.DeltaSpike;
 import org.apache.deltaspike.test.category.WebProfileCategory;
-import org.apache.deltaspike.test.servlet.impl.Deployments;
+import org.apache.deltaspike.test.servlet.impl.util.ArchiveUtils;
 import org.hamcrest.Matchers;
 import org.jboss.arquillian.container.test.api.Deployment;
 import org.jboss.arquillian.junit.Arquillian;
@@ -51,9 +51,8 @@ public class ServletContextInjectionTest
     public static WebArchive getDeployment()
     {
         return ShrinkWrap.create(WebArchive.class, ServletContextInjectionTest.class.getSimpleName()
+ ".war")
-                .addAsLibraries(Deployments.getDeltaSpikeCoreArchives())
-                .addAsLibraries(Deployments.getDeltaSpikeServletArchives())
-                .addAsLibraries(Deployments.getTestSupportArchives())
+                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndServletModuleArchive())
+                .addAsResource("META-INF/web-fragment.xml", "META-INF/web-fragment.xml")
                 .addAsWebInfResource(new StringAsset("<beans/>"), "beans.xml")
                 .setWebXML(new StringAsset(
                         Descriptors.create(WebAppDescriptor.class)

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/c015a6c2/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/producer/ServletObjectInjectionTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/producer/ServletObjectInjectionTest.java
b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/producer/ServletObjectInjectionTest.java
index 9ca7e9d..eb2ed67 100644
--- a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/producer/ServletObjectInjectionTest.java
+++ b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/producer/ServletObjectInjectionTest.java
@@ -24,7 +24,7 @@ import static org.junit.Assert.assertThat;
 import java.net.URL;
 
 import org.apache.deltaspike.test.category.WebProfileCategory;
-import org.apache.deltaspike.test.servlet.impl.Deployments;
+import org.apache.deltaspike.test.servlet.impl.util.ArchiveUtils;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.impl.client.DefaultHttpClient;
@@ -54,8 +54,8 @@ public class ServletObjectInjectionTest
     public static WebArchive getDeployment()
     {
         return ShrinkWrap.create(WebArchive.class, ServletObjectInjectionTest.class.getSimpleName()
+ ".war")
-                .addAsLibraries(Deployments.getDeltaSpikeCoreArchives())
-                .addAsLibraries(Deployments.getDeltaSpikeServletArchives())
+                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndServletModuleArchive())
+                .addAsResource("META-INF/web-fragment.xml", "META-INF/web-fragment.xml")
                 .addClass(ServletObjectInjectionBean.class)
                 .addClass(ServletObjectInjectionServlet.class)
                 .addAsWebInfResource(new StringAsset("<beans/>"), "beans.xml")

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/c015a6c2/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/resourceloader/WebResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/resourceloader/WebResourceProviderTest.java
b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/resourceloader/WebResourceProviderTest.java
index fca3853..f7d4698 100644
--- a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/resourceloader/WebResourceProviderTest.java
+++ b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/resourceloader/WebResourceProviderTest.java
@@ -29,7 +29,7 @@ import javax.inject.Inject;
 import org.apache.deltaspike.core.api.resourceloader.InjectableResource;
 import org.apache.deltaspike.servlet.api.resourceloader.WebResourceProvider;
 import org.apache.deltaspike.test.category.WebProfileCategory;
-import org.apache.deltaspike.test.servlet.impl.Deployments;
+import org.apache.deltaspike.test.servlet.impl.util.ArchiveUtils;
 import org.jboss.arquillian.container.test.api.Deployment;
 import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.shrinkwrap.api.ShrinkWrap;
@@ -49,9 +49,8 @@ public class WebResourceProviderTest
     {
         return ShrinkWrap.create(WebArchive.class, WebResourceProviderTest.class.getSimpleName()
+ ".war")
                 .addClass(WebResourceProvider.class)
-                .addAsLibraries(Deployments.getDeltaSpikeCoreArchives())
-                .addAsLibraries(Deployments.getDeltaSpikeServletArchives())
-                .addAsLibraries(Deployments.getTestSupportArchives())
+                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndServletModuleArchive())
+                .addAsResource("META-INF/web-fragment.xml", "META-INF/web-fragment.xml")
                 .addAsWebInfResource(new StringAsset("<beans/>"), "beans.xml")
                 .addAsWebResource(new StringAsset("foobar"), "foobar.txt")
                 .addAsWebResource(new StringAsset("foobar"), "foo/bar.txt")

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/c015a6c2/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/util/ArchiveUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/util/ArchiveUtils.java
b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/util/ArchiveUtils.java
new file mode 100644
index 0000000..fd1d8fa
--- /dev/null
+++ b/deltaspike/modules/servlet/impl/src/test/java/org/apache/deltaspike/test/servlet/impl/util/ArchiveUtils.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.apache.deltaspike.test.servlet.impl.util;
+
+import org.apache.deltaspike.test.category.WebProfileCategory;
+import org.apache.deltaspike.test.utils.ShrinkWrapArchiveUtil;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This class contains helpers for building frequently used archives
+ */
+public class ArchiveUtils
+{
+    public static JavaArchive[] getDeltaSpikeCoreAndServletModuleArchive()
+    {
+        JavaArchive extensionsJar = ShrinkWrap
+                .create(JavaArchive.class, "dsCoreTest.jar")
+                .addClass(ArchiveUtils.class)
+                .addPackages(true, "org.apache.http")
+                .addPackages(true, "org.jboss.shrinkwrap.api") //TODO needed by the setup
for tomee -> re-visit it
+                .addPackage(WebProfileCategory.class.getPackage());
+
+        JavaArchive[] coreArchives = ShrinkWrapArchiveUtil.getArchives(null,
+                "META-INF/beans.xml",
+                new String[]{"org.apache.deltaspike.core", "org.apache.deltaspike.test.category",
+                        "org.apache.deltaspike.servlet"}, null);
+
+        List<JavaArchive> archives = new ArrayList<JavaArchive>(Arrays.asList(coreArchives));
+        archives.add(extensionsJar);
+        return archives.toArray(new JavaArchive[archives.size()]);
+    }
+}


Mime
View raw message