tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r1356029 - in /openejb/trunk/openejb/arquillian/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/contextxml: ./ datasource/ datasource/DataSourceTest.java datasource/context.xml
Date Sun, 01 Jul 2012 21:14:28 GMT
Author: dblevins
Date: Sun Jul  1 21:14:27 2012
New Revision: 1356029

URL: http://svn.apache.org/viewvc?rev=1356029&view=rev
Log:
Start of a testcase to test a potential regession on context.xml TOMEE-263

Added:
    openejb/trunk/openejb/arquillian/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/contextxml/
    openejb/trunk/openejb/arquillian/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/contextxml/datasource/
    openejb/trunk/openejb/arquillian/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/contextxml/datasource/DataSourceTest.java
    openejb/trunk/openejb/arquillian/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/contextxml/datasource/context.xml

Added: openejb/trunk/openejb/arquillian/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/contextxml/datasource/DataSourceTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/contextxml/datasource/DataSourceTest.java?rev=1356029&view=auto
==============================================================================
--- openejb/trunk/openejb/arquillian/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/contextxml/datasource/DataSourceTest.java
(added)
+++ openejb/trunk/openejb/arquillian/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/contextxml/datasource/DataSourceTest.java
Sun Jul  1 21:14:27 2012
@@ -0,0 +1,74 @@
+/*
+ * 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.openejb.arquillian.tests.contextxml.datasource;
+
+import org.apache.ziplock.IO;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.ClassLoaderAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import javax.annotation.Resource;
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.sql.DataSource;
+import java.io.IOException;
+import java.net.URL;
+
+/**
+ * @version $Rev$ $Date$
+ */
+@RunWith(Arquillian.class)
+public class DataSourceTest {
+
+    @ArquillianResource
+    private URL url;
+
+    @Deployment(testable = false)
+    public static WebArchive createDeployment() {
+        WebArchive archive = ShrinkWrap.create(WebArchive.class, DataSourceTest.class.getSimpleName()
+ ".war")
+                .addClass(PojoServlet.class)
+                .addAsWebInfResource(new ClassLoaderAsset("org/apache/openejb/arquillian/tests/contextxml/datasource/context.xml"),
"context.xml");
+
+        return archive;
+    }
+
+    @Test
+    public void lookupEnvEntryInjectionShouldSucceed() throws Exception {
+        final String output = IO.readString(new URL(url.toExternalForm() + "test"));
+    }
+
+    @WebServlet("/test")
+    public static class PojoServlet extends HttpServlet {
+
+        @Resource
+        private DataSource dataSource;
+
+        @Override
+        protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
IOException {
+
+            if (dataSource == null) throw new ServletException();
+        }
+    }
+}

Added: openejb/trunk/openejb/arquillian/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/contextxml/datasource/context.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/arquillian/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/contextxml/datasource/context.xml?rev=1356029&view=auto
==============================================================================
--- openejb/trunk/openejb/arquillian/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/contextxml/datasource/context.xml
(added)
+++ openejb/trunk/openejb/arquillian/arquillian-tomee-tests/src/test/java/org/apache/openejb/arquillian/tests/contextxml/datasource/context.xml
Sun Jul  1 21:14:27 2012
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Context>
+
+  <Resource name="jdbc/myDB" auth="Container"
+            type="javax.sql.DataSource" username="sa" password=""
+            driverClassName="org.hsqldb.jdbcDriver"
+            url="jdbc:hsqldb:file:data/hsqldb/hsqldb"
+            maxActive="8"
+      />
+</Context>
\ No newline at end of file



Mime
View raw message