Search in sources :

Example 6 with BonitaAuthFilter

use of org.apache.camel.component.bonita.api.filter.BonitaAuthFilter in project camel by apache.

the class BonitaAuthFilterConnectionTest method testConnection.

@Test
public void testConnection() throws Exception {
    String port = wireMockRule.port() + "";
    stubFor(post(urlEqualTo("/bonita/loginservice")).willReturn(aResponse().withHeader("Set-Cookie", "JSESSIONID=something")));
    BonitaAPIConfig bonitaApiConfig = new BonitaAPIConfig("localhost", port, "username", "password");
    BonitaAuthFilter bonitaAuthFilter = new BonitaAuthFilter(bonitaApiConfig);
    bonitaAuthFilter.filter(requestContext);
    assertEquals(1, requestContext.getHeaders().size());
}
Also used : BonitaAPIConfig(org.apache.camel.component.bonita.api.util.BonitaAPIConfig) BonitaAuthFilter(org.apache.camel.component.bonita.api.filter.BonitaAuthFilter) Test(org.junit.Test)

Example 7 with BonitaAuthFilter

use of org.apache.camel.component.bonita.api.filter.BonitaAuthFilter in project camel by apache.

the class BonitaAuthFilterTest method testBonitaAuthFilterPasswordEmpty.

@Test(expected = IllegalArgumentException.class)
public void testBonitaAuthFilterPasswordEmpty() throws IOException {
    BonitaAPIConfig bonitaApiConfig = new BonitaAPIConfig("localhost", "port", "username", "");
    BonitaAuthFilter bonitaAuthFilter = new BonitaAuthFilter(bonitaApiConfig);
    bonitaAuthFilter.filter(requestContext);
}
Also used : BonitaAPIConfig(org.apache.camel.component.bonita.api.util.BonitaAPIConfig) BonitaAuthFilter(org.apache.camel.component.bonita.api.filter.BonitaAuthFilter) Test(org.junit.Test)

Aggregations

BonitaAuthFilter (org.apache.camel.component.bonita.api.filter.BonitaAuthFilter)7 BonitaAPIConfig (org.apache.camel.component.bonita.api.util.BonitaAPIConfig)5 Test (org.junit.Test)5 Client (javax.ws.rs.client.Client)2 ClientBuilder (javax.ws.rs.client.ClientBuilder)2 ClientConfig (org.glassfish.jersey.client.ClientConfig)2 Logger (java.util.logging.Logger)1 WebTarget (javax.ws.rs.client.WebTarget)1 Feature (javax.ws.rs.core.Feature)1 JsonClientFilter (org.apache.camel.component.bonita.api.filter.JsonClientFilter)1 LoggingFeature (org.glassfish.jersey.logging.LoggingFeature)1 MultiPartFeature (org.glassfish.jersey.media.multipart.MultiPartFeature)1