deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject [1/3] git commit: DELTASPIKE-479 added test
Date Wed, 25 Dec 2013 23:45:18 GMT
Updated Branches:
  refs/heads/master 9d628ce40 -> 02880d6fa


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

Branch: refs/heads/master
Commit: f93b669634e7d434f2ffa7dbd02024cd4efd2ca2
Parents: 9d628ce
Author: gpetracek <gpetracek@apache.org>
Authored: Wed Dec 25 23:56:48 2013 +0100
Committer: gpetracek <gpetracek@apache.org>
Committed: Wed Dec 25 23:56:48 2013 +0100

----------------------------------------------------------------------
 .../core/impl/util/JndiUtilsEarFileTest.java    | 43 +++++++++++++++++
 .../test/core/impl/util/JndiUtilsTest.java      | 35 ++------------
 .../core/impl/util/JndiUtilsWarFileTest.java    | 51 ++++++++++++++++++++
 3 files changed, 99 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


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

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/f93b6696/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/util/JndiUtilsTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/util/JndiUtilsTest.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/util/JndiUtilsTest.java
index 9dba4e1..61bd559 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/util/JndiUtilsTest.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/util/JndiUtilsTest.java
@@ -18,41 +18,16 @@
  */
 package org.apache.deltaspike.test.core.impl.util;
 
-import static org.junit.Assert.assertNotNull;
-
-import java.util.Map;
-
-import javax.enterprise.inject.spi.BeanManager;
-
 import org.apache.deltaspike.core.impl.util.JndiUtils;
-import org.apache.deltaspike.test.category.WebProfileCategory;
-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.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
 
-@RunWith(Arquillian.class)
-@Category(WebProfileCategory.class)
-public class JndiUtilsTest
-{
-    @Deployment
-    public static WebArchive deploy()
-    {
-        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "jndiTest.jar")
-                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+import javax.enterprise.inject.spi.BeanManager;
+import java.util.Map;
 
-        return ShrinkWrap.create(WebArchive.class, "jndiUtils.war")
-                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())
-                .addAsLibraries(testJar)
-                .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
-    }
+import static org.junit.Assert.assertNotNull;
 
+public abstract class JndiUtilsTest
+{
     /**
      * Tests {@link JndiUtils#lookup(String, Class)} by looking up the {@link BeanManager}
      */

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/f93b6696/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/util/JndiUtilsWarFileTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/util/JndiUtilsWarFileTest.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/util/JndiUtilsWarFileTest.java
new file mode 100644
index 0000000..0dc03c3
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/util/JndiUtilsWarFileTest.java
@@ -0,0 +1,51 @@
+/*
+ * 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.util;
+
+import org.apache.deltaspike.test.category.WebProfileCategory;
+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.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+@RunWith(Arquillian.class)
+@Category(WebProfileCategory.class)
+public class JndiUtilsWarFileTest extends JndiUtilsTest
+{
+    @Deployment
+    public static WebArchive deploy()
+    {
+        String simpleName = JndiUtilsWarFileTest.class.getSimpleName();
+        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);
+
+        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, "jndiTest.jar")
+                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+
+        return ShrinkWrap.create(WebArchive.class, archiveName + ".war")
+                .addPackage(JndiUtilsWarFileTest.class.getPackage())
+                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())
+                .addAsLibraries(testJar)
+                .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+}


Mime
View raw message