You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by gp...@apache.org on 2013/12/26 00:45:20 UTC

[3/3] git commit: DELTASPIKE-479 added test

DELTASPIKE-479 added test


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

Branch: refs/heads/master
Commit: 02880d6fa5d199b73f1d2256f7dd81da2cf1780b
Parents: c956c99
Author: gpetracek <gp...@apache.org>
Authored: Thu Dec 26 00:43:10 2013 +0100
Committer: gpetracek <gp...@apache.org>
Committed: Thu Dec 26 00:43:10 2013 +0100

----------------------------------------------------------------------
 .../secured/SecuredAnnotationEarFileTest.java   | 47 ++++++++++++++++++++
 .../secured/SecuredAnnotationTest.java          | 19 +-------
 .../secured/SecuredAnnotationWarFileTest.java   | 46 +++++++++++++++++++
 .../deltaspike/test/util/ArchiveUtils.java      |  4 +-
 4 files changed, 97 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/02880d6f/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredAnnotationEarFileTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredAnnotationEarFileTest.java b/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredAnnotationEarFileTest.java
new file mode 100644
index 0000000..c97f1e7
--- /dev/null
+++ b/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredAnnotationEarFileTest.java
@@ -0,0 +1,47 @@
+/*
+ * 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.security.impl.authorization.secured;
+
+import org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory;
+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.spec.EnterpriseArchive;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+
+/**
+ * Test for {@link org.apache.deltaspike.security.api.authorization.Secured}
+ */
+@RunWith(Arquillian.class)
+@Category(EnterpriseArchiveProfileCategory.class)
+public class SecuredAnnotationEarFileTest extends SecuredAnnotationTest
+{
+    @Deployment
+    public static EnterpriseArchive deployEar()
+    {
+        //workaround for tomee - the ear-file needs to have the same name as the war-file
+        String simpleName = SecuredAnnotationWarFileTest.class.getSimpleName();
+        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);
+
+        return ShrinkWrap.create(EnterpriseArchive.class, archiveName + ".ear")
+                .addAsModule(SecuredAnnotationWarFileTest.deploy());
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/02880d6f/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredAnnotationTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredAnnotationTest.java b/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredAnnotationTest.java
index 64397ec..dd548c4 100644
--- a/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredAnnotationTest.java
+++ b/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredAnnotationTest.java
@@ -20,32 +20,15 @@ package org.apache.deltaspike.test.security.impl.authorization.secured;
 
 import org.apache.deltaspike.core.api.provider.BeanProvider;
 import org.apache.deltaspike.security.api.authorization.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.spec.WebArchive;
 import org.junit.Assert;
 import org.junit.Test;
-import org.junit.runner.RunWith;
 
 
 /**
  * Test for {@link org.apache.deltaspike.security.api.authorization.Secured}
  */
-@RunWith(Arquillian.class)
-public class SecuredAnnotationTest
+public abstract class SecuredAnnotationTest
 {
-    @Deployment
-    public static WebArchive deploy()
-    {
-        return ShrinkWrap.create(WebArchive.class, "secured-annotation-test.war")
-
-                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndSecurityArchive())
-                .addPackage("org.apache.deltaspike.test.security.impl.authorization.secured")
-                .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
-    }
-
     @Test
     public void simpleInterceptorTest()
     {

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/02880d6f/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredAnnotationWarFileTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredAnnotationWarFileTest.java b/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredAnnotationWarFileTest.java
new file mode 100644
index 0000000..7e09853
--- /dev/null
+++ b/deltaspike/modules/security/impl/src/test/java/org/apache/deltaspike/test/security/impl/authorization/secured/SecuredAnnotationWarFileTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.security.impl.authorization.secured;
+
+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.spec.WebArchive;
+import org.junit.runner.RunWith;
+
+
+/**
+ * Test for {@link org.apache.deltaspike.security.api.authorization.Secured}
+ */
+@RunWith(Arquillian.class)
+public class SecuredAnnotationWarFileTest extends SecuredAnnotationTest
+{
+    @Deployment
+    public static WebArchive deploy()
+    {
+        String simpleName = SecuredAnnotationWarFileTest.class.getSimpleName();
+        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);
+
+        return ShrinkWrap.create(WebArchive.class, archiveName + ".war")
+                .addPackage(SecuredAnnotationWarFileTest.class.getPackage())
+                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndSecurityArchive())
+                .addAsWebInfResource(ArchiveUtils.getBeansXml(), "beans.xml");
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/02880d6f/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 e76391a..78c48fb 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
@@ -42,7 +42,9 @@ public class ArchiveUtils
 
         return ShrinkWrapArchiveUtil.getArchives(null,
                 "META-INF/beans.xml",
-                new String[]{"org.apache.deltaspike.core", "org.apache.deltaspike.security"}, excludedFiles);
+                new String[]{"org.apache.deltaspike.core",
+                        "org.apache.deltaspike.test.category",
+                        "org.apache.deltaspike.security"}, excludedFiles);
     }
 
     public static Asset getBeansXml()