CamelMicroserviceProvider implements MicroserviceProvider, CamelSilverService { @Override public Context getContext() { return context; }  @Override void initialize(final Context context); @Override Context getContext(); @Override void run(); @Override Set<Object> lookupMicroservice(final MicroserviceMetaData metaData);  }
@Test public void camelMicroserviceProviderTest() throws Exception { final String message = "But all the clocks in the city\n" + " Began to whir and chime:\n" + "‘O let not Time deceive you,\n" + " You cannot conquer Time."; final BootUtil bootUtil = new BootUtil(); final Thread platform = bootUtil.getMicroservicePlatform(this.getClass().getPackage().getName()); platform.start(); Assert.assertTrue(semaphore.tryAcquire(1, TimeUnit.MINUTES), "Timed-out while waiting for the camel route deployment."); CamelContext context = (CamelContext) bootUtil.getContext().getProperties().get(CamelMicroserviceProvider.CAMEL_CONTEXT); Endpoint endpoint = context.getEndpoint("direct:response"); final StringBuilder response = new StringBuilder(); endpoint.createConsumer(new Processor() { @Override public void process(final Exchange exchange) throws Exception { response.append(exchange.getIn().getBody().toString()); } }).start(); ProducerTemplate template = context.createProducerTemplate(); template.sendBody("direct:test", message); Assert.assertEquals(response.toString(), message); platform.interrupt(); platform.join(); }
@Test public void shouldCreateCamelContextUsingTheFactory() throws Exception { final BootUtil bootUtil = new BootUtil(); final Thread platform = bootUtil.getMicroservicePlatform(this.getClass().getPackage().getName()); platform.start(); Assert.assertTrue(semaphore.tryAcquire(1, TimeUnit.MINUTES), "Timed-out while waiting for the camel route deployment."); CamelContext context = (CamelContext) bootUtil.getContext().getProperties().get(CamelMicroserviceProvider.CAMEL_CONTEXT); Assert.assertSame(context, camelContext); platform.interrupt(); platform.join(); }