[jboss-cvs] JBossAS SVN: r79262 - in projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/jndiregistrar: unit and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Oct 8 07:03:24 EDT 2008
Author: ALRubinger
Date: 2008-10-08 07:03:24 -0400 (Wed, 08 Oct 2008)
New Revision: 79262
Added:
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/jndiregistrar/ClientBindUrlBindingTest.java
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/jndiregistrar/ClientBindUrlTestBean.java
Modified:
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/jndiregistrar/unit/JNDIBindingTestCase.java
Log:
[EJBTHREE-1515] Add Unit Tests to ensure clientBindUrl is honored per binding
Added: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/jndiregistrar/ClientBindUrlBindingTest.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/jndiregistrar/ClientBindUrlBindingTest.java (rev 0)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/jndiregistrar/ClientBindUrlBindingTest.java 2008-10-08 11:03:24 UTC (rev 79262)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.ejb3.test.proxy.jndiregistrar;
+
+/**
+ * ClientBindUrlBindingTest
+ *
+ * Remote Business Interface defining two client bind URLs
+ * to be used in the Remoting InvokerLocator
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public interface ClientBindUrlBindingTest extends BindingTest
+{
+ /*
+ * Define some overridden clientBindUrls
+ */
+ String CLIENT_BIND_URL_1 = "socket://localhost:3873";
+
+ String CLIENT_BIND_URL_2 = "socket://127.0.0.1:3873";
+
+ /*
+ * Define the JNDI Bindings
+ */
+
+ String JNDI_BINDING_1 = "JndiBinding1";
+
+ String JNDI_BINDING_2 = "JndiBinding2";
+
+}
Added: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/jndiregistrar/ClientBindUrlTestBean.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/jndiregistrar/ClientBindUrlTestBean.java (rev 0)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/jndiregistrar/ClientBindUrlTestBean.java 2008-10-08 11:03:24 UTC (rev 79262)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.ejb3.test.proxy.jndiregistrar;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+import org.jboss.ejb3.annotation.LocalBinding;
+import org.jboss.ejb3.annotation.RemoteBinding;
+import org.jboss.ejb3.annotation.RemoteBindings;
+
+/**
+ * ClientBindUrlTestBean
+ *
+ * Tests EJB for alternate clientBindUrls
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+ at Stateless
+ at Remote(ClientBindUrlBindingTest.class)
+ at RemoteBindings(
+{
+ @RemoteBinding(jndiBinding = ClientBindUrlBindingTest.JNDI_BINDING_1, clientBindUrl = ClientBindUrlBindingTest.CLIENT_BIND_URL_1),
+ @RemoteBinding(jndiBinding = ClientBindUrlBindingTest.JNDI_BINDING_2, clientBindUrl = ClientBindUrlBindingTest.CLIENT_BIND_URL_2)})
+ at LocalBinding(jndiBinding = LocalJndiBindingTest.JNDI_BINDING)
+public class ClientBindUrlTestBean extends JndiBindingTestBeanBase implements ClientBindUrlBindingTest
+{
+
+}
Modified: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/jndiregistrar/unit/JNDIBindingTestCase.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/jndiregistrar/unit/JNDIBindingTestCase.java 2008-10-08 10:35:02 UTC (rev 79261)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/jndiregistrar/unit/JNDIBindingTestCase.java 2008-10-08 11:03:24 UTC (rev 79262)
@@ -26,6 +26,7 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import java.lang.reflect.Proxy;
import java.net.URL;
import java.util.HashSet;
import java.util.Iterator;
@@ -47,6 +48,7 @@
import org.jboss.ejb3.common.registrar.plugin.mc.Ejb3McRegistrar;
import org.jboss.ejb3.common.registrar.spi.Ejb3RegistrarLocator;
import org.jboss.ejb3.common.registrar.spi.NotBoundException;
+import org.jboss.ejb3.proxy.handler.session.stateless.StatelessRemoteProxyInvocationHandler;
import org.jboss.ejb3.proxy.jndiregistrar.JndiSessionRegistrarBase;
import org.jboss.ejb3.proxy.jndiregistrar.JndiStatelessSessionRegistrar;
import org.jboss.ejb3.test.mc.bootstrap.EmbeddedTestMcBootstrap;
@@ -71,6 +73,8 @@
import org.jboss.ejb3.test.proxy.common.ejb.slsb.MyStatelessRemote;
import org.jboss.ejb3.test.proxy.common.ejb.slsb.MyStatelessRemoteHome;
import org.jboss.ejb3.test.proxy.jndiregistrar.BindingTest;
+import org.jboss.ejb3.test.proxy.jndiregistrar.ClientBindUrlBindingTest;
+import org.jboss.ejb3.test.proxy.jndiregistrar.ClientBindUrlTestBean;
import org.jboss.ejb3.test.proxy.jndiregistrar.JndiBindingTestBean;
import org.jboss.ejb3.test.proxy.jndiregistrar.LocalJndiBindingTest;
import org.jboss.ejb3.test.proxy.jndiregistrar.RemoteJndiBindingTest;
@@ -91,8 +95,8 @@
* Tests for verifying that the EJB proxies are bound correctly to the JNDI
* and also unbound properly on undeploying the bean.
*
- *
* @author Jaikiran Pai
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
* @version $Revision: $
*/
public class JNDIBindingTestCase
@@ -234,7 +238,59 @@
// Unbind and test
this.unbindAndTest(context, this.sessionContainer);
}
+
+ /**
+ * Ensures that bindings at N Remote Locations, each with separate
+ * clientBindUrls, have the proper URL for the InvokerLocator
+ *
+ * EJBTHREE-1515
+ */
+ @Test
+ public void testExplicitClientBindUrls() throws Throwable
+ {
+ // Create and bind the bean into JNDI
+ this.sessionContainer = Utils.createSlsb(ClientBindUrlTestBean.class);
+ Ejb3RegistrarLocator.locateRegistrar().bind(this.sessionContainer.getName(), this.sessionContainer);
+ // Get a JNDI Context
+ Context context = new InitialContext(); // Props from jndi.properties on Client CP
+
+ /*
+ * Test Location 1
+ */
+
+ // Lookup
+ Object obj1 = context.lookup(ClientBindUrlBindingTest.JNDI_BINDING_1);
+
+ // Get the underlying URL
+ StatelessRemoteProxyInvocationHandler handler1 = (StatelessRemoteProxyInvocationHandler)Proxy.getInvocationHandler(obj1);
+ String url1 = handler1.getUrl();
+
+ // Test
+ TestCase.assertEquals(ClientBindUrlBindingTest.CLIENT_BIND_URL_1, url1);
+
+ /*
+ * Test Location 2
+ */
+
+ // Lookup
+ Object obj2 = context.lookup(ClientBindUrlBindingTest.JNDI_BINDING_2);
+
+ // Get the underlying URL
+ StatelessRemoteProxyInvocationHandler handler2 = (StatelessRemoteProxyInvocationHandler)Proxy.getInvocationHandler(obj2);
+ String url2 = handler2.getUrl();
+
+ // Test
+ TestCase.assertEquals(ClientBindUrlBindingTest.CLIENT_BIND_URL_2, url2);
+
+ /*
+ * Cleanup
+ */
+
+ // Unbind and test
+ this.unbindAndTest(context, this.sessionContainer);
+ }
+
/**
* Ensures that an alternate local binding is made and may
* be invoked upon, and that all associated bindings are cleansed
More information about the jboss-cvs-commits
mailing list