Examples of EPR


Examples of org.jboss.soa.esb.addressing.EPR

    {
        final String category = "category" ;
        final String name = "name" ;
        final String missingCategory = "missingCategory" ;
        final String missingName = "missingName" ;
        final EPR epr1 = new EPR() ;
        final EPR epr2 = new EPR() ;
        final EPR epr3 = new EPR(URI.create("urn:test")) ;
       
        final LocalRegistryInterceptor interceptor = new LocalRegistryInterceptor() ;
        final RegistryStatsInterceptor stats = new RegistryStatsInterceptor() ;
        final MockRegistry registry = new MockRegistry() ;
        stats.setRegistry(registry) ;
        interceptor.setRegistry(stats) ;

        interceptor.registerEPR(category, name, "Description", epr1, "EPR description") ;
       
        // findAllServices passes through to registry
        assertEquals("findAllServices count", 0, stats.getFindAllServicesCount()) ;
        interceptor.findAllServices() ;
        assertEquals("findAllServices count", 1, stats.getFindAllServicesCount()) ;
        interceptor.findAllServices() ;
        assertEquals("findAllServices count", 2, stats.getFindAllServicesCount()) ;

        // findServices passes through to registry
        assertEquals("findServices count", 0, stats.getFindServicesCount()) ;
        interceptor.findServices(category) ;
        assertEquals("findServices count", 1, stats.getFindServicesCount()) ;
        interceptor.findServices(category) ;
        assertEquals("findServices count", 2, stats.getFindServicesCount()) ;

        // findEPR/findEPRs go to registry if not present in the local registry interceptor
        assertEquals("findEPRs count", 0, stats.getFindEPRsCount()) ;
        interceptor.findEPRs(category, name) ;
        assertEquals("findEPRs count", 0, stats.getFindEPRsCount()) ;
        interceptor.findEPRs(missingCategory, missingName) ;
        assertEquals("findEPRs count", 1, stats.getFindEPRsCount()) ;
        interceptor.findEPR(category, name) ;
        assertEquals("findEPRs count", 1, stats.getFindEPRsCount()) ;
        assertEquals("findEPR count", 0, stats.getFindEPRCount()) ;
        try
        {
            interceptor.findEPR(missingCategory, missingName) ;
            // The JAXR registry would return null here, the behaviour is not well defined
            fail("Expected ServiceNotFoundException") ;
        }
        catch (final ServiceNotFoundException snfe) {} // ignore
        assertEquals("findEPRs count", 1, stats.getFindEPRsCount()) ;
        assertEquals("findEPR count", 1, stats.getFindEPRCount()) ;

        // registerEPR adds to local registry interceptor and then to registry
        assertEquals("findEPRs count", 1, stats.getFindEPRsCount()) ;
        assertEquals("registerEPR count", 1, stats.getRegisterEPRCount()) ;
        final List<EPR> registerOrigEPRs = interceptor.findEPRs(category, name) ;
        assertEquals("findEPRs count", 1, stats.getFindEPRsCount()) ;
        assertNotNull("Original EPRs", registerOrigEPRs) ;
        assertEquals("Original EPR count", 1, registerOrigEPRs.size()) ;
        interceptor.registerEPR(category, name, "Description", epr2, "EPR description") ;
        assertEquals("registerEPR count", 2, stats.getRegisterEPRCount()) ;
        final List<EPR> duplicateEPRs = interceptor.findEPRs(category, name) ;
        assertEquals("findEPRs count", 1, stats.getFindEPRsCount()) ;
        assertNotNull("Duplicate EPRs", duplicateEPRs) ;
        assertEquals("Duplicate EPR count", 1, duplicateEPRs.size()) ;
        interceptor.registerEPR(category, name, "Description", epr3, "EPR description") ;
        assertEquals("registerEPR count", 3, stats.getRegisterEPRCount()) ;
        final List<EPR> registerNewEPRs = interceptor.findEPRs(category, name) ;
        assertEquals("findEPRs count", 1, stats.getFindEPRsCount()) ;
        assertNotNull("New EPRs", registerNewEPRs) ;
        assertEquals("New EPR count", 2, registerNewEPRs.size()) ;

        // unRegister removes from local registry interceptor and then registry
        assertEquals("findEPRs count", 1, stats.getFindEPRsCount()) ;
        assertEquals("unRegisterEPR count", 0, stats.getUnRegisterEPRCount()) ;
        final List<EPR> unRegisterOrigEPRs = interceptor.findEPRs(category, name) ;
        assertEquals("findEPRs count", 1, stats.getFindEPRsCount()) ;
        assertNotNull("Original EPRs", unRegisterOrigEPRs) ;
        assertEquals("Original EPR count", 2, unRegisterOrigEPRs.size()) ;
        interceptor.unRegisterEPR(category, name, epr3) ;
        assertEquals("unRegisterEPR count", 1, stats.getUnRegisterEPRCount()) ;
        final List<EPR> unRegisterNewEPRs = interceptor.findEPRs(category, name) ;
        assertEquals("findEPRs count", 1, stats.getFindEPRsCount()) ;
        assertNotNull("New EPRs", unRegisterNewEPRs) ;
        assertEquals("New EPR count", 1, unRegisterNewEPRs.size()) ;
        interceptor.unRegisterEPR(category, name, epr2) ;
        assertEquals("unRegisterEPR count", 2, stats.getUnRegisterEPRCount()) ;
        final List<EPR> unRegisterFinalEPRs = interceptor.findEPRs(category, name) ;
        assertEquals("findEPRs count", 1, stats.getFindEPRsCount()) ;
        assertNotNull("Duplicate EPRs", unRegisterFinalEPRs) ;
        assertEquals("Duplicate EPR count", 1, unRegisterFinalEPRs.size()) ;
        interceptor.unRegisterEPR(category, name, epr1) ;
        assertEquals("unRegisterEPR count", 3, stats.getUnRegisterEPRCount()) ;
        final List<EPR> finalEPRs = interceptor.findEPRs(category, name) ;
        assertEquals("findEPRs count", 2, stats.getFindEPRsCount()) ;
        assertNotNull("Final EPRs", finalEPRs) ;
        assertEquals("Final EPR count", 0, finalEPRs.size()) ;
        EPR finalEPR = null ;
        try
        {
            finalEPR = interceptor.findEPR(category, name) ;
            // The JAXR registry would return null here, the behaviour is not well defined
            fail("Expected ServiceNotFoundException") ;
View Full Code Here

Examples of org.jboss.soa.esb.addressing.EPR

       
        final String[] names = new String[numServices] ;
        for (int count = 0 ; count < numServices ; count++)
        {
            names[count] = name + count ;
            interceptor.registerEPR(category, names[count], "description", new EPR(), "EPR description") ;
        }
        final int numThreads = numServices*2 ;
       
        final CyclicBarrier barrier = new CyclicBarrier(numThreads) ;
        final ConcurrencyTest[] tests = new ConcurrencyTest[numThreads] ;
View Full Code Here

Examples of org.jboss.soa.esb.addressing.EPR

    @BeforeClass
    public static void before() throws Exception {
        MockCourierFactory.install();
        MockRegistry.install();

        epr1 = new EPR(new URI("test1"));
        epr2 = new EPR(new URI("test2"));
        epr3 = new EPR(new URI("DLS"));
        courier1 = new MockCourier(true);
        courier2 = new MockCourier(true);
        courier3 = new MockCourier(true);

        MockRegistry.register("test", "java", epr1, courier1);
View Full Code Here

Examples of org.jboss.soa.esb.addressing.EPR

     * @param category Service category.
     * @param service Service name.
     * @param courier EPR Courier.
     */
    public static void register(String category, String service, MockCourier courier) {
        EPR epr = new EPR(URI.create("urn:test:"+category+":"+service));
        register(category, service, epr, courier);
    }
View Full Code Here

Examples of org.jboss.soa.esb.addressing.EPR

      final String xmlRepresentation = msgToXML((MessageImpl)msg) ;
      log.debug("Document is "+xmlRepresentation);
     
      final MessageImpl nImpl = msgFromXML(xmlRepresentation) ;
     
      EPR theEpr = nImpl.getHeader().getCall().getTo();
     
      assertEquals(theEpr instanceof JMSEpr, true);
     
      assertEquals(((JMSEpr) theEpr).getConnectionFactory(), "bar");
    }
View Full Code Here

Examples of org.jboss.soa.esb.addressing.EPR

      final String xmlRepresentation = msgToXML((MessageImpl)msg) ;
      log.debug("Document is "+xmlRepresentation);
     
      final MessageImpl nImpl = msgFromXML(xmlRepresentation) ;
     
      EPR theEpr = nImpl.getHeader().getCall().getTo();
     
      assertEquals(theEpr instanceof HTTPEpr, true);
     
      assertEquals(theEpr.getURI().toString(), "http://www.foo.bar");
    }
    catch (Exception ex)
    {     
      fail(ex.toString());
    }
View Full Code Here

Examples of org.jboss.soa.esb.addressing.EPR

      final String xmlRepresentation = msgToXML((MessageImpl)msg) ;
      log.debug("Document is "+xmlRepresentation);
     
      final MessageImpl nImpl = msgFromXML(xmlRepresentation) ;
     
      EPR theEpr = nImpl.getHeader().getCall().getTo();
     
      assertEquals(theEpr instanceof EmailEpr, true);
     
      assertEquals(((EmailEpr) theEpr).getPassword(), "password");
    }
View Full Code Here

Examples of org.jboss.soa.esb.addressing.EPR

      final String xmlRepresentation = msgToXML((MessageImpl)msg) ;
      log.debug("Document is "+xmlRepresentation);
     
      final MessageImpl nImpl = msgFromXML(xmlRepresentation) ;
     
      EPR theEpr = nImpl.getHeader().getCall().getTo();
     
      assertEquals(theEpr instanceof FTPEpr, true);
     
      assertEquals(((FTPEpr) theEpr).getPassive(), true);
    }
View Full Code Here

Examples of org.jboss.soa.esb.addressing.EPR

                        final String xmlRepresentation = msgToXML((MessageImpl)msg) ;
                        log.debug("Document is "+xmlRepresentation);
                       
                        final MessageImpl nImpl = msgFromXML(xmlRepresentation) ;
                       
                        EPR theEpr = nImpl.getHeader().getCall().getTo();
                       
                        assertEquals(theEpr instanceof FTPSEpr, true);
                }
                catch (Exception ex)
                {                      
View Full Code Here

Examples of org.jboss.soa.esb.addressing.EPR

                        final String xmlRepresentation = msgToXML((MessageImpl)msg) ;
                        log.debug("Document is "+xmlRepresentation);
                       
                        final MessageImpl nImpl = msgFromXML(xmlRepresentation) ;
                       
                        EPR theEpr = nImpl.getHeader().getCall().getTo();
                       
                        assertEquals(theEpr instanceof SFTPEpr, true);
                }
                catch (Exception ex)
                {                      
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.