1 17 package org.apache.geronimo.j2ee.deployment; 18 19 import java.net.URI ; 20 21 import javax.management.ObjectName ; 22 import javax.naming.Reference ; 23 24 import junit.framework.TestCase; 25 import org.apache.geronimo.common.DeploymentException; 26 import org.apache.geronimo.gbean.AbstractName; 27 import org.apache.geronimo.gbean.AbstractNameQuery; 28 import org.apache.geronimo.gbean.GBeanData; 29 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory; 30 import org.apache.geronimo.kernel.Jsr77Naming; 31 import org.apache.geronimo.kernel.Naming; 32 import org.apache.geronimo.kernel.config.Configuration; 33 import org.apache.geronimo.kernel.repository.Artifact; 34 35 38 public class EJBRefContextTest extends TestCase { 39 private final String coffee = "some/path/coffee.jar"; 40 private final String language = "some/where/language.jar"; 41 private final String car = "foo/bar/car.jar"; 42 43 private AbstractName coffee_peaberry; 44 private AbstractName coffee_java; 45 46 private AbstractName language_lisp; 47 private AbstractName language_java; 48 49 private AbstractName car_enzo; 50 51 private Configuration configuration; 52 53 public void testNothing() throws Exception {} 54 55 protected void setUp() throws Exception { 161 super.setUp(); 162 163 Naming naming = new Jsr77Naming(); 164 AbstractName applicationName = naming.createRootName(new Artifact("test", "stuff", "", "ear"), "app", NameFactory.J2EE_APPLICATION) ; 165 166 167 AbstractName coffeeName = naming.createChildName(applicationName, coffee, NameFactory.EJB_MODULE); 168 coffee_peaberry = naming.createChildName(coffeeName, "peaberry", NameFactory.STATELESS_SESSION_BEAN); 169 coffee_java = naming.createChildName(coffeeName, "java", NameFactory.STATELESS_SESSION_BEAN); 170 171 AbstractName languageName = naming.createChildName(applicationName, language, NameFactory.EJB_MODULE); 172 language_lisp = naming.createChildName(languageName, "lisp", NameFactory.STATELESS_SESSION_BEAN); 173 language_java = naming.createChildName(languageName, "java", NameFactory.STATELESS_SESSION_BEAN); 174 175 AbstractName carName = naming.createChildName(applicationName, car, NameFactory.EJB_MODULE); 176 AbstractName car_gt = naming.createChildName(carName, "gt", NameFactory.STATELESS_SESSION_BEAN); 177 car_enzo = naming.createChildName(carName, "enzo", NameFactory.STATELESS_SESSION_BEAN); 178 179 } 189 190 201 private void assertReferenceEqual(AbstractName expected, Reference reference) { 202 FakeReference fakeReference = (FakeReference) reference; 203 String containerId = null; 204 if (fakeReference != null) { 205 containerId = fakeReference.containerId; 206 } 207 assertEquals(expected.toURI().toString(), containerId); 208 } 209 218 private class FakeReference extends Reference { 219 private String containerId; 220 221 public FakeReference(String containerId) { 222 super(null); 223 this.containerId = containerId; 224 } 225 } 226 227 private static class MockActivationSpecInfoLocator implements ActivationSpecInfoLocator { 228 public Reference createResourceRef(AbstractNameQuery containerId, Class iface, Configuration configuration) { 229 return null; 230 } 231 232 public Reference createAdminObjectRef(AbstractNameQuery containerId, Class iface, Configuration configuration) { 233 return null; 234 } 235 236 public ObjectName locateResourceName(ObjectName query) { 237 return null; 238 } 239 240 public GBeanData locateActivationSpecInfo(AbstractNameQuery nameQuery, String messageListenerInterface, Configuration configuration) { 241 return null; 242 } 243 244 public GBeanData locateResourceAdapterGBeanData(GBeanData resourceAdapterModuleData) { 245 return null; 246 } 247 248 public GBeanData locateAdminObjectInfo(GBeanData resourceAdapterModuleData, String adminObjectInterfaceName) { 249 return null; 250 } 251 252 public GBeanData locateConnectionFactoryInfo(GBeanData resourceAdapterModuleData, String connectionFactoryInterfaceName) { 253 return null; 254 } 255 } 256 257 } 258 | Popular Tags |