incubator-deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject git commit: DELTASPIKE-125 cleanup
Date Fri, 23 Mar 2012 01:29:38 GMT
Updated Branches:
  refs/heads/master f102e93b6 -> f9506fc12


DELTASPIKE-125 cleanup


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

Branch: refs/heads/master
Commit: f9506fc1289a642e0f66efd440e124562d65df79
Parents: f102e93
Author: gpetracek <gpetracek@apache.org>
Authored: Fri Mar 23 02:20:09 2012 +0100
Committer: gpetracek <gpetracek@apache.org>
Committed: Fri Mar 23 02:20:09 2012 +0100

----------------------------------------------------------------------
 .../impl/secured/SecuredAnnotationTest.java        |   27 +----------
 .../apache/deltaspike/test/util/ArchiveUtils.java  |   36 +++++++++++++-
 2 files changed, 35 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/f9506fc1/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/secured/SecuredAnnotationTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/secured/SecuredAnnotationTest.java
b/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/secured/SecuredAnnotationTest.java
index c58d25b..596c16a 100644
--- a/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/secured/SecuredAnnotationTest.java
+++ b/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/secured/SecuredAnnotationTest.java
@@ -21,15 +21,12 @@ package org.apache.deltaspike.test.security.impl.secured;
 import org.apache.deltaspike.core.api.provider.BeanManagerProvider;
 import org.apache.deltaspike.core.api.provider.BeanProvider;
 import org.apache.deltaspike.core.impl.exclude.ExcludeExtension;
-import org.apache.deltaspike.core.util.ClassUtils;
 import org.apache.deltaspike.security.api.AccessDeniedException;
 import org.apache.deltaspike.test.util.ArchiveUtils;
 import org.jboss.arquillian.container.test.api.Deployment;
 import org.jboss.arquillian.junit.Arquillian;
 import org.jboss.shrinkwrap.api.ShrinkWrap;
-import org.jboss.shrinkwrap.api.asset.Asset;
 import org.jboss.shrinkwrap.api.asset.EmptyAsset;
-import org.jboss.shrinkwrap.api.asset.StringAsset;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
 import org.jboss.shrinkwrap.api.spec.WebArchive;
 import org.junit.Assert;
@@ -56,35 +53,15 @@ public class SecuredAnnotationTest
             }
         }.setTestMode();
 
-        //X TODO remove this workaround
-        boolean isOwbAvailable = ClassUtils.tryToLoadClassForName("org.apache.webbeans.spi.ContainerLifecycle")
!= null;
-
-        String[] excludedFiles;
-
-        Asset beansXml = new StringAsset(
-            "<beans>" +
-                "<interceptors><class>org.apache.deltaspike.security.impl.SecurityInterceptor</class></interceptors>"
+
-            "</beans>"
-        );
-
-        if (isOwbAvailable)
-        {
-            excludedFiles = new String[]{"META-INF.apache-deltaspike.properties"};
-        }
-        else
-        {
-            excludedFiles = new String[]{"META-INF.apache-deltaspike.properties", "META-INF.beans.xml"};
-        }
-
         JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "securedAnnotationTest.jar")
                 .addPackage("org.apache.deltaspike.test.security.impl.secured")
                 .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
 
         return ShrinkWrap.create(WebArchive.class)
-                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndSecurityArchive(excludedFiles))
+                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndSecurityArchive())
                 .addAsLibraries(testJar)
                 .addAsServiceProvider(Extension.class, ExcludeExtension.class)
-                .addAsWebInfResource(beansXml, "beans.xml");
+                .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/f9506fc1/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
b/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
index 17aab88..a3a6cfb 100644
--- a/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
+++ b/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
@@ -18,6 +18,9 @@
  */
 package org.apache.deltaspike.test.util;
 
+import org.apache.deltaspike.core.util.ClassUtils;
+import org.jboss.shrinkwrap.api.asset.Asset;
+import org.jboss.shrinkwrap.api.asset.StringAsset;
 import org.jboss.shrinkwrap.api.spec.JavaArchive;
 
 /**
@@ -25,10 +28,37 @@ import org.jboss.shrinkwrap.api.spec.JavaArchive;
  */
 public class ArchiveUtils
 {
-    public static JavaArchive[] getDeltaSpikeCoreAndSecurityArchive(String[] excludedPackagesOrFiles)
+    public static JavaArchive[] getDeltaSpikeCoreAndSecurityArchive()
     {
+        //X TODO remove this workaround
+        boolean isOwbAvailable = ClassUtils.tryToLoadClassForName("org.apache.webbeans.spi.ContainerLifecycle")
!= null;
+
+        String[] excludedFiles;
+
+        if (isOwbAvailable)
+        {
+            excludedFiles = new String[]{"META-INF.apache-deltaspike.properties"};
+        }
+        else
+        {
+            excludedFiles = new String[]{"META-INF.apache-deltaspike.properties", "META-INF.beans.xml"};
+        }
+
+
         return ShrinkWrapArchiveUtil.getArchives(null,
                 "META-INF/beans.xml",
-                new String[]{"org.apache.deltaspike.core", "org.apache.deltaspike.security"},
excludedPackagesOrFiles);
+                new String[]{"org.apache.deltaspike.core", "org.apache.deltaspike.security"},
excludedFiles);
+    }
+
+    public static Asset getBeansXml()
+    {
+        @SuppressWarnings("UnnecessaryLocalVariable")
+        Asset beansXml = new StringAsset(
+            "<beans>" +
+                "<interceptors><class>org.apache.deltaspike.security.impl.SecurityInterceptor</class></interceptors>"
+
+            "</beans>"
+        );
+
+        return beansXml;
     }
-}
+}
\ No newline at end of file


Mime
View raw message