1 22 package org.objectweb.petals.jbi.registry; 23 24 import java.lang.reflect.Method ; 25 import java.util.List ; 26 27 import javax.jbi.JBIException; 28 import javax.naming.Context ; 29 import javax.naming.InitialContext ; 30 import javax.naming.LinkRef ; 31 import javax.naming.Name ; 32 import javax.naming.NameClassPair ; 33 import javax.naming.NamingException ; 34 import javax.xml.namespace.QName ; 35 36 import junit.framework.TestCase; 37 38 import org.easymock.classextension.EasyMock; 39 import org.objectweb.fractal.api.control.IllegalLifeCycleException; 40 import org.objectweb.petals.jbi.registry.mock.MockContext; 41 import org.objectweb.petals.jbi.registry.mock.MockInitialContext; 42 import org.objectweb.petals.jbi.registry.mock.MockLinkRef; 43 import org.objectweb.petals.kernel.registry.jndi.NamingEnumerationImpl; 44 import org.objectweb.petals.util.LoggingUtil; 45 import org.objectweb.petals.util.NamingHelper; 46 import org.objectweb.util.monolog.api.Logger; 47 48 53 public class JNDIRegistryTest extends TestCase { 54 55 private MockContext endpointsContext = new MockContext(); 56 57 private MockContext interfacesContext = new MockContext(); 58 59 private MockContext newEndpointContext = new MockContext(); 60 61 private JNDIRegistry registry; 62 63 private MockInitialContext rootContext; 64 65 private MockContext servicesContext = new MockContext(); 66 67 public void setUp() throws NamingException { 68 registry = new JNDIRegistry(); 69 rootContext = new MockInitialContext(); 70 71 rootContext.bind(JNDIRegistry.ENDPOINTS_REF, endpointsContext); 72 rootContext.bind(JNDIRegistry.INTERFACES_REF, interfacesContext); 73 rootContext.bind(JNDIRegistry.NEW_ENDPOINTS_REF, newEndpointContext); 74 rootContext.bind(JNDIRegistry.SERVICES_REF, servicesContext); 75 76 registry.rootContext = rootContext; 77 78 Logger logger = EasyMock.createMock(Logger.class); 79 registry.logger = logger; 80 registry.log = EasyMock.createMock(LoggingUtil.class); 81 82 registry.endpointsContext = endpointsContext; 83 registry.interfacesContext = interfacesContext; 84 registry.newEndpointContext = newEndpointContext; 85 registry.servicesContext = servicesContext; 86 } 87 88 public void testDeregisterConnection() throws RegistryException { 89 LinkedEndpoint linkedEndpoint = new LinkedEndpoint(new QName ("serv"), 90 "endpoint", new QName ("toserv"), "endpoint", null); 91 InternalEndpoint internalEndpoint = new InternalEndpoint(new QName ( 92 "toserv"), "endpoint", "compo", "0", null); 93 endpointsContext.getBindings().put("endpoint", internalEndpoint); 94 registry.registerConnection(linkedEndpoint); 95 registry.deregisterConnection(linkedEndpoint); 96 assertEquals(interfacesContext.getBindings().size(), 0); 97 } 98 99 public void testDeregisterConnectionWithInterfaces() 100 throws RegistryException { 101 LinkedEndpoint linkedEndpoint = new LinkedEndpoint(new QName ("inter"), 102 new QName ("toserv"), "endpoint", null); 103 InternalEndpoint internalEndpoint = new InternalEndpoint(new QName ( 104 "toserv"), "endpoint", "compo", "0", null); 105 internalEndpoint.setInterfaces(new QName [] {new QName ("test")}); 106 endpointsContext.getBindings().put("endpoint", internalEndpoint); 107 registry.registerConnection(linkedEndpoint); 108 registry.deregisterConnection(linkedEndpoint); 109 assertEquals(interfacesContext.getBindings().size(), 0); 110 } 111 112 public void testDeregisterConnectionExceptionNull() { 113 try { 114 registry.deregisterConnection(null); 115 fail(); 116 } catch (Exception e) { 117 } 119 } 120 121 public void testDeregisterConnectionWithInterfacesStillNewEndpoints() 122 throws RegistryException { 123 LinkedEndpoint linkedEndpoint = new LinkedEndpoint(new QName ("inter"), 124 new QName ("toserv"), "endpoint", null); 125 InternalEndpoint internalEndpoint = new InternalEndpoint(new QName ( 126 "toserv"), "endpoint", "compo", "0", null); 127 endpointsContext.getBindings().put("endpoint", internalEndpoint); 128 newEndpointContext.getBindings().put("endpoint", internalEndpoint); 129 registry.registerConnection(linkedEndpoint); 130 registry.deregisterConnection(linkedEndpoint); 131 assertEquals(interfacesContext.getBindings().size(), 1); 132 assertEquals(((MockContext) interfacesContext.getBindings() 133 .get("inter")).getBindings().size(), 0); 134 } 135 136 public void testDeregisterConnectionWithInterfacesNotRegistered() 137 throws RegistryException { 138 LinkedEndpoint linkedEndpoint = new LinkedEndpoint(new QName ("inter"), 139 new QName ("toserv"), "endpoint", null); 140 try { 141 registry.deregisterConnection(linkedEndpoint); 142 fail(); 143 } catch (Exception e) { 144 } 146 } 147 148 public void testDeregisterExternalEndpoint() throws JBIException, 149 NamingException { 150 AbstractEndpoint endpoint = new InternalEndpoint(new QName ("test"), 151 "endpoint", "axis2bc", "0", null); 152 testRegisterInternalEndpoint(); 153 registry.deregisterExternalEndpoint(endpoint); 154 assertEquals(endpointsContext.getBindings().size(), 0); 155 } 156 157 public void testDeregisterExternalEndpointException() { 158 try { 159 registry.deregisterExternalEndpoint(null); 160 fail(); 161 } catch (Exception e) { 162 } 164 } 165 166 public void testDeregisterInternalEndpoint() throws JBIException, 167 NamingException { 168 AbstractEndpoint endpoint = new InternalEndpoint(new QName ("test"), 169 "endpoint", "axis2bc", "0", null); 170 testRegisterInternalEndpoint(); 171 registry.deregisterInternalEndpoint(endpoint); 172 assertEquals(endpointsContext.getBindings().size(), 0); 173 } 174 175 public void testDeregisterInternalEndpointException() { 176 InternalEndpoint internalEndpoint = new InternalEndpoint(new QName ( 177 "serv"), "endpoint", "compo", "0", null); 178 try { 179 registry.deregisterInternalEndpoint(internalEndpoint); 180 fail(); 181 } catch (Exception e) { 182 } 184 } 185 186 public void testDeregisterInternalEndpointExceptionInterface() 187 throws RegistryException, NamingException { 188 AbstractEndpoint endpoint = new InternalEndpoint(new QName ("test"), 189 "endpoint", "axis2bc", "0", null); 190 endpoint.setInterfaces(new QName [] {new QName ("foo")}); 191 registry.registerInternalEndpoint(endpoint); 192 MockContext context = new MockContext(); 193 interfacesContext.bind("inter", context); 194 MockLinkRef linkRef = new MockLinkRef("endpoint"); 195 linkRef.setClassName(InternalEndpoint.class.getName()); 196 context.bind("endpoint", linkRef); 197 try { 198 registry.deregisterInternalEndpoint(endpoint); 199 fail(); 200 } catch (Exception e) { 201 } 203 } 204 205 public void testDeregisterInternalEndpointExceptionNull() { 206 try { 207 registry.deregisterInternalEndpoint(null); 208 fail(); 209 } catch (Exception e) { 210 } 212 } 213 214 public void testDeregisterInternalEndpointExceptionService() 215 throws RegistryException { 216 AbstractEndpoint endpoint = new InternalEndpoint(new QName ("test"), 217 "endpoint", "axis2bc", "0", null); 218 registry.registerInternalEndpoint(endpoint); 219 servicesContext.getBindings().clear(); 220 try { 221 registry.deregisterInternalEndpoint(endpoint); 222 fail(); 223 } catch (Exception e) { 224 } 226 } 227 228 public void testDeregisterInternalEndpointWithInterfaces() 229 throws JBIException, NamingException { 230 AbstractEndpoint endpoint = new InternalEndpoint(new QName ("test"), 231 "endpoint", "axis2bc", "0", null); 232 endpoint.setInterfaces(new QName [] {new QName ("inter")}); 233 registry.registerInternalEndpoint(endpoint); 234 MockContext context = new MockContext(); 235 interfacesContext.bind("inter", context); 236 MockLinkRef linkRef = new MockLinkRef("endpoint"); 237 linkRef.setClassName(InternalEndpoint.class.getName()); 238 context.bind("endpoint", linkRef); 239 registry.deregisterInternalEndpoint(endpoint); 240 assertEquals(endpointsContext.getBindings().size(), 0); 241 } 242 243 public void testGetExternalEndpoint() throws JBIException, NamingException { 244 InternalEndpoint internalEndpoint = new InternalEndpoint(new QName ( 245 "service"), "endpoint", "compo", "0", null); 246 ExternalEndpoint externalEndpoint = new ExternalEndpoint( 247 internalEndpoint, "compo", "0"); 248 endpointsContext.getBindings().put("endpoint", externalEndpoint); 249 AbstractEndpoint endpoint = registry.getExternalEndpoint(new QName ( 250 "test"), "endpoint"); 251 assertEquals(endpoint.containerName, "0"); 252 } 253 254 public void testGetExternalEndpointsForInterface() throws JBIException, 255 NamingException { 256 ExternalEndpoint externalEndpoint = new ExternalEndpoint( 257 new ConsumerEndpoint("compo", "0"), "compo", "0"); 258 rootContext.bind("test-link", externalEndpoint); 259 MockContext context = (MockContext) interfacesContext 260 .createSubcontext("test"); 261 MockLinkRef linkRef = new MockLinkRef("test-link"); 262 linkRef.setClassName(ExternalEndpoint.class.getName()); 263 context.bind("inter1", linkRef); 264 AbstractEndpoint[] endpoints = registry 265 .getExternalEndpointsForInterface(new QName ("test")); 266 assertEquals(endpoints[0], externalEndpoint); 267 } 268 269 public void testGetExternalEndpointsForInterfaceNotRegisteredInterface() 270 throws RegistryException { 271 assertEquals(0, registry.getExternalEndpointsForInterface(new QName ( 272 "test")).length); 273 } 274 275 public void testGetExternalEndpointsForService() throws JBIException, 276 NamingException { 277 ExternalEndpoint externalEndpoint = new ExternalEndpoint( 278 new ConsumerEndpoint("compo", "0"), "compo", "0"); 279 rootContext.bind("test-link", externalEndpoint); 280 MockContext context = (MockContext) servicesContext 281 .createSubcontext("test"); 282 MockLinkRef linkRef = new MockLinkRef("test-link"); 283 linkRef.setClassName(ExternalEndpoint.class.getName()); 284 context.bind("inter1", linkRef); 285 AbstractEndpoint[] endpoints = registry 286 .getExternalEndpointsForService(new QName ("test")); 287 assertEquals(endpoints[0], externalEndpoint); 288 } 289 290 public void testGetInternalEndpoint() throws JBIException, NamingException { 291 InternalEndpoint internalEndpoint = new InternalEndpoint(new QName ( 292 "service"), "endpoint", "compo", "0", null); 293 endpointsContext.getBindings().put("endpoint", internalEndpoint); 294 AbstractEndpoint endpoint = registry.getInternalEndpoint(new QName ( 295 "test"), "endpoint"); 296 assertEquals(endpoint.containerName, "0"); 297 } 298 299 public void testGetInternalEndpointsForInterface() throws JBIException, 300 NamingException { 301 InternalEndpoint internalEndpoint = new InternalEndpoint(new QName ( 302 "service"), "endpoint", "compo", "0", null); 303 rootContext.bind("test-link", internalEndpoint); 304 MockContext context = (MockContext) interfacesContext 305 .createSubcontext("test"); 306 MockLinkRef linkRef = new MockLinkRef("test-link"); 307 linkRef.setClassName(InternalEndpoint.class.getName()); 308 context.bind("inter1", linkRef); 309 AbstractEndpoint[] endpoints = registry 310 .getInternalEndpointsForInterface(new QName ("test")); 311 assertEquals(endpoints[0], internalEndpoint); 312 } 313 314 public void testGetInternalEndpointsForInterface1() throws JBIException, 315 NamingException { 316 testRegisterInternalEndpoint(); 317 AbstractEndpoint[] endpoints = registry 318 .getInternalEndpointsForInterface(null); 319 assertEquals(endpoints[0].containerName, "0"); 320 } 321 322 public void testGetInternalEndpointsForService() throws JBIException, 323 NamingException { 324 InternalEndpoint internalEndpoint = new InternalEndpoint(new QName ( 325 "serv"), "endpoint", "compo", "0", null); 326 rootContext.bind("test-link", internalEndpoint); 327 MockContext context = (MockContext) servicesContext 328 .createSubcontext("test"); 329 MockLinkRef linkRef = new MockLinkRef("test-link"); 330 linkRef.setClassName(InternalEndpoint.class.getName()); 331 context.bind("inter1", linkRef); 332 AbstractEndpoint[] endpoints = registry 333 .getInternalEndpointsForService(new QName ("test")); 334 assertEquals(endpoints[0], internalEndpoint); 335 } 336 337 public void testRegisterConnectionExceptionNull() { 338 try { 339 registry.registerConnection(null); 340 fail(); 341 } catch (Exception e) { 342 } 344 } 345 346 public void testRegisterConnectionWithInterfaces() throws RegistryException { 347 LinkedEndpoint linkedEndpoint = new LinkedEndpoint(new QName ("inter"), 348 new QName ("toserv"), "endpoint", null); 349 InternalEndpoint internalEndpoint = new InternalEndpoint(new QName ( 350 "toserv"), "endpoint", "compo", "0", null); 351 endpointsContext.getBindings().put("endpoint", internalEndpoint); 352 registry.registerConnection(linkedEndpoint); 353 assertEquals(interfacesContext.getBindings().size(), 1); 354 } 355 356 public void testRegisterConnectionWithoutInterface() 357 throws RegistryException { 358 LinkedEndpoint linkedEndpoint = new LinkedEndpoint( 359 new QName ("service"), "endpoint", new QName ("toservice"), 360 "toendpoint", null); 361 registry.registerInternalEndpoint(new InternalEndpoint(new QName ( 362 "toservice"), "toendpoint", "compo", "0", null)); 363 registry.registerConnection(linkedEndpoint); 364 assertNotNull(endpointsContext.getBindings().get("endpoint")); 365 } 366 367 @SuppressWarnings ("unchecked") 368 public void testRegisterExternalEndpoint() throws JBIException { 369 ExternalEndpoint externalEndpoint = new ExternalEndpoint( 370 new ConsumerEndpoint("compo", "0"), "compo", "0"); 371 externalEndpoint.setServiceName(new QName ("test")); 372 registry.registerExternalEndpoint(externalEndpoint); 373 AbstractEndpoint endpoint = (AbstractEndpoint) endpointsContext 375 .getBindings().values().iterator().next(); 376 assertEquals(externalEndpoint, endpoint); 377 LinkRef linkRef = (LinkRef ) newEndpointContext.getBindings().values() 379 .iterator().next(); 380 assertNotNull(linkRef); 381 } 382 383 388 public void testRegisterExternalEndpointException() { 389 ExternalEndpoint externalEndpoint = new ExternalEndpoint( 390 new InternalEndpoint(new QName ("test"), "endpoint", "compo", "0", 391 null), "compo", "0"); 392 endpointsContext.getBindings().put("endpoint", externalEndpoint); 393 394 ExternalEndpoint externalEndpoint2 = new ExternalEndpoint( 395 new InternalEndpoint(new QName ("test"), "endpoint", "compo", "0", 396 null), "compo", "1"); 397 398 try { 399 registry.registerExternalEndpoint(externalEndpoint2); 400 fail(); 401 } catch (RegistryException e) { 402 } 403 } 404 405 public void testRegisterExternalEndpointExceptionNull() { 406 try { 407 registry.registerExternalEndpoint(null); 408 fail(); 409 } catch (Exception e) { 410 } 412 } 413 414 420 @SuppressWarnings ("unchecked") 421 public void testRegisterInternalEndpoint() throws JBIException, 422 NamingException { 423 AbstractEndpoint endpoint = new InternalEndpoint(new QName ("test"), 424 "endpoint", "axis2bc", "0", null); 425 registry.registerInternalEndpoint(endpoint); 426 AbstractEndpoint ep = (AbstractEndpoint) endpointsContext.getBindings() 428 .values().iterator().next(); 429 assertEquals(endpoint, ep); 430 LinkRef linkRef = (LinkRef ) newEndpointContext.getBindings().values() 432 .iterator().next(); 433 assertNotNull(linkRef); 434 } 435 436 441 public void testRegisterInternalEndpointAlreadyRegistered() { 442 InternalEndpoint internalEndpoint = new InternalEndpoint(new QName ( 443 "serv"), "endpoint", "compo", "0", null); 444 endpointsContext.getBindings().put("endpoint", internalEndpoint); 445 446 InternalEndpoint internalEndpoint2 = new InternalEndpoint(new QName ( 447 "serv"), "endpoint", "compo", "1", null); 448 449 try { 450 registry.registerInternalEndpoint(internalEndpoint2); 451 fail(); 452 } catch (Exception e) { 453 454 } 455 } 456 457 public void testRegisterInternalEndpointExceptionNull() { 458 try { 459 registry.registerInternalEndpoint(null); 460 fail(); 461 } catch (Exception e) { 462 } 464 } 465 466 @SuppressWarnings ("unchecked") 467 public void testRegisterInternalEndpointWithLinkedEndpoint() 468 throws JBIException, NamingException { 469 AbstractEndpoint endpoint = new LinkedEndpoint(new QName ("service1"), 470 "endpoint1", new QName ("service2"), "endpoint2", null); 471 registry.registerInternalEndpoint(endpoint); 472 AbstractEndpoint ep = (AbstractEndpoint) endpointsContext.getBindings() 474 .values().iterator().next(); 475 assertEquals(endpoint, ep); 476 LinkRef linkRef = (LinkRef ) newEndpointContext.getBindings().values() 478 .iterator().next(); 479 assertNotNull(linkRef); 480 } 481 482 public void testRetreiveNewEndpoints() throws JBIException, NamingException { 483 AbstractEndpoint endpoint = new InternalEndpoint(new QName ("test"), 484 "endpoint", "axis2bc", "0", null); 485 testRegisterInternalEndpoint(); 486 rootContext.bind("/endpoints/endpoint", endpoint); 487 List <AbstractEndpoint> endpoints = registry.retrieveNewEndpoints(); 488 assertEquals(((AbstractEndpoint) endpoints.get(0)).containerName, "0"); 489 } 490 491 public void testUnRegisterConnectionWithoutInterface() 492 throws RegistryException { 493 LinkedEndpoint linkedEndpoint = new LinkedEndpoint( 494 new QName ("service"), "endpoint", new QName ("toservice"), 495 "toendpoint", null); 496 registry.registerInternalEndpoint(new InternalEndpoint(new QName ( 497 "toservice"), "toendpoint", "compo", "0", null)); 498 registry.registerConnection(linkedEndpoint); 499 assertNotNull(endpointsContext.getBindings().get("endpoint")); 500 registry.deregisterConnection(linkedEndpoint); 501 assertNull(endpointsContext.getBindings().get("endpoint")); 502 } 503 504 public void testValidateEndpoint() throws JBIException { 505 InternalEndpoint endpoint = new InternalEndpoint(new QName ("service"), 506 "endpoint", "compo", "0", null); 507 endpoint.setInterfaces(new QName [] {new QName ("inter")}); 508 endpoint.setDescription("<xml><test />"); 509 registry.validateEndpoint(endpoint); 510 assertEquals(interfacesContext.getBindings().size(), 1); 511 } 512 513 public void testValidateEndpointExceptionNull() { 514 try { 515 registry.validateEndpoint(null); 516 fail(); 517 } catch (Exception e) { 518 } 520 } 521 522 public void testValidateEndpointWithInterfaces() throws JBIException { 523 InternalEndpoint endpoint = new InternalEndpoint(new QName ("service"), 524 "endpoint", "compo", "0", null); 525 endpoint.setInterfaces(new QName [] {new QName ("inter")}); 526 endpoint.setDescription("<xml><test />"); 527 interfacesContext.getBindings().put("inter", new MockContext()); 528 registry.validateEndpoint(endpoint); 529 assertEquals(interfacesContext.getBindings().size(), 1); 530 } 531 532 public void testRetrieveNewEndpointsException() throws NamingException { 533 LoggingUtil loggingUtil = EasyMock.createNiceMock(LoggingUtil.class); 534 InitialContext rootContext = EasyMock.createMock(InitialContext .class); 535 NamingException namingException = new NamingException (); 536 537 loggingUtil.start(); 538 EasyMock.expect(rootContext.listBindings("new-endpoints")).andThrow( 539 namingException); 540 541 EasyMock.replay(loggingUtil); 542 EasyMock.replay(rootContext); 543 544 registry.log = loggingUtil; 545 registry.rootContext = rootContext; 546 547 try { 548 registry.retrieveNewEndpoints(); 549 fail(); 550 } catch (RegistryException e) { 551 } 553 } 554 555 public void testStart() throws SecurityException , NoSuchMethodException , 556 IllegalLifeCycleException { 557 JNDIRegistry registry = EasyMock.createMock(JNDIRegistry.class, 558 new Method [] {JNDIRegistry.class.getDeclaredMethod("initContexts", 559 new Class [0])}); 560 Logger logger = EasyMock.createMock(Logger.class); 561 562 registry.logger = logger; 563 564 registry.start(); 565 566 assertNotNull(registry.log); 567 } 568 569 public void testDeregisterConnectionWithInterfacesException() 570 throws NamingException { 571 LoggingUtil loggingUtil = EasyMock.createNiceMock(LoggingUtil.class); 572 InitialContext rootContext = EasyMock.createMock(InitialContext .class); 573 NamingException namingException = new NamingException (); 574 Context interContext = EasyMock.createMock(Context .class); 575 576 EasyMock.expect(rootContext.list("interfaces")).andReturn( 577 new NamingEnumerationImpl<NameClassPair >( 578 new NameClassPair [] {new NameClassPair ("inter", "test")})); 579 EasyMock.expect(rootContext.list("new-endpoints")).andReturn( 580 new NamingEnumerationImpl<NameClassPair >( 581 new NameClassPair [] {new NameClassPair ("toep", "ep")})); 582 EasyMock.expect( 583 interContext.lookup(NamingHelper.qNameToName(new QName ("inter")))) 584 .andThrow(namingException); 585 586 EasyMock.replay(loggingUtil); 587 EasyMock.replay(rootContext); 588 EasyMock.replay(interContext); 589 590 registry.log = loggingUtil; 591 registry.rootContext = rootContext; 592 registry.interfacesContext = interContext; 593 594 LinkedEndpoint linkedEndpoint = new LinkedEndpoint(new QName ("inter"), 595 new QName ("toserv"), "toep", null); 596 597 try { 598 registry.deregisterConnection(linkedEndpoint); 599 fail(); 600 } catch (RegistryException e) { 601 } 603 } 604 605 public void testDeregisterConnectionWithServiceEndpointNotBound() 606 throws NamingException { 607 LoggingUtil loggingUtil = EasyMock.createMock(LoggingUtil.class); 608 InitialContext rootContext = EasyMock.createMock(InitialContext .class); 609 610 loggingUtil.start(); 611 EasyMock.expect(rootContext.list("endpoints")).andReturn( 612 new NamingEnumerationImpl<NameClassPair >(new NameClassPair [0])); 613 loggingUtil 614 .error("The provider endpoint ep is not registered in the endpoints"); 615 616 EasyMock.replay(loggingUtil); 617 EasyMock.replay(rootContext); 618 619 registry.log = loggingUtil; 620 registry.rootContext = rootContext; 621 622 LinkedEndpoint linkedEndpoint = new LinkedEndpoint(new QName ("serv"), 623 "ep", new QName ("toserv"), "toep", null); 624 625 try { 626 registry.deregisterConnection(linkedEndpoint); 627 fail(); 628 } catch (RegistryException e) { 629 } 631 } 632 633 public void testDeregisterConnectionWithServiceException() 634 throws NamingException , SecurityException , NoSuchMethodException { 635 JNDIRegistry registry = EasyMock.createMock(JNDIRegistry.class, 636 new Method [] {JNDIRegistry.class.getDeclaredMethod( 637 "retrieveServiceContext", new Class [] {Name .class})}); 638 LoggingUtil loggingUtil = EasyMock.createNiceMock(LoggingUtil.class); 639 InitialContext rootContext = EasyMock.createMock(InitialContext .class); 640 NamingException namingException = new NamingException (); 641 642 EasyMock.expect(rootContext.list("endpoints")).andReturn( 643 new NamingEnumerationImpl<NameClassPair >( 644 new NameClassPair [] {new NameClassPair ("ep", "foo")})); 645 EasyMock.expect( 646 registry.retrieveServiceContext(NamingHelper.qNameToName(new QName ( 647 "serv")))).andThrow(namingException); 648 649 EasyMock.replay(registry); 650 EasyMock.replay(loggingUtil); 651 EasyMock.replay(rootContext); 652 653 registry.log = loggingUtil; 654 registry.rootContext = rootContext; 655 656 LinkedEndpoint linkedEndpoint = new LinkedEndpoint(new QName ("serv"), 657 "ep", new QName ("toserv"), "toep", null); 658 659 try { 660 registry.deregisterConnection(linkedEndpoint); 661 fail(); 662 } catch (RegistryException e) { 663 } 665 } 666 } 667 | Popular Tags |