deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject [1/2] git commit: DELTASPIKE-479 added test
Date Thu, 26 Dec 2013 00:24:10 GMT
Updated Branches:
  refs/heads/master 02880d6fa -> 4adb68be2


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/b2d2db68
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/b2d2db68
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/b2d2db68

Branch: refs/heads/master
Commit: b2d2db6840b8b4d1b6a6b8149b951013e8aa5b04
Parents: 02880d6
Author: gpetracek <gpetracek@apache.org>
Authored: Thu Dec 26 01:06:28 2013 +0100
Committer: gpetracek <gpetracek@apache.org>
Committed: Thu Dec 26 01:06:28 2013 +0100

----------------------------------------------------------------------
 .../local/BdaAlternativeEarFileTest.java        | 43 +++++++++++++++
 .../alternative/local/BdaAlternativeTest.java   | 29 +---------
 .../local/BdaAlternativeWarFileTest.java        | 57 ++++++++++++++++++++
 3 files changed, 101 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/b2d2db68/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/BdaAlternativeEarFileTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/BdaAlternativeEarFileTest.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/BdaAlternativeEarFileTest.java
new file mode 100644
index 0000000..a25ff0b
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/BdaAlternativeEarFileTest.java
@@ -0,0 +1,43 @@
+/*
+* 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.core.api.alternative.local;
+
+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;
+
+@RunWith(Arquillian.class)
+@Category(EnterpriseArchiveProfileCategory.class)
+public class BdaAlternativeEarFileTest extends BdaAlternativeTest
+{
+    @Deployment
+    public static EnterpriseArchive deployEar()
+    {
+        //workaround for tomee - the ear-file needs to have the same name as the war-file
+        String simpleName = BdaAlternativeWarFileTest.class.getSimpleName();
+        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);
+
+        return ShrinkWrap.create(EnterpriseArchive.class, archiveName + ".ear")
+                .addAsModule(BdaAlternativeWarFileTest.deploy());
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/b2d2db68/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/BdaAlternativeTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/BdaAlternativeTest.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/BdaAlternativeTest.java
index 3ec1200..9b7b5d7 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/BdaAlternativeTest.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/BdaAlternativeTest.java
@@ -18,19 +18,9 @@
 */
 package org.apache.deltaspike.test.core.api.alternative.local;
 
-
 import org.apache.deltaspike.core.api.provider.BeanProvider;
-import org.apache.deltaspike.test.category.SeCategory;
-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.EmptyAsset;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
 import org.junit.Assert;
 import org.junit.Test;
-import org.junit.runner.RunWith;
 
 import javax.inject.Inject;
 import java.util.List;
@@ -41,28 +31,11 @@ import java.util.List;
  *
  * Tests which checks the behaviour with deactivated global alternates.
  */
-@RunWith(Arquillian.class)
-public class BdaAlternativeTest
+public abstract class BdaAlternativeTest
 {
     @Inject
     private BaseInterface2 bean;
 
-    /**
-     * X TODO creating a WebArchive is only a workaround because JavaArchive cannot contain
other archives.
-     */
-    @Deployment
-    public static WebArchive deploy()
-    {
-        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "securedAnnotationTest.jar")
-                .addPackage(BdaAlternativeTest.class.getPackage())
-                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
-
-        return ShrinkWrap.create(WebArchive.class, "bdaAlternative.war")
-                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive(new String[]{"META-INF.config"}))
-                .addAsLibraries(testJar)
-                .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
-    }
-
     /*
      * The default implementation should be found
      */

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/b2d2db68/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/BdaAlternativeWarFileTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/BdaAlternativeWarFileTest.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/BdaAlternativeWarFileTest.java
new file mode 100644
index 0000000..6fedb1f
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/alternative/local/BdaAlternativeWarFileTest.java
@@ -0,0 +1,57 @@
+/*
+* 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.core.api.alternative.local;
+
+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.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.runner.RunWith;
+
+/**
+ * Keep in sync with {@link org.apache.deltaspike.test.core.api.alternative.global.GlobalAlternativeTest}
-
+ * but without configuring the alternatives and check for the default implementations.
+ *
+ * Tests which checks the behaviour with deactivated global alternates.
+ */
+@RunWith(Arquillian.class)
+public class BdaAlternativeWarFileTest extends BdaAlternativeTest
+{
+    /**
+     * X TODO creating a WebArchive is only a workaround because JavaArchive cannot contain
other archives.
+     */
+    @Deployment
+    public static WebArchive deploy()
+    {
+        String simpleName = BdaAlternativeWarFileTest.class.getSimpleName();
+        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);
+
+        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "securedAnnotationTest.jar")
+                .addPackage(BdaAlternativeWarFileTest.class.getPackage())
+                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+
+        return ShrinkWrap.create(WebArchive.class, archiveName + ".war")
+                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive(new String[]{"META-INF.config"}))
+                .addAsLibraries(testJar)
+                .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+}


Mime
View raw message