[jboss-cvs] JBossAS SVN: r58343 - in trunk/testsuite/src: main/org/jboss/test/web main/org/jboss/test/web/mock main/org/jboss/test/web/servlets resources/web resources/web/simple-xmlonly
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Nov 14 11:28:57 EST 2006
Author: scott.stark at jboss.org
Date: 2006-11-14 11:28:54 -0500 (Tue, 14 Nov 2006)
New Revision: 58343
Added:
trunk/testsuite/src/main/org/jboss/test/web/mock/
trunk/testsuite/src/main/org/jboss/test/web/mock/Entity.java
trunk/testsuite/src/main/org/jboss/test/web/mock/EntityHome.java
trunk/testsuite/src/main/org/jboss/test/web/mock/MockDataSource.java
trunk/testsuite/src/main/org/jboss/test/web/mock/StatelessSession.java
trunk/testsuite/src/main/org/jboss/test/web/mock/StatelessSessionHome.java
trunk/testsuite/src/main/org/jboss/test/web/mock/StatelessSessionLocal.java
trunk/testsuite/src/main/org/jboss/test/web/mock/StatelessSessionLocalHome.java
trunk/testsuite/src/main/org/jboss/test/web/servlets/StandaloneENCServlet.java
trunk/testsuite/src/resources/web/simple-xmlonly/
trunk/testsuite/src/resources/web/simple-xmlonly/encbinding-service.xml
trunk/testsuite/src/resources/web/simple-xmlonly/jboss-web.xml
trunk/testsuite/src/resources/web/simple-xmlonly/web.xml
Log:
Simple servlet env configuration tests
Added: trunk/testsuite/src/main/org/jboss/test/web/mock/Entity.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/web/mock/Entity.java 2006-11-14 15:47:29 UTC (rev 58342)
+++ trunk/testsuite/src/main/org/jboss/test/web/mock/Entity.java 2006-11-14 16:28:54 UTC (rev 58343)
@@ -0,0 +1,33 @@
+/*
+ * 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.mock;
+
+import javax.ejb.EJBObject;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface Entity extends EJBObject
+{
+ public String getKey();
+}
Added: trunk/testsuite/src/main/org/jboss/test/web/mock/EntityHome.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/web/mock/EntityHome.java 2006-11-14 15:47:29 UTC (rev 58342)
+++ trunk/testsuite/src/main/org/jboss/test/web/mock/EntityHome.java 2006-11-14 16:28:54 UTC (rev 58343)
@@ -0,0 +1,43 @@
+/*
+ * 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.mock;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.DuplicateKeyException;
+import javax.ejb.FinderException;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface EntityHome extends javax.ejb.EJBHome
+{
+public Entity create (String key)
+ throws CreateException, DuplicateKeyException,
+ RemoteException;
+
+public Entity findByPrimaryKey (String key)
+ throws FinderException, RemoteException;
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/web/mock/MockDataSource.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/web/mock/MockDataSource.java 2006-11-14 15:47:29 UTC (rev 58342)
+++ trunk/testsuite/src/main/org/jboss/test/web/mock/MockDataSource.java 2006-11-14 16:28:54 UTC (rev 58343)
@@ -0,0 +1,48 @@
+package org.jboss.test.web.mock;
+
+import java.io.PrintWriter;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import javax.sql.DataSource;
+
+/**
+ * A noop DataSource implementation
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public class MockDataSource implements DataSource
+{
+
+ public Connection getConnection() throws SQLException
+ {
+ return null;
+ }
+
+ public Connection getConnection(String arg0, String arg1) throws SQLException
+ {
+ return null;
+ }
+
+ public int getLoginTimeout() throws SQLException
+ {
+ return 0;
+ }
+
+ public PrintWriter getLogWriter() throws SQLException
+ {
+ return null;
+ }
+
+ public void setLoginTimeout(int arg0) throws SQLException
+ {
+
+ }
+
+ public void setLogWriter(PrintWriter arg0) throws SQLException
+ {
+
+ }
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/web/mock/StatelessSession.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/web/mock/StatelessSession.java 2006-11-14 15:47:29 UTC (rev 58342)
+++ trunk/testsuite/src/main/org/jboss/test/web/mock/StatelessSession.java 2006-11-14 16:28:54 UTC (rev 58343)
@@ -0,0 +1,35 @@
+/*
+ * 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.mock;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBObject;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface StatelessSession extends EJBObject
+{
+ public void noop() throws RemoteException;
+}
Added: trunk/testsuite/src/main/org/jboss/test/web/mock/StatelessSessionHome.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/web/mock/StatelessSessionHome.java 2006-11-14 15:47:29 UTC (rev 58342)
+++ trunk/testsuite/src/main/org/jboss/test/web/mock/StatelessSessionHome.java 2006-11-14 16:28:54 UTC (rev 58343)
@@ -0,0 +1,32 @@
+/*
+ * 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.mock;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+
+public interface StatelessSessionHome extends EJBHome
+{
+ public StatelessSession create() throws RemoteException, CreateException;
+}
Added: trunk/testsuite/src/main/org/jboss/test/web/mock/StatelessSessionLocal.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/web/mock/StatelessSessionLocal.java 2006-11-14 15:47:29 UTC (rev 58342)
+++ trunk/testsuite/src/main/org/jboss/test/web/mock/StatelessSessionLocal.java 2006-11-14 16:28:54 UTC (rev 58343)
@@ -0,0 +1,35 @@
+/*
+ * 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.mock;
+
+import javax.ejb.EJBException;
+import javax.ejb.EJBLocalObject;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface StatelessSessionLocal extends EJBLocalObject
+{
+ public void noop() throws EJBException;
+
+}
Added: trunk/testsuite/src/main/org/jboss/test/web/mock/StatelessSessionLocalHome.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/web/mock/StatelessSessionLocalHome.java 2006-11-14 15:47:29 UTC (rev 58342)
+++ trunk/testsuite/src/main/org/jboss/test/web/mock/StatelessSessionLocalHome.java 2006-11-14 16:28:54 UTC (rev 58343)
@@ -0,0 +1,34 @@
+/*
+ * 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.mock;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBLocalHome;
+
+/**
+ * @author Scott.Stark at jboss.org
+ * @version $Revision:$
+ */
+public interface StatelessSessionLocalHome extends EJBLocalHome
+{
+ public StatelessSessionLocal create() throws CreateException;
+}
Added: trunk/testsuite/src/main/org/jboss/test/web/servlets/StandaloneENCServlet.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/web/servlets/StandaloneENCServlet.java 2006-11-14 15:47:29 UTC (rev 58342)
+++ trunk/testsuite/src/main/org/jboss/test/web/servlets/StandaloneENCServlet.java 2006-11-14 16:28:54 UTC (rev 58343)
@@ -0,0 +1,268 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.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.cts.interfaces.CtsBmpHome;
+import org.jboss.test.web.interfaces.StatelessSessionHome;
+import org.jboss.test.web.interfaces.StatelessSessionLocalHome;
+
+/** Tests of the server ENC naming context. This servlet has no dependencies on other componet
+ * deployments as the env references are to mock objects.
+ *
+ * @author Scott.Stark at jboss.org
+ * @version $Revision: 58115 $
+ */
+public class StandaloneENCServlet extends HttpServlet
+{
+ private static final long serialVersionUID = 1;
+
+ org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(getClass());
+
+ protected void processRequest(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException
+ {
+ testENC();
+ response.setContentType("text/html");
+ PrintWriter out = response.getWriter();
+ out.println("<html>");
+ out.println("<head><title>ENCServlet</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);
+ }
+
+ private void testENC() throws ServletException
+ {
+ try
+ {
+ // Obtain the enterprise bean�s 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
+ {
+ // EJB References
+ Object ejb = myEnv.lookup("ejb/bean0");
+ if ((ejb instanceof StatelessSessionHome) == false)
+ throw new NamingException("ejb/bean0 is not a StatelessSessionHome");
+ log.debug("ejb/bean0 = " + ejb);
+ ejb = initCtx.lookup("java:comp/env/ejb/bean1");
+ if ((ejb instanceof StatelessSessionHome) == false)
+ throw new NamingException("ejb/bean1 is not a StatelessSessionHome");
+ log.debug("ejb/bean1 = " + ejb);
+ ejb = initCtx.lookup("java:comp/env/ejb/bean2");
+ if ((ejb instanceof StatelessSessionHome) == false)
+ throw new NamingException("ejb/bean2 is not a StatelessSessionHome");
+ log.debug("ejb/bean2 = " + ejb);
+ //do lookup on bean specified without ejb-link
+ 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/UnsecuredEJB");
+ if ((ejb instanceof StatelessSessionHome) == false)
+ throw new NamingException("ejb/UnsecuredEJB is not a StatelessSessionHome");
+ log.debug("ejb/UnsecuredEJB = " + ejb);
+ ejb = initCtx.lookup("java:comp/env/ejb/SecuredEJB");
+ if ((ejb instanceof StatelessSessionHome) == false)
+ throw new NamingException("ejb/SecuredEJB is not a StatelessSessionHome");
+ log.debug("ejb/SecuredEJB = " + ejb);
+ ejb = initCtx.lookup("java:comp/env/ejb/CtsBmp");
+ if ((ejb instanceof CtsBmpHome) == false)
+ throw new NamingException("ejb/CtsBmp is not a CtsBmpHome");
+ log.debug("ejb/CtsBmp = " + ejb);
+ ejb = initCtx.lookup("java:comp/env/ejb/RelativeBean");
+ if ((ejb instanceof StatelessSessionHome) == false )
+ throw new NamingException("ejb/RelativeBean is not a StatelessSessionHome");
+ log.debug("ejb/RelativeBean = " + ejb);
+
+ // EJB Local References
+ ejb = initCtx.lookup("java:comp/env/ejb/local/bean0");
+ if ((ejb instanceof StatelessSessionLocalHome) == false)
+ throw new NamingException("ejb/local/bean0 is not a StatelessSessionLocalHome");
+ log.debug("ejb/local/bean0 = " + ejb);
+ ejb = initCtx.lookup("java:comp/env/ejb/local/bean1");
+ if ((ejb instanceof StatelessSessionLocalHome) == false)
+ throw new NamingException("ejb/local/bean1 is not a StatelessSessionLocalHome");
+ log.debug("ejb/local/bean1 = " + ejb);
+
+ //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);
+
+ ejb = initCtx.lookup("java:comp/env/ejb/local/OptimizedEJB");
+ if ((ejb instanceof StatelessSessionLocalHome) == false)
+ throw new NamingException("ejb/local/OptimizedEJB is not a StatelessSessionLocalHome");
+ log.debug("ejb/local/OptimizedEJB = " + ejb);
+ ejb = initCtx.lookup("java:comp/env/ejb/local/RelativeBean");
+ if ((ejb instanceof StatelessSessionLocalHome) == false )
+ throw new NamingException("ejb/local/RelativeBean is not a StatelessSessionLocalHome");
+ log.debug("ejb/local/RelativeBean = " + 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/resources/web/simple-xmlonly/encbinding-service.xml
===================================================================
--- trunk/testsuite/src/resources/web/simple-xmlonly/encbinding-service.xml 2006-11-14 15:47:29 UTC (rev 58342)
+++ trunk/testsuite/src/resources/web/simple-xmlonly/encbinding-service.xml 2006-11-14 16:28:54 UTC (rev 58343)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE server PUBLIC "-//JBoss//DTD MBean Service 4.0//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-service_4_0.dtd">
+<server>
+ <mbean code="org.jboss.naming.JNDIBindingServiceMgr"
+ name="jboss.tests:service=JNDIBindingServiceMgr">
+ <attribute name="BindingsConfig" serialDataType="jbxb">
+ <jndi:bindings
+ xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:jndi="urn:jboss:jndi-binding-service:1.0"
+ xs:schemaLocation="urn:jboss:jndi-binding-service:1.0 resource:jndi-binding-service_1_0.xsd"
+ >
+ <jndi:binding name="java:SomeSite">
+ <jndi:value type="java.net.URL">http://www.somesite.com</jndi:value>
+ </jndi:binding>
+ <jndi:binding name="java:/Mail">
+ <jndi:value type="javax.mail.Session" >http://www.somesite.com</jndi:value>
+ </jndi:binding>
+
+ </jndi:bindings>
+ </attribute>
+ </mbean>
+
+</server>
Added: trunk/testsuite/src/resources/web/simple-xmlonly/jboss-web.xml
===================================================================
--- trunk/testsuite/src/resources/web/simple-xmlonly/jboss-web.xml 2006-11-14 15:47:29 UTC (rev 58342)
+++ trunk/testsuite/src/resources/web/simple-xmlonly/jboss-web.xml 2006-11-14 16:28:54 UTC (rev 58343)
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jboss-web
+ PUBLIC "-//JBoss//DTD Web Application 2.4//EN"
+ "http://www.jboss.org/j2ee/dtds/jboss-web_4_0.dtd">
+
+<jboss-web>
+ <resource-ref>
+ <res-ref-name>jdbc/DefaultDS</res-ref-name>
+ <jndi-name>java:/DefaultDS</jndi-name>
+ </resource-ref>
+ <resource-ref>
+ <res-ref-name>mail/DefaultMail</res-ref-name>
+ <jndi-name>java:/Mail</jndi-name>
+ </resource-ref>
+ <resource-ref>
+ <res-ref-name>jms/QueFactory</res-ref-name>
+ <jndi-name>ConnectionFactory</jndi-name>
+ </resource-ref>
+ <resource-ref>
+ <res-ref-name>url/JBossHome</res-ref-name>
+ <res-url>http://www.jboss.org</res-url>
+ </resource-ref>
+ <resource-ref>
+ <res-ref-name>url/IndirectURL</res-ref-name>
+ <jndi-name>java:SomeWebSite</jndi-name>
+ </resource-ref>
+
+ <security-role>
+ <role-name>ExtraRole1</role-name>
+ <principal-name>UnsecureRunAsServletWithPrincipalNameAndRolesPrincipal</principal-name>
+ </security-role>
+ <security-role>
+ <role-name>ExtraRole2</role-name>
+ <principal-name>UnsecureRunAsServletWithPrincipalNameAndRolesPrincipal</principal-name>
+ </security-role>
+
+ <ejb-ref>
+ <ejb-ref-name>ejb/bean3</ejb-ref-name>
+ <jndi-name>jbosstest/ejbs/UnsecuredEJB</jndi-name>
+ </ejb-ref>
+
+ <ejb-local-ref>
+ <ejb-ref-name>ejb/local/bean3</ejb-ref-name>
+ <local-jndi-name>jbosstest/ejbs/local/ENCBean1</local-jndi-name>
+ </ejb-local-ref>
+
+ <message-destination-ref>
+ <message-destination-ref-name>mdr/ConsumesProducesJNDIName</message-destination-ref-name>
+ <jndi-name>queue/A</jndi-name>
+ </message-destination-ref>
+
+ <message-destination>
+ <message-destination-name>TestQueue</message-destination-name>
+ <jndi-name>queue/testQueue</jndi-name>
+ </message-destination>
+ <message-destination>
+ <message-destination-name>TestTopic</message-destination-name>
+ <jndi-name>topic/testTopic</jndi-name>
+ </message-destination>
+</jboss-web>
Added: trunk/testsuite/src/resources/web/simple-xmlonly/web.xml
===================================================================
--- trunk/testsuite/src/resources/web/simple-xmlonly/web.xml 2006-11-14 15:47:29 UTC (rev 58342)
+++ trunk/testsuite/src/resources/web/simple-xmlonly/web.xml 2006-11-14 16:28:54 UTC (rev 58343)
@@ -0,0 +1,259 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app version="2.4"
+ xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ 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>
+
+ <!-- ### Servlets -->
+ <servlet>
+ <servlet-name>ENCServlet</servlet-name>
+ <servlet-class>org.jboss.test.web.servlets.StandaloneENCServlet</servlet-class>
+ <init-param>
+ <param-name>expectedUserRoles</param-name>
+ <param-value>AuthorizedUser,ServletUser</param-value>
+ </init-param>
+ <init-param>
+ <param-name>unexpectedUserRoles</param-name>
+ <param-value>Anonymous</param-value>
+ </init-param>
+ <security-role-ref>
+ <description>A mapping for the ServletUser role</description>
+ <role-name>ServletUser</role-name>
+ <role-link>ServletUserRole</role-link>
+ </security-role-ref>
+ </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>
+
+ <!-- ### Security -->
+ <security-constraint>
+ <web-resource-collection>
+ <web-resource-name>Restricted</web-resource-name>
+ <description>All content is secured</description>
+ <url-pattern>/*</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <description>Only authenticated users can access secure content</description>
+ <role-name>AuthorizedUser</role-name>
+ </auth-constraint>
+ <user-data-constraint>
+ <description>no description</description>
+ <transport-guarantee>NONE</transport-guarantee>
+ </user-data-constraint>
+ </security-constraint>
+
+ <login-config>
+ <auth-method>BASIC</auth-method>
+ <realm-name>UserInRoleRealm</realm-name>
+ </login-config>
+
+ <security-role>
+ <role-name>AuthorizedUser</role-name>
+ </security-role>
+ <security-role>
+ <role-name>ServletUserRole</role-name>
+ </security-role>
+ <security-role>
+ <role-name>AnotherUserRole</role-name>
+ </security-role>
+
+ <!-- ### Environment (java:comp/env/ejb) -->
+ <env-entry>
+ <description>Integer0</description>
+ <env-entry-name>Ints/i0</env-entry-name>
+ <env-entry-type>java.lang.Integer</env-entry-type>
+ <env-entry-value>0</env-entry-value>
+ </env-entry>
+ <env-entry>
+ <description>Integer1</description>
+ <env-entry-name>Ints/i1</env-entry-name>
+ <env-entry-type>java.lang.Integer</env-entry-type>
+ <env-entry-value>1</env-entry-value>
+ </env-entry>
+ <env-entry>
+ <description>Float0</description>
+ <env-entry-name>Floats/f0</env-entry-name>
+ <env-entry-type>java.lang.Float</env-entry-type>
+ <env-entry-value>0.0</env-entry-value>
+ </env-entry>
+ <env-entry>
+ <description>Float1</description>
+ <env-entry-name>Floats/f1</env-entry-name>
+ <env-entry-type>java.lang.Float</env-entry-type>
+ <env-entry-value>1.1</env-entry-value>
+ </env-entry>
+ <env-entry>
+ <description>String0</description>
+ <env-entry-name>Strings/s0</env-entry-name>
+ <env-entry-type>java.lang.String</env-entry-type>
+ <env-entry-value>String0</env-entry-value>
+ </env-entry>
+ <env-entry>
+ <description>String1</description>
+ <env-entry-name>Strings/s1</env-entry-name>
+ <env-entry-type>java.lang.String</env-entry-type>
+ <env-entry-value>String1</env-entry-value>
+ </env-entry>
+ <env-entry>
+ <env-entry-name>ejb/catalog/CatalogDAOClass</env-entry-name>
+ <env-entry-type>java.lang.String</env-entry-type>
+ <env-entry-value>com.sun.model.dao.CatalogDAOImpl</env-entry-value>
+ </env-entry>
+
+ <!-- ### EJB References (java:comp/env/ejb) -->
+ <!-- An ejb-ref that has no corresponding ejb-ref in jboss-web.xml -->
+ <ejb-ref>
+ <ejb-ref-name>ejb/bean0</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <home>org.jboss.test.web.mock.StatelessSessionHome</home>
+ <remote>org.jboss.test.web.mock.StatelessSession</remote>
+ <ejb-link>ENCBean0</ejb-link>
+ </ejb-ref>
+ <ejb-ref>
+ <ejb-ref-name>ejb/bean1</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <home>org.jboss.test.web.mock.StatelessSessionHome</home>
+ <remote>org.jboss.test.web.mock.StatelessSession</remote>
+ <ejb-link>ENCBean1</ejb-link>
+ </ejb-ref>
+ <ejb-ref>
+ <ejb-ref-name>ejb/bean2</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <home>org.jboss.test.web.mock.StatelessSessionHome</home>
+ <remote>org.jboss.test.web.mock.StatelessSession</remote>
+ <ejb-link>ENCBean1</ejb-link>
+ </ejb-ref>
+ <!-- ejb-ref that needs jboss-web.xml -->
+ <ejb-ref>
+ <ejb-ref-name>ejb/bean3</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <home>org.jboss.test.web.mock.StatelessSessionHome</home>
+ <remote>org.jboss.test.web.mock.StatelessSession</remote>
+ </ejb-ref>
+ <ejb-ref>
+ <ejb-ref-name>ejb/Entity</ejb-ref-name>
+ <ejb-ref-type>Entity</ejb-ref-type>
+ <home>org.jboss.test.web.mock.EntityHome</home>
+ <remote>org.jboss.test.web.mock.Entity</remote>
+ <ejb-link>Entity</ejb-link>
+ </ejb-ref>
+ <ejb-ref>
+ <ejb-ref-name>ejb/EntityFacade</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <home>org.jboss.test.web.mock.EntityFacadeHome</home>
+ <remote>org.jboss.test.web.mock.EntityFacade</remote>
+ <ejb-link>EntityFacade</ejb-link>
+ </ejb-ref>
+ <ejb-ref>
+ <ejb-ref-name>ejb/OptimizedEJB</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <home>org.jboss.test.web.mock.StatelessSessionHome</home>
+ <remote>org.jboss.test.web.mock.StatelessSession</remote>
+ <ejb-link>OptimizedEJB</ejb-link>
+ </ejb-ref>
+ <ejb-ref>
+ <ejb-ref-name>ejb/NotOptimizedEJB</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <home>org.jboss.test.web.mock.StatelessSessionHome</home>
+ <remote>org.jboss.test.web.mock.StatelessSession</remote>
+ <ejb-link>NotOptimizedEJB</ejb-link>
+ </ejb-ref>
+ <ejb-ref>
+ <ejb-ref-name>ejb/CtsBmp</ejb-ref-name>
+ <ejb-ref-type>Entity</ejb-ref-type>
+ <home>org.jboss.test.web.mock.EntityHome</home>
+ <remote>org.jboss.test.web.mock.Entity</remote>
+ <ejb-link>BMPBean</ejb-link>
+ </ejb-ref>
+ <ejb-ref>
+ <ejb-ref-name>ejb/SecuredEJB</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <home>org.jboss.test.web.mock.StatelessSessionHome</home>
+ <remote>org.jboss.test.web.mock.StatelessSession</remote>
+ <ejb-link>SecuredEJB</ejb-link>
+ </ejb-ref>
+ <ejb-ref>
+ <ejb-ref-name>ejb/UnsecuredEJB</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <home>org.jboss.test.web.mock.StatelessSessionHome</home>
+ <remote>org.jboss.test.web.mock.StatelessSession</remote>
+ <ejb-link>UnsecuredEJB</ejb-link>
+ </ejb-ref>
+ <ejb-ref>
+ <ejb-ref-name>ejb/StatefulEJB</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <home>org.jboss.test.web.mock.StatelessSessionHome</home>
+ <remote>org.jboss.test.web.mock.StatelessSession</remote>
+ <ejb-link>StatefulEJB</ejb-link>
+ </ejb-ref>
+
+ <ejb-local-ref>
+ <ejb-ref-name>ejb/local/bean0</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <local-home>org.jboss.test.web.mock.StatelessSessionLocalHome</local-home>
+ <local>org.jboss.test.web.mock.StatelessSessionLocal</local>
+ <ejb-link>ENCBean0</ejb-link>
+ </ejb-local-ref>
+ <ejb-local-ref>
+ <ejb-ref-name>ejb/local/bean1</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <local-home>org.jboss.test.web.mock.StatelessSessionLocalHome</local-home>
+ <local>org.jboss.test.web.mock.StatelessSessionLocal</local>
+ <ejb-link>ENCBean1</ejb-link>
+ </ejb-local-ref>
+ <!-- ejb-local-ref that needs jboss-web.xml -->
+ <ejb-local-ref>
+ <ejb-ref-name>ejb/local/bean3</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <local-home>org.jboss.test.web.mock.StatelessSessionLocalHome</local-home>
+ <local>org.jboss.test.web.mock.StatelessSessionLocal</local>
+ </ejb-local-ref>
+
+ <ejb-local-ref>
+ <ejb-ref-name>ejb/local/SecuredEJB</ejb-ref-name>
+ <ejb-ref-type>Session</ejb-ref-type>
+ <local-home>org.jboss.test.web.mock.StatelessSessionLocalHome</local-home>
+ <local>org.jboss.test.web.mock.StatelessSessionLocal</local>
+ <ejb-link>SecuredEJB</ejb-link>
+ </ejb-local-ref>
+
+ <message-destination-ref>
+ <description>consumes using a link</description>
+ <message-destination-ref-name>mdr/ConsumesLink</message-destination-ref-name>
+ <message-destination-type>javax.jms.Queue</message-destination-type>
+ <message-destination-usage>Consumes</message-destination-usage>
+ <message-destination-link>TestQueue</message-destination-link>
+ </message-destination-ref>
+ <message-destination-ref>
+ <description>produces using a link</description>
+ <message-destination-ref-name>mdr/ProducesLink</message-destination-ref-name>
+ <message-destination-type>javax.jms.Topic</message-destination-type>
+ <message-destination-usage>Produces</message-destination-usage>
+ <message-destination-link>TestTopic</message-destination-link>
+ </message-destination-ref>
+ <message-destination-ref>
+ <description>consumesproduces using a jndi name</description>
+ <message-destination-ref-name>mdr/ConsumesProducesJNDIName</message-destination-ref-name>
+ <message-destination-type>javax.jms.Queue</message-destination-type>
+ <message-destination-usage>ConsumesProduces</message-destination-usage>
+ </message-destination-ref>
+
+ <message-destination>
+ <message-destination-name>TestQueue</message-destination-name>
+ </message-destination>
+ <message-destination>
+ <message-destination-name>TestTopic</message-destination-name>
+ </message-destination>
+</web-app>
More information about the jboss-cvs-commits
mailing list