[jboss-cvs] JBossAS SVN: r58438 - in trunk/testsuite: imports/sections src/main/org/jboss/test/web/servlets src/main/org/jboss/test/web/test src/resources/web/simple-xmlonly
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Nov 16 01:13:10 EST 2006
Author: scott.stark at jboss.org
Date: 2006-11-16 01:13:04 -0500 (Thu, 16 Nov 2006)
New Revision: 58438
Added:
trunk/testsuite/src/main/org/jboss/test/web/servlets/ENCTester.java
trunk/testsuite/src/main/org/jboss/test/web/servlets/StandaloneENCAnnotationsServlet.java
trunk/testsuite/src/main/org/jboss/test/web/test/EncAnnotationsUnitTestCase.java
trunk/testsuite/src/resources/web/simple-xmlonly/annotated-web.xml
Modified:
trunk/testsuite/imports/sections/web.xml
trunk/testsuite/src/main/org/jboss/test/web/servlets/StandaloneENCServlet.java
trunk/testsuite/src/resources/web/simple-xmlonly/web.xml
Log:
Add an enc annotation config test
Modified: trunk/testsuite/imports/sections/web.xml
===================================================================
--- trunk/testsuite/imports/sections/web.xml 2006-11-16 06:11:41 UTC (rev 58437)
+++ trunk/testsuite/imports/sections/web.xml 2006-11-16 06:13:04 UTC (rev 58438)
@@ -572,17 +572,26 @@
includes="jboss-service.xml"/>
</zip>
- <!-- Simple war for testing web app enc setup -->
+ <!-- Simple war for testing web app enc setup using descriptors -->
<war destfile="${build.lib}/simple-xmlonly.war"
webxml="${build.resources}/web/simple-xmlonly/web.xml">
<webinf dir="${build.resources}/web/simple-xmlonly">
<include name="jboss-web.xml"/>
</webinf>
<classes dir="${build.classes}">
+ <include name="org/jboss/test/web/servlets/ENCTester.class"/>
<include name="org/jboss/test/web/servlets/StandaloneENCServlet.class"/>
</classes>
</war>
- <jar destfile="${build.lib}/simple-xmlonly.beans">
+ <!-- Simple war for testing web app enc setup using annotations -->
+ <war destfile="${build.lib}/simple-annonly.war"
+ webxml="${build.resources}/web/simple-xmlonly/annotated-web.xml">
+ <classes dir="${build.classes}">
+ <include name="org/jboss/test/web/servlets/StandaloneENCAnnotationsServlet.class"/>
+ <include name="org/jboss/test/web/servlets/ENCTester.class"/>
+ </classes>
+ </war>
+ <jar destfile="${build.lib}/simple-mock.beans">
<zipfileset dir="${build.resources}/web/simple-xmlonly"
fullpath="META-INF/jboss-beans.xml">
<include name="encbinding-beans.xml"/>
Added: trunk/testsuite/src/main/org/jboss/test/web/servlets/ENCTester.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/web/servlets/ENCTester.java 2006-11-16 06:11:41 UTC (rev 58437)
+++ trunk/testsuite/src/main/org/jboss/test/web/servlets/ENCTester.java 2006-11-16 06:13:04 UTC (rev 58438)
@@ -0,0 +1,196 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.web.servlets;
+
+import java.net.URL;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import javax.jms.JMSException;
+import javax.jms.Queue;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.Topic;
+import javax.mail.Session;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.servlet.ServletException;
+import javax.sql.DataSource;
+
+import org.jboss.logging.Logger;
+import org.jboss.test.web.mock.EntityHome;
+import org.jboss.test.web.mock.StatelessSessionHome;
+import org.jboss.test.web.mock.StatelessSessionLocalHome;
+
+/**
+ * A common test bean used by the enc servlets to validate their enc configuration.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+public class ENCTester
+{
+ private Logger log;
+ ENCTester(Logger log)
+ {
+ this.log = log;
+ }
+
+ void testENC() throws ServletException
+ {
+ try
+ {
+ // Obtain the environment naming context.
+ Context initCtx = new InitialContext();
+ Hashtable env = initCtx.getEnvironment();
+ Iterator keys = env.keySet().iterator();
+ log.info("InitialContext.env:");
+ while( keys.hasNext() )
+ {
+ Object key = keys.next();
+ log.info("Key: "+key+", value: "+env.get(key));
+ }
+ Context myEnv = (Context) initCtx.lookup("java:comp/env");
+ testEjbRefs(initCtx, myEnv);
+ testJdbcDataSource(initCtx, myEnv);
+ testMail(initCtx, myEnv);
+ testJMS(initCtx, myEnv);
+ testURL(initCtx, myEnv);
+ testEnvEntries(initCtx, myEnv);
+ testMessageDestinationRefs(initCtx, myEnv);
+ }
+ catch (NamingException e)
+ {
+ log.debug("Lookup failed", e);
+ throw new ServletException("Lookup failed, ENC tests failed", e);
+ }
+ catch (JMSException e)
+ {
+ log.debug("JMS access failed", e);
+ throw new ServletException("JMS access failed, ENC tests failed", e);
+ }
+ catch (RuntimeException e)
+ {
+ log.debug("Runtime error", e);
+ throw new ServletException("Runtime error, ENC tests failed", e);
+ }
+ }
+
+ private void testEnvEntries(Context initCtx, Context myEnv) throws NamingException
+ {
+ // Basic env values
+ Integer i = (Integer) myEnv.lookup("Ints/i0");
+ log.debug("Ints/i0 = " + i);
+ i = (Integer) initCtx.lookup("java:comp/env/Ints/i1");
+ log.debug("Ints/i1 = " + i);
+ Float f = (Float) myEnv.lookup("Floats/f0");
+ log.debug("Floats/f0 = " + f);
+ f = (Float) initCtx.lookup("java:comp/env/Floats/f1");
+ log.debug("Floats/f1 = " + f);
+ String s = (String) myEnv.lookup("Strings/s0");
+ log.debug("Strings/s0 = " + s);
+ s = (String) initCtx.lookup("java:comp/env/Strings/s1");
+ log.debug("Strings/s1 = " + s);
+ s = (String) initCtx.lookup("java:comp/env/ejb/catalog/CatalogDAOClass");
+ log.debug("ejb/catalog/CatalogDAOClass = " + s);
+ }
+
+ private void testEjbRefs(Context initCtx, Context myEnv) throws NamingException
+ {
+ //do lookup on bean specified without ejb-link
+ Object ejb = initCtx.lookup("java:comp/env/ejb/bean3");
+ if ((ejb instanceof StatelessSessionHome) == false)
+ throw new NamingException("ejb/bean3 is not a StatelessSessionHome");
+ log.debug("ejb/bean3 = " + ejb);
+
+
+ ejb = initCtx.lookup("java:comp/env/ejb/CtsBmp");
+ if ((ejb instanceof EntityHome) == false)
+ throw new NamingException("ejb/CtsBmp is not a EntityHome");
+
+ //lookup of local-ejb-ref bean specified without ejb-link
+ ejb = initCtx.lookup("java:comp/env/ejb/local/bean3");
+ if ((ejb instanceof StatelessSessionLocalHome) == false)
+ throw new NamingException("ejb/local/bean3 is not a StatelessSessionLocalHome");
+ log.debug("ejb/local/bean3 = " + ejb);
+ }
+
+ private void testJdbcDataSource(Context initCtx, Context myEnv) throws NamingException
+ {
+ // JDBC DataSource
+ DataSource ds = (DataSource) myEnv.lookup("jdbc/DefaultDS");
+ log.debug("jdbc/DefaultDS = " + ds);
+ }
+
+ private void testMail(Context initCtx, Context myEnv) throws NamingException
+ {
+ // JavaMail Session
+ Session session = (Session) myEnv.lookup("mail/DefaultMail");
+ log.debug("mail/DefaultMail = " + session);
+ }
+
+ private void testJMS(Context initCtx, Context myEnv) throws NamingException
+ {
+ // JavaMail Session
+ QueueConnectionFactory qf = (QueueConnectionFactory) myEnv.lookup("jms/QueFactory");
+ log.debug("jms/QueFactory = " + qf);
+ }
+
+ private void testURL(Context initCtx, Context myEnv) throws NamingException
+ {
+ // URLs
+ URL home1 = (URL) myEnv.lookup("url/JBossHome");
+ log.debug("url/JBossHome = " + home1);
+ URL home2 = (URL) initCtx.lookup("java:comp/env/url/JBossHome");
+ log.debug("url/JBossHome = " + home2);
+ if( home1.equals(home2) == false )
+ throw new NamingException("url/JBossHome != java:comp/env/url/JBossHome");
+ }
+
+ private void testMessageDestinationRefs(Context initCtx, Context myEnv) throws NamingException, JMSException
+ {
+ Object obj = myEnv.lookup("mdr/ConsumesLink");
+ log.debug("mdr/ConsumesLink = " + obj);
+ if ((obj instanceof Queue) == false)
+ throw new RuntimeException("mdr/ConsumesLink is not a javax.jms.Queue");
+ Queue queue = (Queue) obj;
+ if ("QUEUE.testQueue".equals(queue.getQueueName()))
+ throw new RuntimeException("Excepted QUEUE.testQueue, got " + queue);
+
+ obj = myEnv.lookup("mdr/ProducesLink");
+ log.debug("mdr/ProducesLink = " + obj);
+ if ((obj instanceof Topic) == false)
+ throw new RuntimeException("mdr/ProducesLink is not a javax.jms.Topic");
+ Topic topic = (Topic) obj;
+ if ("TOPIC.testTopic".equals(topic.getTopicName()))
+ throw new RuntimeException("Excepted TOPIC.testTopic got " + topic);
+
+ obj = myEnv.lookup("mdr/ConsumesProducesJNDIName");
+ log.debug("mdr/ConsumesProducesJNDIName = " + obj);
+ if ((obj instanceof Queue) == false)
+ throw new RuntimeException("mdr/ConsumesProducesJNDIName is not a javax.jms.Queue");
+ queue = (Queue) obj;
+ if ("QUEUE.A".equals(queue.getQueueName()))
+ throw new RuntimeException("Excepted QUEUE.A, got " + queue);
+ }
+
+}
Property changes on: trunk/testsuite/src/main/org/jboss/test/web/servlets/ENCTester.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/testsuite/src/main/org/jboss/test/web/servlets/StandaloneENCAnnotationsServlet.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/web/servlets/StandaloneENCAnnotationsServlet.java 2006-11-16 06:11:41 UTC (rev 58437)
+++ trunk/testsuite/src/main/org/jboss/test/web/servlets/StandaloneENCAnnotationsServlet.java 2006-11-16 06:13:04 UTC (rev 58438)
@@ -0,0 +1,129 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.web.servlets;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Date;
+
+import javax.annotation.Resource;
+import javax.annotation.Resources;
+import javax.ejb.EJB;
+import javax.jms.Queue;
+import javax.jms.QueueConnectionFactory;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.sql.DataSource;
+
+import org.jboss.logging.Logger;
+import org.jboss.test.web.mock.EntityHome;
+import org.jboss.test.web.mock.StatelessSessionHome;
+import org.jboss.test.web.mock.StatelessSessionLocalHome;
+
+/** Tests of the server ENC naming context configured via annotations. This servlet has
+ * no dependencies on other ee component deployments as the env references are to mock
+ * objects. It does depend on a kernel beans deployment to setup the jndi bindings.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision$
+ */
+ at Resources({
+ @Resource(name="mail/DefaultMail", type=javax.mail.Session.class, mappedName="java:/Mail"),
+ @Resource(name="url/JBossHome", type=java.net.URL.class, mappedName="http://www.jboss.org"),
+ @Resource(name="mdr/ConsumesLink", type=javax.jms.Queue.class, mappedName="MockQueueA"),
+ @Resource(name="mdr/ProducesLink", type=javax.jms.Topic.class, mappedName="MockTopicA")
+})
+public class StandaloneENCAnnotationsServlet extends HttpServlet
+{
+ private static final long serialVersionUID = 1;
+ private static final Logger log = Logger.getLogger(StandaloneENCAnnotationsServlet.class);
+
+ @Resource(name="jms/QueFactory", mappedName="java:/ConnectionFactory")
+ QueueConnectionFactory queueFactory;
+ @Resource(name="TestQueue", mappedName="MockQueueB")
+ Queue testQueue;
+ @Resource(name="mdr/ConsumesProducesJNDIName", mappedName="MockQueueA")
+ Queue refQueue;
+
+ @Resource(name="jdbc/DefaultDS", mappedName="java:/MockDS")
+ DataSource ds;
+ @EJB(name="ejb/bean3", beanInterface=StatelessSessionHome.class,
+ mappedName="jbosstest/ejbs/UnsecuredEJB")
+ StatelessSessionHome sshome;
+ @EJB(name="ejb/CtsBmp", beanInterface=EntityHome.class,
+ mappedName="jbosstest/ejbs/CtsBmp")
+ EntityHome entityHome;
+ @EJB(name="ejb/local/bean3", beanInterface=StatelessSessionLocalHome.class,
+ mappedName="jbosstest/ejbs/local/ENCBean1")
+ StatelessSessionLocalHome localHome;
+ @Resource(name="Ints/i0", mappedName="0")
+ int i0;
+ @Resource(name="Ints/i1", mappedName="1")
+ int i1;
+ @Resource(name="Floats/f0", mappedName="0.0")
+ float f0;
+ @Resource(name="Floats/f1", mappedName="1.1")
+ float f1;
+ @Resource(name="Strings/s0", mappedName="String0")
+ String s0;
+ @Resource(name="Strings/s1", mappedName="String1")
+ String s1;
+ @Resource(name="ejb/catalog/CatalogDAOClass", mappedName="com.sun.model.dao.CatalogDAOImpl")
+ String ejbName;
+
+ protected void processRequest(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException
+ {
+ ENCTester tester = new ENCTester(log);
+ tester.testENC();
+
+ if( queueFactory == null )
+ throw new ServletException("queueFactory is not injected");
+ if( testQueue == null )
+ throw new ServletException("testQueue is not injected");
+ if( testQueue == null )
+ throw new ServletException("testQueue is not injected");
+
+ response.setContentType("text/html");
+ PrintWriter out = response.getWriter();
+ out.println("<html>");
+ out.println("<head><title>StandaloneENCAnnotationsServlet</title></head>");
+ out.println("<body>Tests passed<br>Time:" + new Date() + "</body>");
+ out.println("</html>");
+ out.close();
+ }
+
+ protected void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException
+ {
+ processRequest(request, response);
+ }
+
+ protected void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException
+ {
+ processRequest(request, response);
+ }
+
+}
Property changes on: trunk/testsuite/src/main/org/jboss/test/web/servlets/StandaloneENCAnnotationsServlet.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/testsuite/src/main/org/jboss/test/web/servlets/StandaloneENCServlet.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/web/servlets/StandaloneENCServlet.java 2006-11-16 06:11:41 UTC (rev 58437)
+++ trunk/testsuite/src/main/org/jboss/test/web/servlets/StandaloneENCServlet.java 2006-11-16 06:13:04 UTC (rev 58438)
@@ -23,29 +23,13 @@
import java.io.IOException;
import java.io.PrintWriter;
-import java.net.URL;
import java.util.Date;
-import java.util.Hashtable;
-import java.util.Iterator;
-import javax.jms.JMSException;
-import javax.jms.Queue;
-import javax.jms.QueueConnectionFactory;
-import javax.jms.Topic;
-import javax.mail.Session;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import javax.sql.DataSource;
-import org.jboss.test.web.mock.EntityHome;
-import org.jboss.test.web.mock.StatelessSessionHome;
-import org.jboss.test.web.mock.StatelessSessionLocalHome;
-
/** Tests of the server ENC naming context configured via web.xml. This servlet has
* no dependencies on other ee component deployments as the env references are to mock
* objects. It does depend on a kernel beans deployment to setup the jndi bindings.
@@ -62,7 +46,8 @@
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
- testENC();
+ ENCTester tester = new ENCTester(log);
+ tester.testENC();
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
@@ -84,141 +69,4 @@
processRequest(request, response);
}
- private void testENC() throws ServletException
- {
- try
- {
- // Obtain the environment naming context.
- Context initCtx = new InitialContext();
- Hashtable env = initCtx.getEnvironment();
- Iterator keys = env.keySet().iterator();
- log.info("InitialContext.env:");
- while( keys.hasNext() )
- {
- Object key = keys.next();
- log.info("Key: "+key+", value: "+env.get(key));
- }
- Context myEnv = (Context) initCtx.lookup("java:comp/env");
- testEjbRefs(initCtx, myEnv);
- testJdbcDataSource(initCtx, myEnv);
- testMail(initCtx, myEnv);
- testJMS(initCtx, myEnv);
- testURL(initCtx, myEnv);
- testEnvEntries(initCtx, myEnv);
- testMessageDestinationRefs(initCtx, myEnv);
- }
- catch (NamingException e)
- {
- log.debug("Lookup failed", e);
- throw new ServletException("Lookup failed, ENC tests failed", e);
- }
- catch (JMSException e)
- {
- log.debug("JMS access failed", e);
- throw new ServletException("JMS access failed, ENC tests failed", e);
- }
- catch (RuntimeException e)
- {
- log.debug("Runtime error", e);
- throw new ServletException("Runtime error, ENC tests failed", e);
- }
- }
-
- private void testEnvEntries(Context initCtx, Context myEnv) throws NamingException
- {
- // Basic env values
- Integer i = (Integer) myEnv.lookup("Ints/i0");
- log.debug("Ints/i0 = " + i);
- i = (Integer) initCtx.lookup("java:comp/env/Ints/i1");
- log.debug("Ints/i1 = " + i);
- Float f = (Float) myEnv.lookup("Floats/f0");
- log.debug("Floats/f0 = " + f);
- f = (Float) initCtx.lookup("java:comp/env/Floats/f1");
- log.debug("Floats/f1 = " + f);
- String s = (String) myEnv.lookup("Strings/s0");
- log.debug("Strings/s0 = " + s);
- s = (String) initCtx.lookup("java:comp/env/Strings/s1");
- log.debug("Strings/s1 = " + s);
- s = (String) initCtx.lookup("java:comp/env/ejb/catalog/CatalogDAOClass");
- log.debug("ejb/catalog/CatalogDAOClass = " + s);
- }
-
- private void testEjbRefs(Context initCtx, Context myEnv) throws NamingException
- {
- //do lookup on bean specified without ejb-link
- Object ejb = initCtx.lookup("java:comp/env/ejb/bean3");
- if ((ejb instanceof StatelessSessionHome) == false)
- throw new NamingException("ejb/bean3 is not a StatelessSessionHome");
- log.debug("ejb/bean3 = " + ejb);
-
-
- ejb = initCtx.lookup("java:comp/env/ejb/CtsBmp");
- if ((ejb instanceof EntityHome) == false)
- throw new NamingException("ejb/CtsBmp is not a EntityHome");
-
- //lookup of local-ejb-ref bean specified without ejb-link
- ejb = initCtx.lookup("java:comp/env/ejb/local/bean3");
- if ((ejb instanceof StatelessSessionLocalHome) == false)
- throw new NamingException("ejb/local/bean3 is not a StatelessSessionLocalHome");
- log.debug("ejb/local/bean3 = " + ejb);
- }
-
- private void testJdbcDataSource(Context initCtx, Context myEnv) throws NamingException
- {
- // JDBC DataSource
- DataSource ds = (DataSource) myEnv.lookup("jdbc/DefaultDS");
- log.debug("jdbc/DefaultDS = " + ds);
- }
-
- private void testMail(Context initCtx, Context myEnv) throws NamingException
- {
- // JavaMail Session
- Session session = (Session) myEnv.lookup("mail/DefaultMail");
- log.debug("mail/DefaultMail = " + session);
- }
-
- private void testJMS(Context initCtx, Context myEnv) throws NamingException
- {
- // JavaMail Session
- QueueConnectionFactory qf = (QueueConnectionFactory) myEnv.lookup("jms/QueFactory");
- log.debug("jms/QueFactory = " + qf);
- }
-
- private void testURL(Context initCtx, Context myEnv) throws NamingException
- {
- // URLs
- URL home1 = (URL) myEnv.lookup("url/JBossHome");
- log.debug("url/JBossHome = " + home1);
- URL home2 = (URL) initCtx.lookup("java:comp/env/url/JBossHome");
- log.debug("url/JBossHome = " + home2);
- if( home1.equals(home2) == false )
- throw new NamingException("url/JBossHome != java:comp/env/url/JBossHome");
- }
-
- private void testMessageDestinationRefs(Context initCtx, Context myEnv) throws NamingException, JMSException
- {
- Object obj = myEnv.lookup("mdr/ConsumesLink");
- log.debug("mdr/ConsumesLink = " + obj);
- if ((obj instanceof Queue) == false)
- throw new RuntimeException("mdr/ConsumesLink is not a javax.jms.Queue");
- Queue queue = (Queue) obj;
- if ("QUEUE.testQueue".equals(queue.getQueueName()))
- throw new RuntimeException("Excepted QUEUE.testQueue, got " + queue);
-
- obj = myEnv.lookup("mdr/ProducesLink");
- log.debug("mdr/ProducesLink = " + obj);
- if ((obj instanceof Topic) == false)
- throw new RuntimeException("mdr/ProducesLink is not a javax.jms.Topic");
- Topic topic = (Topic) obj;
- if ("TOPIC.testTopic".equals(topic.getTopicName()))
- throw new RuntimeException("Excepted TOPIC.testTopic got " + topic);
-
- obj = myEnv.lookup("mdr/ConsumesProducesJNDIName");
- log.debug("mdr/ConsumesProducesJNDIName = " + obj);
- if ((obj instanceof Queue) == false)
- throw new RuntimeException("mdr/ConsumesProducesJNDIName is not a javax.jms.Queue");
- queue = (Queue) obj;
- if ("QUEUE.A".equals(queue.getQueueName()))
- throw new RuntimeException("Excepted QUEUE.A, got " + queue);
- }
}
Added: trunk/testsuite/src/main/org/jboss/test/web/test/EncAnnotationsUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/web/test/EncAnnotationsUnitTestCase.java 2006-11-16 06:11:41 UTC (rev 58437)
+++ trunk/testsuite/src/main/org/jboss/test/web/test/EncAnnotationsUnitTestCase.java 2006-11-16 06:13:04 UTC (rev 58438)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.web.test;
+
+import java.net.URL;
+
+import junit.framework.Test;
+
+import org.apache.commons.httpclient.Header;
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.util.web.HttpUtils;
+
+/** Tests of a web app java:comp/env jndi settings specified via javaee5 annotations
+
+ @author Scott.Stark at jboss.org
+ @version $Revision$
+ */
+public class EncAnnotationsUnitTestCase extends JBossTestCase
+{
+ private String baseURL = HttpUtils.getBaseURL();
+
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(EncAnnotationsUnitTestCase.class, "simple-mock.beans,simple-annonly.war");
+ }
+
+ public EncAnnotationsUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ /** Access the http://{host}/simple-annonly/ENCServlet
+ */
+ public void testAltRequestInfoServlet()
+ throws Exception
+ {
+ URL url = new URL(baseURL+"simple-annonly/ENCServlet");
+ HttpMethodBase request = HttpUtils.accessURL(url);
+ Header errors = request.getResponseHeader("X-Exception");
+ log.info("X-Exception: "+errors);
+ assertTrue("X-Exception("+errors+") is null", errors == null);
+ }
+
+}
Property changes on: trunk/testsuite/src/main/org/jboss/test/web/test/EncAnnotationsUnitTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/testsuite/src/resources/web/simple-xmlonly/annotated-web.xml
===================================================================
--- trunk/testsuite/src/resources/web/simple-xmlonly/annotated-web.xml 2006-11-16 06:11:41 UTC (rev 58437)
+++ trunk/testsuite/src/resources/web/simple-xmlonly/annotated-web.xml 2006-11-16 06:13:04 UTC (rev 58438)
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app version="2.5"
+ xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+ <description>Tests of the servlet enc config via annotations</description>
+
+ <!-- ### Servlets -->
+ <servlet>
+ <servlet-name>ENCServlet</servlet-name>
+ <servlet-class>org.jboss.test.web.servlets.StandaloneENCAnnotationsServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>ENCServlet</servlet-name>
+ <url-pattern>/ENCServlet</url-pattern>
+ </servlet-mapping>
+
+ <!-- The Welcome File List -->
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ </welcome-file-list>
+
+
+</web-app>
Property changes on: trunk/testsuite/src/resources/web/simple-xmlonly/annotated-web.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/testsuite/src/resources/web/simple-xmlonly/web.xml
===================================================================
--- trunk/testsuite/src/resources/web/simple-xmlonly/web.xml 2006-11-16 06:11:41 UTC (rev 58437)
+++ trunk/testsuite/src/resources/web/simple-xmlonly/web.xml 2006-11-16 06:13:04 UTC (rev 58438)
@@ -6,7 +6,7 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
- <description>Tests of the descriptor to object model</description>
+ <description>Tests of the servlet enc config via xml</description>
<!-- ### Servlets -->
<servlet>
More information about the jboss-cvs-commits
mailing list