@Override public void beforeStart(CamelContext camelContext) { camelContext.disableJMX(); } });
@Override protected CamelContext createCamelContext() throws Exception { CamelContext context = super.createCamelContext(); context.disableJMX(); return context; }
@Override protected CamelContext createCamelContext() throws Exception { CamelContext context = super.createCamelContext(); context.disableJMX(); return context; }
@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 HttpVerifierAutoConfiguration().httpVerifier(); List<VerifierResponse> responses = verifier.verify(context, "http4", 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(); } } }
@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 HttpVerifierAutoConfiguration().httpVerifier(); List<VerifierResponse> responses = verifier.verify(context, "http4", 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(); } }
@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 HttpVerifierAutoConfiguration().httpVerifier(); List<VerifierResponse> responses = verifier.verify(context, "http4", 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(); } }
@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 HttpVerifierAutoConfiguration().httpVerifier(); List<VerifierResponse> responses = verifier.verify(context, "http4", 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(); } }
@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 HttpVerifierAutoConfiguration().httpVerifier(); List<VerifierResponse> responses = verifier.verify(context, "http4", 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(); } }
@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 HttpVerifierAutoConfiguration().httpVerifier(); List<VerifierResponse> responses = verifier.verify(context, "http4", 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(); } }
@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 HttpVerifierAutoConfiguration().httpVerifier(); List<VerifierResponse> responses = verifier.verify(context, "http4", 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(); } }
camelContext.disableJMX();