deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject [2/2] git commit: DELTASPIKE-479 added test
Date Thu, 26 Dec 2013 00:24:11 GMT
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/4adb68be
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/4adb68be
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/4adb68be

Branch: refs/heads/master
Commit: 4adb68be2ce5789a05dccbddad8da03c64d2b1f4
Parents: b2d2db6
Author: gpetracek <gpetracek@apache.org>
Authored: Thu Dec 26 01:16:40 2013 +0100
Committer: gpetracek <gpetracek@apache.org>
Committed: Thu Dec 26 01:16:40 2013 +0100

----------------------------------------------------------------------
 .../BeanManagerProviderEarFileTest.java         |  3 -
 .../ClassDeactivationEarFileTest.java           | 43 +++++++++++
 .../impl/activation/ClassDeactivationTest.java  | 47 ++++++++++++
 .../ClassDeactivationWarFileTest.java           | 59 +++++++++++++++
 .../impl/activation/TestClassDeactivation.java  | 80 --------------------
 5 files changed, 149 insertions(+), 83 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/4adb68be/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanManagerProviderEarFileTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanManagerProviderEarFileTest.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanManagerProviderEarFileTest.java
index 69f7be1..d96c9a3 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanManagerProviderEarFileTest.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/provider/BeanManagerProviderEarFileTest.java
@@ -19,13 +19,10 @@
 package org.apache.deltaspike.test.core.api.provider;
 
 import org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory;
-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.EnterpriseArchive;
-import org.jboss.shrinkwrap.api.spec.WebArchive;
 import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
 

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/4adb68be/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/ClassDeactivationEarFileTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/ClassDeactivationEarFileTest.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/ClassDeactivationEarFileTest.java
new file mode 100644
index 0000000..3d17f93
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/ClassDeactivationEarFileTest.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.impl.activation;
+
+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 ClassDeactivationEarFileTest extends ClassDeactivationTest
+{
+    @Deployment
+    public static EnterpriseArchive deployEar()
+    {
+        //workaround for tomee - the ear-file needs to have the same name as the war-file
+        String simpleName = ClassDeactivationWarFileTest.class.getSimpleName();
+        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);
+
+        return ShrinkWrap.create(EnterpriseArchive.class, archiveName + ".ear")
+                .addAsModule(ClassDeactivationWarFileTest.deploy());
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/4adb68be/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/ClassDeactivationTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/ClassDeactivationTest.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/ClassDeactivationTest.java
new file mode 100644
index 0000000..9fd0650
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/ClassDeactivationTest.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.core.impl.activation;
+
+import org.apache.deltaspike.core.util.ClassDeactivationUtils;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Test for {@link org.apache.deltaspike.core.spi.activation.ClassDeactivator}
+ */
+public abstract class ClassDeactivationTest
+{
+    /**
+     * Tests if a class of the added package is active
+     */
+    @Test
+    public void testActivatedClass()
+    {
+        Assert.assertTrue(ClassDeactivationUtils.isActivated(ActivatedClass.class));
+    }
+
+    /**
+     * Tests if the class deactivated by {@link TestClassDeactivator} is recognized as such
+     */
+    @Test
+    public void testDeactivatedClass()
+    {
+        Assert.assertFalse(ClassDeactivationUtils.isActivated(DeactivatedClass.class));
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/4adb68be/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/ClassDeactivationWarFileTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/ClassDeactivationWarFileTest.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/ClassDeactivationWarFileTest.java
new file mode 100644
index 0000000..f2b32cc
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/ClassDeactivationWarFileTest.java
@@ -0,0 +1,59 @@
+/*
+ * 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.impl.activation;
+
+import org.apache.deltaspike.test.category.DeltaSpikeTest;
+import org.apache.deltaspike.test.util.ArchiveUtils;
+import org.apache.deltaspike.test.util.FileUtils;
+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;
+
+import java.net.URL;
+
+@RunWith(Arquillian.class)
+public class ClassDeactivationWarFileTest extends ClassDeactivationTest
+{
+    /**
+     *X TODO creating a WebArchive is only a workaround because JavaArchive cannot contain
other archives.
+     */
+    @Deployment
+    public static WebArchive deploy()
+    {
+        String simpleName = ClassDeactivationWarFileTest.class.getSimpleName();
+        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);
+
+        URL fileUrl = ClassDeactivationWarFileTest.class.getClassLoader()
+                .getResource(DeltaSpikeTest.DELTASPIKE_PROPERTIES);
+
+        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "testClassDeactivationTest.jar")
+                .addPackage(ClassDeactivationWarFileTest.class.getPackage())
+                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+
+        return ShrinkWrap.create(WebArchive.class, archiveName + ".war")
+                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())
+                .addAsLibraries(testJar)
+                .addAsResource(FileUtils.getFileForURL(fileUrl.toString()), DeltaSpikeTest.DELTASPIKE_PROPERTIES)
+                .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/4adb68be/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/TestClassDeactivation.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/TestClassDeactivation.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/TestClassDeactivation.java
deleted file mode 100644
index bf3d279..0000000
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/activation/TestClassDeactivation.java
+++ /dev/null
@@ -1,80 +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.core.impl.activation;
-
-import org.apache.deltaspike.core.util.ClassDeactivationUtils;
-import org.apache.deltaspike.test.category.DeltaSpikeTest;
-import org.apache.deltaspike.test.util.ArchiveUtils;
-import org.apache.deltaspike.test.util.FileUtils;
-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 java.net.URL;
-
-/**
- * Test for {@link org.apache.deltaspike.core.spi.activation.ClassDeactivator}
- */
-@RunWith(Arquillian.class)
-public class TestClassDeactivation
-{
-    /**
-     *X TODO creating a WebArchive is only a workaround because JavaArchive cannot contain
other archives.
-     */
-    @Deployment
-    public static WebArchive deploy()
-    {
-        URL fileUrl = TestClassDeactivation.class.getClassLoader()
-                .getResource(DeltaSpikeTest.DELTASPIKE_PROPERTIES);
-
-        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "testClassDeactivationTest.jar")
-                .addPackage(TestClassDeactivation.class.getPackage())
-                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
-
-        return ShrinkWrap.create(WebArchive.class, "classDeactivation.war")
-                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())
-                .addAsLibraries(testJar)
-                .addAsResource(FileUtils.getFileForURL(fileUrl.toString()), DeltaSpikeTest.DELTASPIKE_PROPERTIES)
-                .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
-    }
-
-    /**
-     * Tests if a class of the added package is active
-     */
-    @Test
-    public void testActivatedClass()
-    {
-        Assert.assertTrue(ClassDeactivationUtils.isActivated(ActivatedClass.class));
-    }
-
-    /**
-     * Tests if the class deactivated by {@link TestClassDeactivator} is recognized as such
-     */
-    @Test
-    public void testDeactivatedClass()
-    {
-        Assert.assertFalse(ClassDeactivationUtils.isActivated(DeactivatedClass.class));
-    }
-}


Mime
View raw message