You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltaspike.apache.org by ch...@apache.org on 2012/02/01 17:31:23 UTC

[3/4] git commit: Added a @WebProfileCategory tests for JndiUtils

Added a @WebProfileCategory tests for JndiUtils


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

Branch: refs/heads/master
Commit: 2314c5960734f2c670a8d5b50829d4ba4a005ae4
Parents: e9cfab5
Author: Christian Kaltepoth <ch...@kaltepoth.de>
Authored: Sun Jan 29 15:52:04 2012 +0100
Committer: Christian Kaltepoth <ch...@apache.org>
Committed: Wed Feb 1 17:02:15 2012 +0100

----------------------------------------------------------------------
 .../test/core/impl/util/JndiUtilsTest.java         |   63 +++++++++++++++
 1 files changed, 63 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-deltaspike/blob/2314c596/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
new file mode 100644
index 0000000..e0cf6bb
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/util/JndiUtilsTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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 static org.junit.Assert.assertNotNull;
+
+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.core.api.temptestutil.ShrinkWrapArchiveUtil;
+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.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()
+    {
+        return ShrinkWrap.create(WebArchive.class)
+                .addAsLibraries(ShrinkWrapArchiveUtil.getArchives(null,
+                        "META-INF/beans.xml",
+                        new String[] { "org.apache.deltaspike" },
+                        null))
+                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+
+    /**
+     * Tests {@link JndiUtils#lookup(String, Class)} by looking up the {@link BeanManager}
+     */
+    @Test
+    public void testLookup()
+    {
+        BeanManager beanManager = JndiUtils.lookup("java:comp/BeanManager", BeanManager.class);
+        assertNotNull("JNDI lookup failed", beanManager);
+    }
+
+}