Java 类org.apache.camel.component.seda.SedaEndpoint 实例源码

项目:t4f-data    文件:NotifyTest.java   
@Test
public void testNotifyFrom() throws Exception {
    // use from to indicate it should only be messages originating from the given endpoint
    NotifyBuilder notify = new NotifyBuilder(context)
            .from("seda:order").whenDone(1).create();

    template.sendBody("seda:quote", "Camel rocks");
    template.sendBody("seda:order", "123,2010-04-20'T'15:47:59,4444,5555");

    boolean matches = notify.matches(1, TimeUnit.SECONDS);
    assertTrue(matches);

    SedaEndpoint confirm = context.getEndpoint("seda:confirm", SedaEndpoint.class);
    assertEquals(1, confirm.getExchanges().size());
    assertEquals("OK,123,2010-04-20'T'15:47:59,4444,5555", confirm.getExchanges().get(0).getIn().getBody());
}
项目:Camel    文件:AdviceWithMockEndpointsWithSkipTest.java   
public void testAdvisedMockEndpointsWithSkip() throws Exception {
    // advice the first route using the inlined AdviceWith route builder
    // which has extended capabilities than the regular route builder
    context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
        @Override
        public void configure() throws Exception {
            // mock sending to direct:foo and skip send to it
            mockEndpointsAndSkip("direct:foo");
        }
    });

    getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
    getMockEndpoint("mock:direct:foo").expectedMessageCount(1);

    template.sendBody("direct:start", "Hello World");

    assertMockEndpointsSatisfied();

    // the message was not send to the direct:foo route and thus not sent to the seda endpoint
    SedaEndpoint seda = context.getEndpoint("seda:foo", SedaEndpoint.class);
    assertEquals(0, seda.getCurrentQueueSize());
}
项目:Camel    文件:AdviceWithMockMultipleEndpointsWithSkipTest.java   
public void testAdvisedMockEndpointsWithSkip() throws Exception {
    // advice the first route using the inlined AdviceWith route builder
    // which has extended capabilities than the regular route builder
    context.getRouteDefinitions().get(0).adviceWith(context, new AdviceWithRouteBuilder() {
        @Override
        public void configure() throws Exception {
            // mock sending to direct:foo and direct:bar and skip send to it
            mockEndpointsAndSkip("direct:foo", "direct:bar");
        }
    });

    getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
    getMockEndpoint("mock:direct:foo").expectedMessageCount(1);
    getMockEndpoint("mock:direct:bar").expectedMessageCount(1);

    template.sendBody("direct:start", "Hello World");

    assertMockEndpointsSatisfied();

    // the message was not send to the direct:foo route and thus not sent to the seda endpoint
    SedaEndpoint seda = context.getEndpoint("seda:foo", SedaEndpoint.class);
    assertEquals(0, seda.getCurrentQueueSize());
}
项目:Camel    文件:ContextScopedOnExceptionLoadBalancerStopRouteTest.java   
public void testErrorOkError() throws Exception {
    getMockEndpoint("mock:error").expectedBodiesReceived("Kaboom");
    getMockEndpoint("mock:start").expectedBodiesReceived("Kaboom", "World", "Kaboom");
    getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
    getMockEndpoint("mock:exception").expectedBodiesReceived("Kaboom", "Kaboom");

    template.sendBody("direct:start", "Kaboom");
    template.sendBody("direct:start", "World");

    // give time for route to stop
    Thread.sleep(1000);
    assertEquals(ServiceStatus.Stopped, context.getRouteStatus("errorRoute"));

    template.sendBody("direct:start", "Kaboom");

    assertMockEndpointsSatisfied();

    // should be 1 on the seda queue
    SedaEndpoint seda = getMandatoryEndpoint("seda:error", SedaEndpoint.class);
    SedaEndpoint seda2 = getMandatoryEndpoint("seda:error2", SedaEndpoint.class);
    int size = seda.getQueue().size();
    int size2 = seda2.getQueue().size();
    assertTrue("There should be 1 exchange on the seda or seda2 queue", size == 1 || size2 == 1);
}
项目:Camel    文件:DummyRestConsumerFactory.java   
@Override
public Consumer createConsumer(CamelContext camelContext, Processor processor, String verb, String basePath, String uriTemplate,
                               String consumes, String produces, RestConfiguration configuration, Map<String, Object> parameters) throws Exception {
    // just use a seda endpoint for testing purpose
    String id;
    if (uriTemplate != null) {
        id = ActiveMQUuidGenerator.generateSanitizedId(basePath + uriTemplate);
    } else {
        id = ActiveMQUuidGenerator.generateSanitizedId(basePath);
    }
    // remove leading dash as we add that ourselves
    if (id.startsWith("-")) {
        id = id.substring(1);
    }

    if (configuration.getConsumerProperties() != null) {
        String ref = (String) configuration.getConsumerProperties().get("dummy");
        if (ref != null) {
            dummy = CamelContextHelper.mandatoryLookup(camelContext, ref.substring(1));
        }
    }

    SedaEndpoint seda = camelContext.getEndpoint("seda:" + verb + "-" + id, SedaEndpoint.class);
    return seda.createConsumer(processor);
}
项目:Camel    文件:DummyRestConsumerFactory.java   
@Override
public Consumer createConsumer(CamelContext camelContext, Processor processor, String verb, String basePath, String uriTemplate,
                               String consumes, String produces, RestConfiguration configuration, Map<String, Object> parameters) throws Exception {
    // just use a seda endpoint for testing purpose
    String id;
    if (uriTemplate != null) {
        id = ActiveMQUuidGenerator.generateSanitizedId(basePath + uriTemplate);
    } else {
        id = ActiveMQUuidGenerator.generateSanitizedId(basePath);
    }
    // remove leading dash as we add that ourselves
    if (id.startsWith("-")) {
        id = id.substring(1);
    }
    SedaEndpoint seda = camelContext.getEndpoint("seda:" + verb + "-" + id, SedaEndpoint.class);
    return seda.createConsumer(processor);
}
项目:Camel    文件:EndpointPropertyTest.java   
@Test
public void testEndpointProperty() throws Exception {
    getMockEndpoint("mock:result").expectedMessageCount(2);
    template.sendBody("ref:foo", "Hello World");
    template.sendBody("ref:bar", "Bye World");
    assertMockEndpointsSatisfied();

    BlueprintCamelContext blue = context().adapt(BlueprintCamelContext.class);

    SedaEndpoint foo = (SedaEndpoint) blue.getBlueprintContainer().getComponentInstance("foo");
    assertNotNull(foo);
    assertEquals(100, foo.getSize());
    assertEquals(5000, foo.getPollTimeout());
    assertEquals(true, foo.isBlockWhenFull());
    assertEquals("seda://foo?blockWhenFull=true&pollTimeout=5000&size=100", foo.getEndpointUri());

    SedaEndpoint bar = (SedaEndpoint) blue.getBlueprintContainer().getComponentInstance("bar");
    assertNotNull(bar);
    assertEquals(200, bar.getSize());
    assertEquals("seda://bar?size=200", bar.getEndpointUri());
}
项目:Camel    文件:DummyRestConsumerFactory.java   
@Override
public Consumer createConsumer(CamelContext camelContext, Processor processor, String verb, String basePath, String uriTemplate,
                               String consumes, String produces, RestConfiguration configuration, Map<String, Object> parameters) throws Exception {
    // just use a seda endpoint for testing purpose
    String id;
    if (uriTemplate != null) {
        id = ActiveMQUuidGenerator.generateSanitizedId(basePath + uriTemplate);
    } else {
        id = ActiveMQUuidGenerator.generateSanitizedId(basePath);
    }
    // remove leading dash as we add that ourselves
    if (id.startsWith("-")) {
        id = id.substring(1);
    }
    SedaEndpoint seda = camelContext.getEndpoint("seda:" + verb + "-" + id, SedaEndpoint.class);
    return seda.createConsumer(processor);
}
项目:Camel    文件:DummyRestConsumerFactory.java   
@Override
public Consumer createConsumer(CamelContext camelContext, Processor processor, String verb,
                               String basePath, String uriTemplate, String consumes,
                               String produces, RestConfiguration configuration,
                               Map<String, Object> parameters) throws Exception {
    // just use a seda endpoint for testing purpose
    String id;
    if (uriTemplate != null) {
        id = ActiveMQUuidGenerator.generateSanitizedId(basePath + uriTemplate);
    } else {
        id = ActiveMQUuidGenerator.generateSanitizedId(basePath);
    }
    // remove leading dash as we add that ourselves
    if (id.startsWith("-")) {
        id = id.substring(1);
    }

    SedaEndpoint seda = camelContext.getEndpoint("seda:" + verb + "-" + id, SedaEndpoint.class);
    return seda.createConsumer(processor);
}
项目:Camel    文件:DummyRestConsumerFactory.java   
@Override
public Consumer createConsumer(CamelContext camelContext, Processor processor, String verb, String basePath, String uriTemplate,
                               String consumes, String produces, RestConfiguration configuration, Map<String, Object> parameters) throws Exception {
    // just use a seda endpoint for testing purpose
    String id;
    if (uriTemplate != null) {
        id = ActiveMQUuidGenerator.generateSanitizedId(basePath + uriTemplate);
    } else {
        id = ActiveMQUuidGenerator.generateSanitizedId(basePath);
    }
    // remove leading dash as we add that ourselves
    if (id.startsWith("-")) {
        id = id.substring(1);
    }
    SedaEndpoint seda = camelContext.getEndpoint("seda:" + verb + "-" + id, SedaEndpoint.class);
    return seda.createConsumer(processor);
}
项目:Camel    文件:SpringEndpointPropertyTest.java   
public void testEndpointProperty() throws Exception {
    getMockEndpoint("mock:result").expectedMessageCount(2);
    template.sendBody("ref:foo", "Hello World");
    template.sendBody("ref:bar", "Bye World");
    assertMockEndpointsSatisfied();

    SedaEndpoint foo = applicationContext.getBean("foo", SedaEndpoint.class);
    assertNotNull(foo);
    assertEquals(100, foo.getSize());
    assertEquals(5000, foo.getPollTimeout());
    assertEquals(true, foo.isBlockWhenFull());
    assertEquals("seda://foo?blockWhenFull=true&pollTimeout=5000&size=100", foo.getEndpointUri());

    SedaEndpoint bar = applicationContext.getBean("bar", SedaEndpoint.class);
    assertNotNull(bar);
    assertEquals(200, bar.getSize());
    assertEquals("seda://bar?size=200", bar.getEndpointUri());
}
项目:Camel    文件:SedaDisruptorCompareTest.java   
private ExecutorService installSizeMonitoring(final Endpoint endpoint) {
    final ScheduledExecutorService service = context.getExecutorServiceManager()
            .newScheduledThreadPool(this, "SizeMonitoringThread", 1);
    endpointSizeQueue.clear();
    final Runnable monitoring = new Runnable() {
        @Override
        public void run() {
            if (endpoint instanceof SedaEndpoint) {
                final SedaEndpoint sedaEndpoint = (SedaEndpoint)endpoint;
                endpointSizeQueue.offer(sedaEndpoint.getCurrentQueueSize());
            } else if (endpoint instanceof DisruptorEndpoint) {
                final DisruptorEndpoint disruptorEndpoint = (DisruptorEndpoint)endpoint;

                long remainingCapacity = 0;
                try {
                    remainingCapacity = disruptorEndpoint.getRemainingCapacity();
                } catch (DisruptorNotStartedException e) {
                    //ignore
                }
                endpointSizeQueue.offer((int)(disruptorEndpoint.getBufferSize() - remainingCapacity));
            }
        }
    };
    service.scheduleAtFixedRate(monitoring, 0, 100, TimeUnit.MILLISECONDS);
    return service;
}
项目:Camel    文件:CamelSpringRunnerMockEndpointsTest.java   
@Test
@Override
public void testPositive() throws Exception {

    assertEquals(ServiceStatus.Started, camelContext.getStatus());
    assertEquals(ServiceStatus.Started, camelContext2.getStatus());

    mockA.expectedBodiesReceived("David");
    mockB.expectedBodiesReceived("Hello David");
    mockC.expectedBodiesReceived("David");
    mock.expectedBodiesReceived("Hello David");

    start.sendBody("David");
    start2.sendBody("David");

    MockEndpoint.assertIsSatisfied(camelContext);
    MockEndpoint.assertIsSatisfied(camelContext2);
    assertTrue("Original endpoint should be invoked", ((SedaEndpoint) original.getDelegate()).getExchanges().size() == 1);
}
项目:Camel    文件:CamelSpringRunnerMockEndpointsAndSkipTest.java   
@Test
@Override
public void testPositive() throws Exception {
    assertEquals(ServiceStatus.Started, camelContext.getStatus());
    assertEquals(ServiceStatus.Started, camelContext2.getStatus());

    mockA.expectedBodiesReceived("David");
    mockB.expectedBodiesReceived("Hello David");
    mock.expectedBodiesReceived("Hello David");

    start.sendBody("David");
    start2.sendBody("David");

    MockEndpoint.assertIsSatisfied(camelContext);
    MockEndpoint.assertIsSatisfied(camelContext2);
    assertTrue("Original endpoint was invoked", ((SedaEndpoint) original.getDelegate()).getExchanges().isEmpty());
}
项目:camelinaction2    文件:NotifyTest.java   
@Test
public void testNotifyFrom() throws Exception {
    // use from to indicate it should only be messages originating from the given endpoint
    NotifyBuilder notify = new NotifyBuilder(context)
            .from("seda:order").whenDone(1).create();

    template.sendBody("seda:quote", "Camel rocks");
    template.sendBody("seda:order", "123,2017-04-20'T'15:47:59,4444,5555");

    boolean matches = notify.matches(5, TimeUnit.SECONDS);
    assertTrue(matches);

    SedaEndpoint confirm = context.getEndpoint("seda:confirm", SedaEndpoint.class);
    assertEquals(1, confirm.getExchanges().size());
    assertEquals("OK,123,2017-04-20'T'15:47:59,4444,5555", confirm.getExchanges().get(0).getIn().getBody());
}
项目:camelinaction2    文件:NotifyTest.java   
@Test
public void testNotifyWhenAnyDoneMatches() throws Exception {
    // use a predicate to indicate when a certain message is done
    NotifyBuilder notify = new NotifyBuilder(context)
            .from("seda:order").whenAnyDoneMatches(body().isEqualTo("OK,123,2017-04-20'T'15:48:00,2222,3333")).create();

    // send in 2 messages. Its the 2nd message we want to test
    template.sendBody("seda:order", "123,2017-04-20'T'15:47:59,4444,5555");
    template.sendBody("seda:order", "123,2017-04-20'T'15:48:00,2222,3333");

    boolean matches = notify.matches(5, TimeUnit.SECONDS);
    assertTrue(matches);

    SedaEndpoint confirm = context.getEndpoint("seda:confirm", SedaEndpoint.class);
    // there should be 2 messages on the confirm queue
    assertEquals(2, confirm.getExchanges().size());
    // and the 2nd message should be the message we wanted to test for
    assertEquals("OK,123,2017-04-20'T'15:48:00,2222,3333", confirm.getExchanges().get(1).getIn().getBody());
}
项目:camelinaction    文件:NotifyTest.java   
@Test
public void testNotifyFrom() throws Exception {
    // use from to indicate it should only be messages originating from the given endpoint
    NotifyBuilder notify = new NotifyBuilder(context)
            .from("seda:order").whenDone(1).create();

    template.sendBody("seda:quote", "Camel rocks");
    template.sendBody("seda:order", "123,2010-04-20'T'15:47:59,4444,5555");

    boolean matches = notify.matches(5, TimeUnit.SECONDS);
    assertTrue(matches);

    SedaEndpoint confirm = context.getEndpoint("seda:confirm", SedaEndpoint.class);
    assertEquals(1, confirm.getExchanges().size());
    assertEquals("OK,123,2010-04-20'T'15:47:59,4444,5555", confirm.getExchanges().get(0).getIn().getBody());
}
项目:camelinaction    文件:NotifyTest.java   
@Test
public void testNotifyWhenAnyDoneMatches() throws Exception {
    // use a predicate to indicate when a certain message is done
    NotifyBuilder notify = new NotifyBuilder(context)
            .from("seda:order").whenAnyDoneMatches(body().isEqualTo("OK,123,2010-04-20'T'15:48:00,2222,3333")).create();

    // send in 2 messages. Its the 2nd message we want to test
    template.sendBody("seda:order", "123,2010-04-20'T'15:47:59,4444,5555");
    template.sendBody("seda:order", "123,2010-04-20'T'15:48:00,2222,3333");

    boolean matches = notify.matches(5, TimeUnit.SECONDS);
    assertTrue(matches);

    SedaEndpoint confirm = context.getEndpoint("seda:confirm", SedaEndpoint.class);
    // there should be 2 messages on the confirm queue
    assertEquals(2, confirm.getExchanges().size());
    // and the 2nd message should be the message we wanted to test for
    assertEquals("OK,123,2010-04-20'T'15:48:00,2222,3333", confirm.getExchanges().get(1).getIn().getBody());
}
项目:camel-cdi    文件:DummyRestConsumerFactory.java   
@Override
public Consumer createConsumer(CamelContext camelContext, Processor processor, String verb,
                               String basePath, String uriTemplate, String consumes,
                               String produces, RestConfiguration configuration,
                               Map<String, Object> parameters) throws Exception {
    // just use a seda endpoint for testing purpose
    String id;
    if (uriTemplate != null)
        id = ActiveMQUuidGenerator.generateSanitizedId(basePath + uriTemplate);
    else
        id = ActiveMQUuidGenerator.generateSanitizedId(basePath);
    // remove leading dash as we add that ourselves
    if (id.startsWith("-"))
        id = id.substring(1);

    SedaEndpoint seda = camelContext.getEndpoint("seda:" + verb + "-" + id, SedaEndpoint.class);
    return seda.createConsumer(processor);
}
项目:morc    文件:EachCaseMultiExpectationSyncFailureTest.java   
private void runTest(OrchestratedTestSpecification spec) throws Exception {

        Collection<Endpoint> endpoints = context.getEndpoints();
        for (Endpoint endpoint : endpoints) {
            if (endpoint instanceof SedaEndpoint) ((SedaEndpoint) endpoint).setPurgeWhenStopping(true);
        }

        AssertionError e = null;
        try {
            MorcTest test = new MorcTest(spec);
            test.setUp();
            test.runOrchestratedTest();
        } catch (AssertionError ex) {
            if (!ex.getMessage().contains("Received message count. Expected"))
                e = ex;

            logger.info("Exception ({}): ", spec.getDescription(), e);
        }
        assertNotNull(e);
    }
项目:t4f-data    文件:NotifyTest.java   
@Test
public void testNotifyWhenAnyDoneMatches() throws Exception {
    // use a predicate to indicate when a certain message is done
    NotifyBuilder notify = new NotifyBuilder(context)
            .from("seda:order").whenAnyDoneMatches(body().isEqualTo("OK,123,2010-04-20'T'15:48:00,2222,3333")).create();

    // send in 2 messages. Its the 2nd message we want to test
    template.sendBody("seda:order", "123,2010-04-20'T'15:47:59,4444,5555");
    template.sendBody("seda:order", "123,2010-04-20'T'15:48:00,2222,3333");

    boolean matches = notify.matches(5, TimeUnit.SECONDS);
    assertTrue(matches);

    SedaEndpoint confirm = context.getEndpoint("seda:confirm", SedaEndpoint.class);
    // there should be 2 messages on the confirm queue
    assertEquals(2, confirm.getExchanges().size());
    // and the 2nd message should be the message we wanted to test for
    assertEquals("OK,123,2010-04-20'T'15:48:00,2222,3333", confirm.getExchanges().get(1).getIn().getBody());
}
项目:Camel    文件:ConsumerTemplateSedaQueueIssueTest.java   
public void testConsumerTemplateSedaQueue() throws Exception {
    template.sendBody("direct:start", "A");
    template.sendBody("direct:start", "B");
    template.sendBody("direct:start", "C");
    template.sendBody("direct:start", "D");
    template.sendBody("direct:start", "E");

    SedaEndpoint seda = context.getEndpoint("seda:foo", SedaEndpoint.class);
    assertEquals(5, seda.getCurrentQueueSize());

    String body = consumer.receiveBody(seda, 1000, String.class);
    assertEquals("A", body);
    assertEquals(4, seda.getCurrentQueueSize());

    body = consumer.receiveBody(seda, 1000, String.class);
    assertEquals("B", body);
    assertEquals(3, seda.getCurrentQueueSize());

    body = consumer.receiveBody(seda, 1000, String.class);
    assertEquals("C", body);
    assertEquals(2, seda.getCurrentQueueSize());

    body = consumer.receiveBody(seda, 1000, String.class);
    assertEquals("D", body);
    assertEquals(1, seda.getCurrentQueueSize());

    body = consumer.receiveBody(seda, 1000, String.class);
    assertEquals("E", body);
    assertEquals(0, seda.getCurrentQueueSize());
}
项目:Camel    文件:ManagedRouteAddFromRouteTest.java   
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
    return new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            // put a message pre-early on the seda queue, to trigger the route, which
            // then would add a 2nd route during CamelContext startup. This is a test
            // to ensure the foo route is not started too soon, and thus adding the 2nd
            // route works as expected
            SedaEndpoint seda = context.getEndpoint("seda:start", SedaEndpoint.class);
            seda.getQueue().put(new DefaultExchange(context));

            from("seda:start").routeId("foo")
                    .process(new Processor() {
                        @Override
                        public void process(Exchange exchange) throws Exception {
                            RouteBuilder child = new RouteBuilder() {
                                @Override
                                public void configure() throws Exception {
                                    from("seda:bar").routeId("bar").to("mock:bar");
                                }
                            };
                            context.addRoutes(child);
                        }
                    })
                    .to("mock:result");
        }
    };
}
项目:Camel    文件:ComponentConfigurationTest.java   
/**
 * Shows how we can use the configuration to get and set parameters directly on the endpoint
 * for a {@link UriEndpointComponent}
 */
@Test
public void testConfigureAnExistingSedaEndpoint() throws Exception {
    SedaEndpoint endpoint = context.getEndpoint("seda:cheese?concurrentConsumers=5", SedaEndpoint.class);
    SedaComponent component = endpoint.getComponent();
    ComponentConfiguration configuration = component.createComponentConfiguration();

    assertEquals("concurrentConsumers", 5, endpoint.getConcurrentConsumers());
    assertEquals("concurrentConsumers", 5,
            configuration.getEndpointParameter(endpoint, "concurrentConsumers"));

    // lets try set and get some valid parameters
    configuration.setEndpointParameter(endpoint, "concurrentConsumers", 10);
    Object concurrentConsumers = configuration.getEndpointParameter(endpoint, "concurrentConsumers");
    assertEquals("endpoint.concurrentConsumers", 10, concurrentConsumers);

    configuration.setEndpointParameter(endpoint, "size", 1000);
    Object size = configuration.getEndpointParameter(endpoint, "size");
    assertEquals("endpoint.size", 1000, size);

    // lets try set an invalid parameter
    try {
        configuration.setEndpointParameter(endpoint, "doesNotExist", 1000);
        fail("Should have got InvalidPropertyException thrown!");
    } catch (InvalidPropertyException e) {
        LOG.info("Got expected exception: " + e);
    }
}
项目:Camel    文件:StartAndStopRoutesTest.java   
public void testStartRouteThenStopMutateAndStartRouteAgain() throws Exception {
    List<RouteDefinition> routes = context.getRouteDefinitions();
    assertCollectionSize("Route", routes, 1);
    RouteDefinition route = routes.get(0);

    endpointA = getMandatoryEndpoint("seda:test.a", SedaEndpoint.class);
    endpointB = getMandatoryEndpoint("seda:test.b", SedaEndpoint.class);
    endpointC = getMandatoryEndpoint("seda:test.C", SedaEndpoint.class);

    // send from A over B to results
    MockEndpoint results = getMockEndpoint("mock:results");
    results.expectedBodiesReceived(expectedBody);

    template.sendBody(endpointA, expectedBody);

    assertMockEndpointsSatisfied();

    // stop the route
    context.stopRoute(route);

    // lets mutate the route...
    FromDefinition fromType = assertOneElement(route.getInputs());
    fromType.setUri("seda:test.C");
    context.startRoute(route);

    // now lets check it works
    // send from C over B to results
    results.reset();
    results = getMockEndpoint("mock:results");
    results.expectedBodiesReceived(expectedBody);

    template.sendBody(endpointC, expectedBody);

    assertMockEndpointsSatisfied();
}
项目:Camel    文件:DummyRestConsumerFactory.java   
@Override
public Consumer createApiConsumer(CamelContext camelContext, Processor processor, String contextPath,
                                  RestConfiguration configuration, Map<String, Object> parameters) throws Exception {
    // just use a seda endpoint for testing purpose
    String id = ActiveMQUuidGenerator.generateSanitizedId(contextPath);
    // remove leading dash as we add that ourselves
    if (id.startsWith("-")) {
        id = id.substring(1);
    }
    SedaEndpoint seda = camelContext.getEndpoint("seda:api:" + "-" + id, SedaEndpoint.class);
    return seda.createConsumer(processor);
}
项目:Camel    文件:IsMockEndpointsAndSkipJUnit4Test.java   
@Test
public void testMockEndpointAndSkip() throws Exception {
    // notice we have automatic mocked the direct:foo endpoints and the name of the endpoints is "mock:uri"
    getMockEndpoint("mock:result").expectedBodiesReceived("Hello World");
    getMockEndpoint("mock:direct:foo").expectedMessageCount(1);

    template.sendBody("direct:start", "Hello World");

    assertMockEndpointsSatisfied();

    // the message was not send to the direct:foo route and thus not sent to the seda endpoint
    SedaEndpoint seda = context.getEndpoint("seda:foo", SedaEndpoint.class);
    assertEquals(0, seda.getCurrentQueueSize());
}
项目:Camel    文件:DummyRestConsumerFactory.java   
@Override
public Consumer createApiConsumer(CamelContext camelContext, Processor processor,
                                  String contextPath, RestConfiguration configuration,
                                  Map<String, Object> parameters) throws Exception {
    // just use a seda endpoint for testing purpose
    String id = ActiveMQUuidGenerator.generateSanitizedId(contextPath);
    // remove leading dash as we add that ourselves
    if (id.startsWith("-")) {
        id = id.substring(1);
    }
    SedaEndpoint seda = camelContext.getEndpoint("seda:api:" + "-" + id, SedaEndpoint.class);
    return seda.createConsumer(processor);
}
项目:Camel    文件:XmlEndpointTest.java   
@Test
@Ignore("@ApplicationScoped bean proxy cannot be casted to endpoint implementation")
public void verifyXmlEndpoint() {
    assertThat("Endpoint type is incorrect!", endpoint, is(instanceOf(SedaEndpoint.class)));
    SedaEndpoint seda = (SedaEndpoint) endpoint;
    assertThat("Endpoint queue is incorrect!",
        seda.getQueue(), is(instanceOf(MyBlockingQueue.class)));
    assertThat("Endpoint concurrent consumers count is incorrect!",
        seda.getConcurrentConsumers(), is(equalTo(10)));
}
项目:camel-cdi    文件:XmlEndpointTest.java   
@Test
@Ignore("@ApplicationScoped bean proxy cannot be casted to endpoint implementation")
public void verifyXmlEndpoint() {
    assertThat("Endpoint type is incorrect!", endpoint, is(instanceOf(SedaEndpoint.class)));
    SedaEndpoint seda = (SedaEndpoint) endpoint;
    assertThat("Endpoint queue is incorrect!",
        seda.getQueue(), is(instanceOf(MyBlockingQueue.class)));
    assertThat("Endpoint concurrent consumers count is incorrect!",
        seda.getConcurrentConsumers(), is(equalTo(10)));
}
项目:camel-cdi    文件:DummyRestConsumerFactory.java   
@Override
public Consumer createApiConsumer(CamelContext camelContext, Processor processor,
                                  String contextPath, RestConfiguration configuration,
                                  Map<String, Object> parameters) throws Exception {
    // just use a seda endpoint for testing purpose
    String id = ActiveMQUuidGenerator.generateSanitizedId(contextPath);
    // remove leading dash as we add that ourselves
    if (id.startsWith("-"))
        id = id.substring(1);
    SedaEndpoint seda = camelContext.getEndpoint("seda:api:" + "-" + id, SedaEndpoint.class);
    return seda.createConsumer(processor);
}
项目:switchyard    文件:V1CamelSedaBindingModelTest.java   
public V1CamelSedaBindingModelTest() {
    super(SedaEndpoint.class, CAMEL_XML);
}