[jboss-svn-commits] JBL Code SVN: r10675 - in labs/jbossesb/trunk/plugins/org.jboss.soa.esb.oracle.aq: src/main/java/org/jboss/soa/esb/oracle/aq and 1 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sat Mar 31 04:16:46 EDT 2007


Author: kurt.stam at jboss.com
Date: 2007-03-31 04:16:45 -0400 (Sat, 31 Mar 2007)
New Revision: 10675

Removed:
   labs/jbossesb/trunk/plugins/org.jboss.soa.esb.oracle.aq/src/main/java/org/jboss/soa/esb/oracle/aq/AQContext.java
Modified:
   labs/jbossesb/trunk/plugins/org.jboss.soa.esb.oracle.aq/pom.xml
   labs/jbossesb/trunk/plugins/org.jboss.soa.esb.oracle.aq/src/main/java/org/jboss/soa/esb/oracle/aq/AQInitialContextFactory.java
   labs/jbossesb/trunk/plugins/org.jboss.soa.esb.oracle.aq/src/test/java/org/jboss/soa/esb/oracle/aq/QueueTest.java
   labs/jbossesb/trunk/plugins/org.jboss.soa.esb.oracle.aq/src/test/java/org/jboss/soa/esb/oracle/aq/QueueXATest.java
Log:
Using the default InitialContext provider, and mockejb for testing.

Modified: labs/jbossesb/trunk/plugins/org.jboss.soa.esb.oracle.aq/pom.xml
===================================================================
--- labs/jbossesb/trunk/plugins/org.jboss.soa.esb.oracle.aq/pom.xml	2007-03-31 06:59:52 UTC (rev 10674)
+++ labs/jbossesb/trunk/plugins/org.jboss.soa.esb.oracle.aq/pom.xml	2007-03-31 08:16:45 UTC (rev 10675)
@@ -1,83 +1,88 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project defaultGoal="package">
-	<modelVersion>4.0.0</modelVersion>
-	<groupId>org.jboss.soa.esb</groupId>
-	<artifactId>org.jboss.soa.esb.oracle.aq</artifactId>
-	<version>4.2.MR2</version>
-	<description>
-		Plugin to add JNDI capability to Oracle AQ
-	</description>
-	<packaging>jar</packaging>
-	<build>
-		<defaultGoal>package</defaultGoal>
-		<plugins>
-			<plugin>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<configuration>
-					<source>1.5</source>
-					<target>1.5</target>
-				</configuration>
-			</plugin>
-			<plugin>
-				<artifactId>maven-jar-plugin</artifactId>
-				<version>2.1</version>
-				<configuration>
-					<archive>
-						<addMavenDescriptor>false</addMavenDescriptor>
-					</archive>
-				</configuration>
-			</plugin>
-			
-			<plugin>
-				<artifactId>maven-clean-plugin</artifactId>
-				<version>2.1</version>
-				<configuration>
-					<filesets>
-						<fileset>
-							<directory>${basedir}/output</directory>
-						</fileset>
-					</filesets>
-				</configuration>
-			</plugin>
-			<plugin>
-				<artifactId>maven-surefire-plugin</artifactId>
-				<version>2.3</version>
-				<configuration>
-					<includes>
-						<include>**/*Test.java</include>
-					</includes>
-				</configuration>
-			</plugin>
-		</plugins>
-	</build>
-	<dependencies>
-		<dependency>
-			<groupId>oracle</groupId>
-			<artifactId>aqapi</artifactId>
-			<version>13</version>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>oracle</groupId>
-			<artifactId>ojdbc</artifactId>
-			<version>14</version>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>commons-logging</groupId>
-			<artifactId>commons-logging</artifactId>
-			<version>1.0.4</version>
-		</dependency>
-		<dependency>
-			<groupId>jboss-messaging-client</groupId>
-			<artifactId>jboss-messaging-client</artifactId>
-			<version>1.2</version>
-			<scope>provided</scope>
-		</dependency>
-		<dependency>
-			<groupId>junit</groupId>
-			<artifactId>junit</artifactId>
-			<version>4.1</version>
-		</dependency>
-	</dependencies>
+<?xml version="1.0" encoding="UTF-8"?><project>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.jboss.soa.esb</groupId>
+  <artifactId>org.jboss.soa.esb.oracle.aq</artifactId>
+  <version>4.2.MR2</version>
+  <description>Plugin to add JNDI capability to Oracle AQ</description>
+  <build>
+    <defaultGoal>package</defaultGoal>
+    <plugins>
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.5</source>
+          <target>1.5</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-jar-plugin</artifactId>
+        <version>2.1</version>
+        <configuration>
+          <archive>
+            <addMavenDescriptor>false</addMavenDescriptor>
+          </archive>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-clean-plugin</artifactId>
+        <version>2.1</version>
+        <configuration>
+          <filesets>
+            <fileset>
+              <directory>${basedir}/output</directory>
+            </fileset>
+          </filesets>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>2.3</version>
+        <configuration>
+          <includes>
+            <include>**/*Test.java</include>
+          </includes>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>oracle</groupId>
+      <artifactId>aqapi</artifactId>
+      <version>13</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>oracle</groupId>
+      <artifactId>ojdbc</artifactId>
+      <version>14</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <version>1.0.4</version>
+    </dependency>
+    <dependency>
+      <groupId>jboss-messaging-client</groupId>
+      <artifactId>jboss-messaging-client</artifactId>
+      <version>1.2</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.1</version>
+    </dependency>
+    <dependency>
+      <groupId>mockejb</groupId>
+      <artifactId>mockejb</artifactId>
+      <version>0.5</version>
+    </dependency>
+    <dependency>
+      <groupId>cglib</groupId>
+      <artifactId>cglib</artifactId>
+      <version>2.1_3</version>
+    </dependency>
+  </dependencies>
 </project>
\ No newline at end of file

Deleted: labs/jbossesb/trunk/plugins/org.jboss.soa.esb.oracle.aq/src/main/java/org/jboss/soa/esb/oracle/aq/AQContext.java
===================================================================
--- labs/jbossesb/trunk/plugins/org.jboss.soa.esb.oracle.aq/src/main/java/org/jboss/soa/esb/oracle/aq/AQContext.java	2007-03-31 06:59:52 UTC (rev 10674)
+++ labs/jbossesb/trunk/plugins/org.jboss.soa.esb.oracle.aq/src/main/java/org/jboss/soa/esb/oracle/aq/AQContext.java	2007-03-31 08:16:45 UTC (rev 10675)
@@ -1,419 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated 
- * by the @authors tag. All rights reserved. 
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors. 
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A 
- * 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,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
- * MA  02110-1301, USA.
- * 
- * (C) 2005-2007,
- * 
- */
-package org.jboss.soa.esb.oracle.aq;
-
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.Map;
-
-import javax.naming.Binding;
-import javax.naming.CompositeName;
-import javax.naming.Context;
-import javax.naming.LinkRef;
-import javax.naming.Name;
-import javax.naming.NameClassPair;
-import javax.naming.NameNotFoundException;
-import javax.naming.NameParser;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.NotContextException;
-import javax.naming.OperationNotSupportedException;
-import javax.naming.Reference;
-import javax.naming.spi.NamingManager;
-
-/**
- * 
- * @author David Fry <dfry at redhat.com>
- * @author Kurt Stam <kurt.stam at jboss.com>
- */
-public class AQContext implements Context, Serializable {
-    private static final long serialVersionUID = 1L;
-    protected static final NameParser nameParser = new NameParserImpl();
-    /** environment for this context */
-    protected final Hashtable<String,Object> environment;  
-    /** bindings at my level */
-    protected final Map<String,Object> bindings;
-    /** all bindings under me */
-    protected final Map<String,Object> treeBindings;
-
-    private boolean frozen = false;
-    private String nameInNamespace = "";
-    public static final String SEPARATOR = "/";
-
-    public AQContext() {
-        this.environment = new Hashtable<String,Object>();
-        this.bindings = new HashMap<String,Object>();
-        this.treeBindings = new HashMap<String,Object>();
-    }
-    
-    @SuppressWarnings("unchecked")
-    public AQContext(Hashtable<?,?> environment)
-    {
-        if (environment == null) {
-            this.environment = new Hashtable<String,Object>();
-        } else {
-            this.environment = (Hashtable<String,Object>)environment;
-        }
-        this.bindings = new HashMap<String,Object>();
-        this.treeBindings = new HashMap<String,Object>();
-    }
-
-    @SuppressWarnings("unchecked")
-    public AQContext(Hashtable<?,?> environment, Map bindings)
-    {
-        if (environment == null) {
-            this.environment = new Hashtable<String,Object>();
-        } else {
-            this.environment = (Hashtable<String,Object>)environment;
-        }
-        this.bindings = bindings;
-        this.treeBindings = new HashMap<String,Object>();
-        frozen = true;
-    }
-
-    public AQContext(Hashtable<String,Object> environment, Map bindings, String nameInNamespace) {
-        this(environment, bindings);
-        this.nameInNamespace = nameInNamespace;
-    }
-
-    protected AQContext(AQContext clone, Hashtable<String,Object> environment) {
-        this.bindings = clone.bindings;
-        this.treeBindings = clone.treeBindings;
-        this.environment = environment;
-    }
-
-    protected AQContext(AQContext clone, Hashtable<String,Object> environment, String nameInNamespace) {
-        this(clone, environment);
-        this.nameInNamespace = nameInNamespace;
-    }
-
-    public void freeze() {
-        frozen = true;
-    }
-
-    boolean isFrozen() {
-        return frozen;
-    }
-
-    /**
-     * internalBind is intended for use only during setup or possibly by suitably synchronized superclasses.
-     * It binds every possible lookup into a map in each context.  To do this, each context
-     * strips off one name segment and if necessary creates a new context for it. Then it asks that context
-     * to bind the remaining name.  It returns a map containing all the bindings from the next context, plus
-     * the context it just created (if it in fact created it). (the names are suitably extended by the segment
-     * originally lopped off).
-     *
-     * @param name
-     * @param value
-     * @return
-     * @throws javax.naming.NamingException
-     */
-    protected Map<String, Object> internalBind(String name, Object value) throws NamingException {
-        assert name != null && name.length() > 0;
-        assert !frozen;
-
-        Map<String,Object> newBindings = new HashMap<String,Object>();
-        int pos = name.indexOf('/');
-        if (pos == -1) {
-            if (treeBindings.put(name, value) != null) {
-                throw new NamingException("Something already bound at " + name);
-            }
-            bindings.put(name, value);
-            newBindings.put(name, value);
-        }
-        else {
-            String segment = name.substring(0, pos);
-            assert segment != null;
-            assert !segment.equals("");
-            Object o = treeBindings.get(segment);
-            if (o == null) {
-                o = newContext();
-                treeBindings.put(segment, o);
-                bindings.put(segment, o);
-                newBindings.put(segment, o);
-            }
-            else if (!(o instanceof AQContext)) {
-                throw new NamingException("Something already bound where a subcontext should go");
-            }
-            AQContext readOnlyContext = (AQContext) o;
-            String remainder = name.substring(pos + 1);
-            Map<String, Object> subBindings = readOnlyContext.internalBind(remainder, value);
-            for (Iterator iterator = subBindings.entrySet().iterator(); iterator.hasNext();) {
-                Map.Entry entry = (Map.Entry) iterator.next();
-                String subName = segment + "/" + (String) entry.getKey();
-                Object bound = entry.getValue();
-                treeBindings.put(subName, bound);
-                newBindings.put(subName, bound);
-            }
-        }
-        return newBindings;
-    }
-
-    protected AQContext newContext() {
-        return new AQContext();
-    }
-
-    public Object addToEnvironment(String propName, Object propVal) throws NamingException {
-        return environment.put(propName, propVal);
-    }
-
-    @SuppressWarnings("unchecked")
-    public Hashtable<String,Object> getEnvironment() throws NamingException {
-        return (Hashtable<String,Object>) environment.clone();
-    }
-
-    public Object removeFromEnvironment(String propName) throws NamingException {
-        return environment.remove(propName);
-    }
-
-    public Object lookup(String name) throws NamingException {
-        if (name.length() == 0) {
-            return this;
-        }
-        Object result = treeBindings.get(name);
-        if (result == null) {
-            result = bindings.get(name);
-        }
-        if (result == null) {
-            int pos = name.indexOf(':');
-            if (pos > 0) {
-                String scheme = name.substring(0, pos);
-                Context ctx = NamingManager.getURLContext(scheme, environment);
-                if (ctx == null) {
-                    throw new NamingException("scheme " + scheme + " not recognized");
-                }
-                return ctx.lookup(name);
-            }
-            else {
-                // Split out the first name of the path
-                // and look for it in the bindings map.
-                CompositeName path = new CompositeName(name);
-
-                if (path.size() == 0) {
-                    return this;
-                }
-                else {
-                    String first = path.get(0);
-                    Object obj = bindings.get(first);
-                    if (obj == null) {
-                        throw new NameNotFoundException(name);
-                    }
-                    else if (obj instanceof AQContext && path.size() > 1) {
-                        AQContext subContext = (AQContext) obj;
-                        obj = subContext.lookup(path.getSuffix(1));
-                    }
-                    return obj;
-                }
-            }
-        }
-        if (result instanceof LinkRef) {
-            LinkRef ref = (LinkRef) result;
-            result = lookup(ref.getLinkName());
-        }
-        if (result instanceof Reference) {
-            try {
-                result = NamingManager.getObjectInstance(result, null, null, this.environment);
-            }
-            catch (NamingException e) {
-                throw e;
-            }
-            catch (Exception e) {
-                throw (NamingException) new NamingException("could not look up : " + name).initCause(e);
-            }
-        }
-        if (result instanceof AQContext) {
-            String prefix = getNameInNamespace();
-            if (prefix.length() > 0) {
-                prefix = prefix + SEPARATOR;
-            }
-            result = new AQContext((AQContext) result, environment, prefix + name);
-        }
-        return result;
-    }
-
-    public Object lookup(Name name) throws NamingException {
-        return lookup(name.toString());
-    }
-
-    public Object lookupLink(String name) throws NamingException {
-        return lookup(name);
-    }
-
-    public Name composeName(Name name, Name prefix) throws NamingException {
-        Name result = (Name) prefix.clone();
-        result.addAll(name);
-        return result;
-    }
-
-    public String composeName(String name, String prefix) throws NamingException {
-        CompositeName result = new CompositeName(prefix);
-        result.addAll(new CompositeName(name));
-        return result.toString();
-    }
-
-    @SuppressWarnings("unchecked")
-    public NamingEnumeration<NameClassPair> list(String name) throws NamingException {
-        Object o = lookup(name);
-        if (o == this) {
-            return (NamingEnumeration<NameClassPair>)new ListEnumeration();
-        }
-        else if (o instanceof AQContext) {
-            return ((AQContext) o).list("");
-        }
-        else {
-            throw new NotContextException();
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    public NamingEnumeration<Binding> listBindings(String name) throws NamingException {
-        Object o = lookup(name);
-        if (o == this) {
-            return (NamingEnumeration<Binding>)new ListBindingEnumeration();
-        }
-        else if (o instanceof AQContext) {
-            return ((AQContext) o).listBindings("");
-        }
-        else {
-            throw new NotContextException();
-        }
-    }
-
-    public Object lookupLink(Name name) throws NamingException {
-        return lookupLink(name.toString());
-    }
-
-    public NamingEnumeration<NameClassPair> list(Name name) throws NamingException {
-        return list(name.toString());
-    }
-
-    public NamingEnumeration<Binding> listBindings(Name name) throws NamingException {
-        return listBindings(name.toString());
-    }
-
-    public void bind(Name name, Object obj) throws NamingException {
-        throw new OperationNotSupportedException();
-    }
-
-    public void bind(String name, Object obj) throws NamingException {
-        throw new OperationNotSupportedException();
-    }
-
-    public void close() throws NamingException {
-        // ignore
-    }
-
-    public AQContext createSubcontext(Name name) throws NamingException {
-        throw new OperationNotSupportedException();
-    }
-
-    public AQContext createSubcontext(String name) throws NamingException {
-        throw new OperationNotSupportedException();
-    }
-
-    public void destroySubcontext(Name name) throws NamingException {
-        throw new OperationNotSupportedException();
-    }
-
-    public void destroySubcontext(String name) throws NamingException {
-        throw new OperationNotSupportedException();
-    }
-
-    public String getNameInNamespace() throws NamingException {
-        return nameInNamespace;
-    }
-
-    public NameParser getNameParser(Name name) throws NamingException {
-        return nameParser;
-    }
-
-    public NameParser getNameParser(String name) throws NamingException {
-        return nameParser;
-    }
-
-    public void rebind(Name name, Object obj) throws NamingException {
-        throw new OperationNotSupportedException();
-    }
-
-    public void rebind(String name, Object obj) throws NamingException {
-        throw new OperationNotSupportedException();
-    }
-
-    public void rename(Name oldName, Name newName) throws NamingException {
-        throw new OperationNotSupportedException();
-    }
-
-    public void rename(String oldName, String newName) throws NamingException {
-        throw new OperationNotSupportedException();
-    }
-
-    public void unbind(Name name) throws NamingException {
-        throw new OperationNotSupportedException();
-    }
-
-    public void unbind(String name) throws NamingException {
-        throw new OperationNotSupportedException();
-    }
-
-    private abstract class LocalNamingEnumeration<T> implements NamingEnumeration<T> {
-        private Iterator i = bindings.entrySet().iterator();
-
-        public boolean hasMore() throws NamingException {
-            return i.hasNext();
-        }
-
-        public boolean hasMoreElements() {
-            return i.hasNext();
-        }
-
-        protected Map.Entry getNext() {
-            return (Map.Entry) i.next();
-        }
-
-        public void close() throws NamingException {
-        }
-    }
-
-    private class ListEnumeration<T> extends LocalNamingEnumeration  {
-        public NameClassPair next() throws NamingException {
-            return nextElement();
-        }
-
-        public NameClassPair nextElement() {
-            Map.Entry entry = getNext();
-            return new NameClassPair((String) entry.getKey(), entry.getValue().getClass().getName());
-        }
-    }
-
-    private class ListBindingEnumeration<T> extends LocalNamingEnumeration {
-        public NameClassPair next() throws NamingException {
-            return nextElement();
-        }
-
-        public NameClassPair nextElement() {
-            Map.Entry entry = getNext();
-            return new Binding((String) entry.getKey(), entry.getValue());
-        }
-    }
-}
\ No newline at end of file

Modified: labs/jbossesb/trunk/plugins/org.jboss.soa.esb.oracle.aq/src/main/java/org/jboss/soa/esb/oracle/aq/AQInitialContextFactory.java
===================================================================
--- labs/jbossesb/trunk/plugins/org.jboss.soa.esb.oracle.aq/src/main/java/org/jboss/soa/esb/oracle/aq/AQInitialContextFactory.java	2007-03-31 06:59:52 UTC (rev 10674)
+++ labs/jbossesb/trunk/plugins/org.jboss.soa.esb.oracle.aq/src/main/java/org/jboss/soa/esb/oracle/aq/AQInitialContextFactory.java	2007-03-31 08:16:45 UTC (rev 10675)
@@ -41,6 +41,7 @@
 import javax.jms.XAQueueConnectionFactory;
 import javax.jms.XATopicConnectionFactory;
 import javax.naming.Context;
+import javax.naming.InitialContext;
 import javax.naming.NamingException;
 import javax.naming.spi.InitialContextFactory;
 import javax.sql.DataSource;
@@ -98,7 +99,7 @@
     protected int aqServerPortNumber = 1521;
 
 
-    private void createDestinationContext(Map<String, Object> data) throws RuntimeException {
+    private void addAQDestinationContext(Context context) throws NamingException {
 
         // lookup and cache the queues
         QueueConnectionFactory queueFactory;
@@ -122,30 +123,30 @@
             }
 
             XAConnectionFactory factory = AQjmsFactory.getXAConnectionFactory(xaDs);
-            data.put(XA_CONNECTION_FACTORY, factory);
+            context.bind(XA_CONNECTION_FACTORY, factory);
 
             // create the connection factory
             ConnectionFactory connectionFactory = AQjmsFactory.getConnectionFactory(ds);
-            data.put(CONNECTION_FACTORY, connectionFactory);
+            context.bind(CONNECTION_FACTORY, connectionFactory);
 
             // create the queue connection factory
             queueFactory = AQjmsFactory.getQueueConnectionFactory(ds);
-            data.put(QUEUE_CONNECTION_FACTORY, queueFactory);
+            context.bind(QUEUE_CONNECTION_FACTORY, queueFactory);
             queueConnection = queueFactory.createQueueConnection();
             session = (AQjmsSession) queueConnection.createQueueSession(false,
                     Session.AUTO_ACKNOWLEDGE);
 
             // create the queue XA connection factory
             XAQueueConnectionFactory xaQueueConnectionFactory = AQjmsFactory.getXAQueueConnectionFactory(xaDs);
-            data.put(XA_QUEUE_CONNECTION_FACTORY, xaQueueConnectionFactory);
+            context.bind(XA_QUEUE_CONNECTION_FACTORY, xaQueueConnectionFactory);
             
 //          create the topic XA connection factory
             XATopicConnectionFactory xaTopicConnectionFactory = AQjmsFactory.getXATopicConnectionFactory(xaDs);
-            data.put(XA_TOPIC_CONNECTION_FACTORY, xaTopicConnectionFactory);
+            context.bind(XA_TOPIC_CONNECTION_FACTORY, xaTopicConnectionFactory);
             
             // create the topic connection factory
             topicFactory = AQjmsFactory.getTopicConnectionFactory(ds);
-            data.put(TOPIC_CONNECTION_FACTORY, topicFactory);
+            context.bind(TOPIC_CONNECTION_FACTORY, topicFactory);
             topicConnection = topicFactory.createTopicConnection();
             session = (AQjmsSession) topicConnection.createTopicSession(false,
                     Session.AUTO_ACKNOWLEDGE);
@@ -156,7 +157,7 @@
                 DestinationInfo di = iter.next();
                 if(log.isDebugEnabled()) log.debug("Loading Destination: " + di);
                 // register normal queue
-                registerDestination(data, session, di);
+                registerDestination(context, session, di);
             }
         } catch (JMSException e) {
             log.error("JMSException exception", e);
@@ -175,7 +176,7 @@
         }
     }
 
-    private void registerDestination(Map<String, Object> data, AQjmsSession session, DestinationInfo di) {
+    private void registerDestination(Context context, AQjmsSession session, DestinationInfo di) {
         if (di == null) {
             log.warn("Warning: registerDestination called with null DestinationInfo.");
             return;
@@ -190,9 +191,9 @@
             }
 
             // place in context
-            data.put(di.getQueueName(), destination);
+            context.bind(di.getQueueName(), destination);
             // data.put(QUEUE_PREFIX + aqQueueName, destination);
-        } catch (JMSException e) {
+        } catch (Exception e) {
             // we want to eat any exceptions associated with looking up
             // the queues from the database
             log.warn("Warning.  Error while looking up destination: " + e);
@@ -217,10 +218,11 @@
 
     @SuppressWarnings("unused")
     public Context getInitialContext(Hashtable<?,?> environment) throws NamingException {
-            Map<String, Object> data = new ConcurrentHashMap<String, Object>();
-            init(environment);
-            createDestinationContext(data);
-            return new AQContext(environment, data);
+        init(environment);
+        Hashtable<String, Object> data = new Hashtable<String, Object>();
+        Context context = new InitialContext();
+        addAQDestinationContext(context);
+        return context;
     }
 
 

Modified: labs/jbossesb/trunk/plugins/org.jboss.soa.esb.oracle.aq/src/test/java/org/jboss/soa/esb/oracle/aq/QueueTest.java
===================================================================
--- labs/jbossesb/trunk/plugins/org.jboss.soa.esb.oracle.aq/src/test/java/org/jboss/soa/esb/oracle/aq/QueueTest.java	2007-03-31 06:59:52 UTC (rev 10674)
+++ labs/jbossesb/trunk/plugins/org.jboss.soa.esb.oracle.aq/src/test/java/org/jboss/soa/esb/oracle/aq/QueueTest.java	2007-03-31 08:16:45 UTC (rev 10675)
@@ -32,6 +32,7 @@
 
 import org.junit.Before;
 import org.junit.Test;
+import org.mockejb.jndi.MockContextFactory;
 
 /**
  * @author kstam
@@ -163,6 +164,7 @@
             env.put(AQInitialContextFactory.DB_SCHEMA, schema);
             env.put(AQInitialContextFactory.DB_DRIVER, driver);
             
+            MockContextFactory.setAsInitial();
             AQInitialContextFactory factory = new AQInitialContextFactory();
             Context context = factory.getInitialContext(env);
             QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) 
@@ -217,6 +219,7 @@
             properties.put(AQInitialContextFactory.DB_PASSWD, password);
             properties.put(AQInitialContextFactory.DB_SCHEMA, schema);
             properties.put(AQInitialContextFactory.DB_DRIVER, driver);
+            MockContextFactory.setAsInitial();
             Context context = new InitialContext(properties);
             QueueConnectionFactory queueConnectionFactory = (QueueConnectionFactory) 
                 context.lookup(AQInitialContextFactory.QUEUE_CONNECTION_FACTORY);

Modified: labs/jbossesb/trunk/plugins/org.jboss.soa.esb.oracle.aq/src/test/java/org/jboss/soa/esb/oracle/aq/QueueXATest.java
===================================================================
--- labs/jbossesb/trunk/plugins/org.jboss.soa.esb.oracle.aq/src/test/java/org/jboss/soa/esb/oracle/aq/QueueXATest.java	2007-03-31 06:59:52 UTC (rev 10674)
+++ labs/jbossesb/trunk/plugins/org.jboss.soa.esb.oracle.aq/src/test/java/org/jboss/soa/esb/oracle/aq/QueueXATest.java	2007-03-31 08:16:45 UTC (rev 10675)
@@ -33,6 +33,7 @@
 
 import org.junit.Before;
 import org.junit.Test;
+import org.mockejb.jndi.MockContextFactory;
 
 /**
  * @author kstam
@@ -163,7 +164,7 @@
             env.put(AQInitialContextFactory.DB_PASSWD, password);
             env.put(AQInitialContextFactory.DB_SCHEMA, schema);
             env.put(AQInitialContextFactory.DB_DRIVER, driver);
-            
+            MockContextFactory.setAsInitial();
             AQInitialContextFactory factory = new AQInitialContextFactory();
             Context context = factory.getInitialContext(env);
             XAQueueConnectionFactory queueConnectionFactory = (XAQueueConnectionFactory) 
@@ -218,6 +219,7 @@
             properties.put(AQInitialContextFactory.DB_PASSWD, password);
             properties.put(AQInitialContextFactory.DB_SCHEMA, schema);
             properties.put(AQInitialContextFactory.DB_DRIVER, driver);
+            MockContextFactory.setAsInitial();
             Context context = new InitialContext(properties);
             XAQueueConnectionFactory xaQueueConnectionFactory = (XAQueueConnectionFactory) 
                 context.lookup(AQInitialContextFactory.XA_QUEUE_CONNECTION_FACTORY);




More information about the jboss-svn-commits mailing list