Java Code Examples for org.apache.camel.CamelContext#disableJMX()

The following examples show how to use org.apache.camel.CamelContext#disableJMX() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HttpConnectorVerifierTest.java    From syndesis with Apache License 2.0 6 votes vote down vote up
@Test
public void testBaseUrlWithoutScheme() throws Exception {
    CamelContext context = new DefaultCamelContext();
    try {
        context.disableJMX();
        context.start();

        Map<String, Object> parameters = new HashMap<>();
        parameters.put("baseUrl", getLocalServerHostAndPort());

        Verifier verifier = new HttpVerifier();
        List<VerifierResponse> responses = verifier.verify(context, "http", parameters);

        assertThat(responses).hasSize(2);
        assertThat(responses).anyMatch(response -> response.getScope() == Verifier.Scope.CONNECTIVITY);
        assertThat(responses).anyMatch(response -> response.getScope() == Verifier.Scope.PARAMETERS);
        assertThat(responses).allMatch(response -> response.getStatus() == Verifier.Status.OK);
    } finally {
        context.stop();
    }
}
 
Example 2
Source File: HttpConnectorVerifierTest.java    From syndesis with Apache License 2.0 6 votes vote down vote up
@Test
public void testBaseUrlWithScheme() throws Exception {
    CamelContext context = new DefaultCamelContext();
    try {
        context.disableJMX();
        context.start();

        Map<String, Object> parameters = new HashMap<>();
        parameters.put("baseUrl", "http://" + getLocalServerHostAndPort());

        Verifier verifier = new HttpVerifier();
        List<VerifierResponse> responses = verifier.verify(context, "http", parameters);

        assertThat(responses).hasSize(2);
        assertThat(responses).anyMatch(response -> response.getScope() == Verifier.Scope.CONNECTIVITY);
        assertThat(responses).anyMatch(response -> response.getScope() == Verifier.Scope.PARAMETERS);
        assertThat(responses).allMatch(response -> response.getStatus() == Verifier.Status.OK);
    } finally {
        context.stop();
    }
}
 
Example 3
Source File: HttpConnectorVerifierTest.java    From syndesis with Apache License 2.0 6 votes vote down vote up
@Test
public void testWithPath1() throws Exception {
    CamelContext context = new DefaultCamelContext();
    try {
        context.disableJMX();
        context.start();

        Map<String, Object> parameters = new HashMap<>();
        parameters.put("baseUrl", getLocalServerHostAndPort());
        parameters.put("path", "/withPath");

        Verifier verifier = new HttpVerifier();
        List<VerifierResponse> responses = verifier.verify(context, "http", parameters);

        assertThat(responses).hasSize(2);
        assertThat(responses).anyMatch(response -> response.getScope() == Verifier.Scope.CONNECTIVITY);
        assertThat(responses).anyMatch(response -> response.getScope() == Verifier.Scope.PARAMETERS);
        assertThat(responses).allMatch(response -> response.getStatus() == Verifier.Status.OK);
    } finally {
        context.stop();
    }
}
 
Example 4
Source File: HttpConnectorVerifierTest.java    From syndesis with Apache License 2.0 6 votes vote down vote up
@Test
public void testWithPath3() throws Exception {
    CamelContext context = new DefaultCamelContext();
    try {
        context.disableJMX();
        context.start();

        Map<String, Object> parameters = new HashMap<>();
        parameters.put("baseUrl", getLocalServerHostAndPort() + "/");
        parameters.put("path", "withPath");

        Verifier verifier = new HttpVerifier();
        List<VerifierResponse> responses = verifier.verify(context, "http", parameters);

        assertThat(responses).hasSize(2);
        assertThat(responses).anyMatch(response -> response.getScope() == Verifier.Scope.CONNECTIVITY);
        assertThat(responses).anyMatch(response -> response.getScope() == Verifier.Scope.PARAMETERS);
        assertThat(responses).allMatch(response -> response.getStatus() == Verifier.Status.OK);
    } finally {
        context.stop();
    }
}
 
Example 5
Source File: HttpConnectorVerifierTest.java    From syndesis with Apache License 2.0 6 votes vote down vote up
@Test
public void testWithPath4() throws Exception {
    CamelContext context = new DefaultCamelContext();
    try {
        context.disableJMX();
        context.start();

        Map<String, Object> parameters = new HashMap<>();
        parameters.put("baseUrl", getLocalServerHostAndPort() + "/");
        parameters.put("path", "/withPath");

        Verifier verifier = new HttpVerifier();
        List<VerifierResponse> responses = verifier.verify(context, "http", parameters);

        assertThat(responses).hasSize(2);
        assertThat(responses).anyMatch(response -> response.getScope() == Verifier.Scope.CONNECTIVITY);
        assertThat(responses).anyMatch(response -> response.getScope() == Verifier.Scope.PARAMETERS);
        assertThat(responses).allMatch(response -> response.getStatus() == Verifier.Status.OK);
    } finally {
        context.stop();
    }
}
 
Example 6
Source File: HttpConnectorVerifierTest.java    From syndesis with Apache License 2.0 6 votes vote down vote up
@Test
public void testWithNestedPath1() throws Exception {
    CamelContext context = new DefaultCamelContext();
    try {
        context.disableJMX();
        context.start();

        Map<String, Object> parameters = new HashMap<>();
        parameters.put("baseUrl", getLocalServerHostAndPort() + "/with/nested");
        parameters.put("path", "path");

        Verifier verifier = new HttpVerifier();
        List<VerifierResponse> responses = verifier.verify(context, "http", parameters);

        assertThat(responses).hasSize(2);
        assertThat(responses).anyMatch(response -> response.getScope() == Verifier.Scope.CONNECTIVITY);
        assertThat(responses).anyMatch(response -> response.getScope() == Verifier.Scope.PARAMETERS);
        assertThat(responses).allMatch(response -> response.getStatus() == Verifier.Status.OK);
    } finally {
        context.stop();
    }
}
 
Example 7
Source File: HttpConnectorVerifierTest.java    From syndesis with Apache License 2.0 6 votes vote down vote up
@Test
public void testWrongScheme() throws Exception {
    CamelContext context = new DefaultCamelContext();
    try {
        context.disableJMX();
        context.start();

        Map<String, Object> parameters = new HashMap<>();
        parameters.put("baseUrl", "https://" + getLocalServerHostAndPort());

        Verifier verifier = new HttpVerifier();
        List<VerifierResponse> responses = verifier.verify(context, "http", parameters);

        assertThat(responses).hasSize(1);
        assertThat(responses.get(0)).hasFieldOrPropertyWithValue("scope", Verifier.Scope.PARAMETERS);
        assertThat(responses.get(0)).hasFieldOrPropertyWithValue("status", Verifier.Status.ERROR);

        assertThat(responses.get(0).getErrors()).hasSize(1);
        assertThat(responses.get(0).getErrors().get(0)).hasFieldOrPropertyWithValue("code", "unsupported_scheme");
    } finally {
        context.stop();
    }
}
 
Example 8
Source File: Application.java    From syndesis with Apache License 2.0 5 votes vote down vote up
@Scope(ConfigurableBeanFactory.SCOPE_SINGLETON)
@Bean(name = "verifier-context", initMethod = "start", destroyMethod = "stop")
public static CamelContext verifierContext() {
    CamelContext context = new DefaultCamelContext();
    context.setNameStrategy(new ExplicitCamelContextNameStrategy("verifier-context"));
    context.disableJMX();

    return context;
}
 
Example 9
Source File: AbstractEmailTest.java    From syndesis with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a camel context complete with a properties component that handles
 * lookups of secret values such as passwords. Fetches the values from external
 * properties file.
 *
 * @return CamelContext
 */
protected CamelContext createCamelContext() {
    CamelContext ctx = new SpringCamelContext(applicationContext);
    ctx.disableJMX();
    ctx.init();

    PropertiesComponent pc = new PropertiesComponent();
    pc.addLocation(new PropertiesLocation("classpath:mail-test-options.properties"));
    ctx.setPropertiesComponent(pc);
    return ctx;
}
 
Example 10
Source File: ConnectorTestSupport.java    From syndesis with Apache License 2.0 5 votes vote down vote up
@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext context = super.createCamelContext();
    context.disableJMX();

    return context;
}
 
Example 11
Source File: KafkaConnectorTest.java    From syndesis with Apache License 2.0 5 votes vote down vote up
@Override
protected CamelContext createCamelContext() throws Exception {
    CamelContext context = super.createCamelContext();
    context.setAutoStartup(false);
    context.disableJMX();

    return context;
}
 
Example 12
Source File: JmxDisableCamelApplication.java    From camel-cookbook-examples with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    final CamelContext context = new DefaultCamelContext();

    // Disable JMX. Call before context.start()
    context.disableJMX();

    // Add a simple test route
    context.addRoutes(new RouteBuilder() {
        @Override
        public void configure() throws Exception {
            from("direct:start")
                .log("${body}")
                .to("mock:result");
        }
    });

    // Start the context
    context.start();

    // Send a couple of messages to get some route statistics
    final ProducerTemplate template = context.createProducerTemplate();
    template.sendBody("direct:start", "Hello Camel");
    template.sendBody("direct:start", "Camel Rocks!");

    // let the Camel runtime do its job for a while
    Thread.sleep(60000);

    // shutdown
    context.stop();
}