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/25 12:23:19 UTC

git commit: DELTASPIKE-479 initial setup and added test

Updated Branches:
  refs/heads/master 26504284a -> 7b0650b95


DELTASPIKE-479 initial setup and added test


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

Branch: refs/heads/master
Commit: 7b0650b95b8fff36272553e186f0802ad0cfc636
Parents: 2650428
Author: gpetracek <gp...@apache.org>
Authored: Wed Dec 25 12:09:03 2013 +0100
Committer: gpetracek <gp...@apache.org>
Committed: Wed Dec 25 12:13:04 2013 +0100

----------------------------------------------------------------------
 .../custom/CustomSchedulerEarFileTest.java      | 42 +++++++++++++++
 .../scheduler/custom/CustomSchedulerTest.java   | 35 ++-----------
 .../custom/CustomSchedulerWarFileTest.java      | 55 ++++++++++++++++++++
 .../deltaspike/test/util/ArchiveUtils.java      |  4 +-
 deltaspike/parent/code/pom.xml                  | 10 ++--
 .../EnterpriseArchiveProfileCategory.java       | 27 ++++++++++
 6 files changed, 137 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/7b0650b9/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomSchedulerEarFileTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomSchedulerEarFileTest.java b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomSchedulerEarFileTest.java
new file mode 100644
index 0000000..f6f2a98
--- /dev/null
+++ b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomSchedulerEarFileTest.java
@@ -0,0 +1,42 @@
+/*
+ * 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.scheduler.custom;
+
+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 CustomSchedulerEarFileTest extends CustomSchedulerTest
+{
+    @Deployment
+    public static EnterpriseArchive deployEar()
+    {
+        String simpleName = CustomSchedulerEarFileTest.class.getSimpleName();
+        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);
+
+        return ShrinkWrap.create(EnterpriseArchive.class, archiveName + ".ear")
+                .addAsModule(CustomSchedulerWarFileTest.deploy());
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/7b0650b9/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomSchedulerTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomSchedulerTest.java b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomSchedulerTest.java
index 541388d..489c2cf 100644
--- a/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomSchedulerTest.java
+++ b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomSchedulerTest.java
@@ -19,44 +19,15 @@
 package org.apache.deltaspike.test.scheduler.custom;
 
 import junit.framework.Assert;
-import org.apache.deltaspike.core.spi.config.ConfigSource;
 import org.apache.deltaspike.scheduler.spi.Scheduler;
-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.asset.StringAsset;
-import org.jboss.shrinkwrap.api.spec.JavaArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
 import org.junit.Test;
-import org.junit.runner.RunWith;
 
+import javax.enterprise.inject.Typed;
 import javax.inject.Inject;
 
-@RunWith(Arquillian.class)
-public class CustomSchedulerTest
+@Typed()
+public abstract class CustomSchedulerTest
 {
-    @Deployment
-    public static WebArchive deploy()
-    {
-        String simpleName = CustomSchedulerTest.class.getSimpleName();
-        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);
-
-        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "customSchedulerTest.jar")
-                .addPackage(CustomSchedulerTest.class.getPackage().getName())
-                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
-                .addAsResource(new StringAsset(MockedScheduler.class.getName()),
-                        "META-INF/services/" + Scheduler.class.getName())
-                .addAsResource(new StringAsset(CustomConfigSource.class.getName()),
-                        "META-INF/services/" + ConfigSource.class.getName());
-
-        return ShrinkWrap.create(WebArchive.class, archiveName + ".war")
-                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndSchedulerArchive())
-                .addAsLibraries(testJar)
-                .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
-    }
-
     @Inject
     private Scheduler<CustomJob> scheduler;
 

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/7b0650b9/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomSchedulerWarFileTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomSchedulerWarFileTest.java b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomSchedulerWarFileTest.java
new file mode 100644
index 0000000..4519235
--- /dev/null
+++ b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/scheduler/custom/CustomSchedulerWarFileTest.java
@@ -0,0 +1,55 @@
+/*
+ * 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.scheduler.custom;
+
+import org.apache.deltaspike.core.spi.config.ConfigSource;
+import org.apache.deltaspike.scheduler.spi.Scheduler;
+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.asset.StringAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.runner.RunWith;
+
+@RunWith(Arquillian.class)
+public class CustomSchedulerWarFileTest extends CustomSchedulerTest
+{
+    @Deployment
+    public static WebArchive deploy()
+    {
+        String simpleName = CustomSchedulerWarFileTest.class.getSimpleName();
+        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);
+
+        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "customSchedulerTest.jar")
+                .addPackage(CustomSchedulerWarFileTest.class.getPackage().getName())
+                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml")
+                .addAsResource(new StringAsset(MockedScheduler.class.getName()),
+                        "META-INF/services/" + Scheduler.class.getName())
+                .addAsResource(new StringAsset(CustomConfigSource.class.getName()),
+                        "META-INF/services/" + ConfigSource.class.getName());
+
+        return ShrinkWrap.create(WebArchive.class, archiveName + ".war")
+                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndSchedulerArchive())
+                .addAsLibraries(testJar)
+                .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/7b0650b9/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
index 59b31be..b5bf070 100644
--- a/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
+++ b/deltaspike/modules/scheduler/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
@@ -35,7 +35,9 @@ public class ArchiveUtils
         return ShrinkWrapArchiveUtil.getArchives(
                 null,
                 "META-INF/beans.xml",
-                new String[]{"org.apache.deltaspike.core", "org.apache.deltaspike.scheduler"},
+                new String[]{"org.apache.deltaspike.core",
+                        "org.apache.deltaspike.test.category",
+                        "org.apache.deltaspike.scheduler"},
                 null);
     }
 }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/7b0650b9/deltaspike/parent/code/pom.xml
----------------------------------------------------------------------
diff --git a/deltaspike/parent/code/pom.xml b/deltaspike/parent/code/pom.xml
index a9ad46e..adca7e9 100644
--- a/deltaspike/parent/code/pom.xml
+++ b/deltaspike/parent/code/pom.xml
@@ -159,7 +159,8 @@
                             <!-- Ignore these groups because they don't work with embedded OWB -->
                             <excludedGroups>
                                 org.apache.deltaspike.test.category.WebProfileCategory,
-                                org.apache.deltaspike.test.category.FullProfileCategory
+                                org.apache.deltaspike.test.category.FullProfileCategory,
+                                org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory
                             </excludedGroups>
                         </configuration>
                     </plugin>
@@ -228,7 +229,8 @@
                             <!-- Ignore these groups because they don't work with embedded Weld -->
                             <excludedGroups>
                                 org.apache.deltaspike.test.category.WebProfileCategory,
-                                org.apache.deltaspike.test.category.FullProfileCategory
+                                org.apache.deltaspike.test.category.FullProfileCategory,
+                                org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory
                             </excludedGroups>
                         </configuration>
                     </plugin>
@@ -388,8 +390,10 @@
                             all tests in theory, we have to exclude some tests because there are e.g. packaging issues or
                             there are currently issues with arquillian. if a test isn't restricted to an environment,
                             no category is used for the test-class. -->
+                            <!-- TODO remove EnterpriseArchiveProfileCategory asap-->
                             <excludedGroups>
-                                org.apache.deltaspike.test.category.SeCategory
+                                org.apache.deltaspike.test.category.SeCategory,
+                                org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory
                             </excludedGroups>
                         </configuration>
                     </plugin>

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/7b0650b9/deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/category/EnterpriseArchiveProfileCategory.java
----------------------------------------------------------------------
diff --git a/deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/category/EnterpriseArchiveProfileCategory.java b/deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/category/EnterpriseArchiveProfileCategory.java
new file mode 100644
index 0000000..c8a5f2d
--- /dev/null
+++ b/deltaspike/test-utils/src/main/java/org/apache/deltaspike/test/category/EnterpriseArchiveProfileCategory.java
@@ -0,0 +1,27 @@
+/*
+ * 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.category;
+
+/**
+ * Category marker interface. Tests which are packaged as ear-file.
+ */
+public interface EnterpriseArchiveProfileCategory
+{
+}