Search in sources :

Example 1 with BonitaAPIConfig

use of org.apache.camel.component.bonita.api.util.BonitaAPIConfig in project camel by apache.

the class BonitaStartProducer method process.

public void process(Exchange exchange) throws Exception {
    // Setup access type (HTTP on local host)
    String hostname = this.configuration.getHostname();
    String port = this.configuration.getPort();
    String processName = this.configuration.getProcessName();
    String username = this.configuration.getUsername();
    String password = this.configuration.getPassword();
    BonitaAPIConfig bonitaAPIConfig = new BonitaAPIConfig(hostname, port, username, password);
    BonitaAPI bonitaApi = BonitaAPIBuilder.build(bonitaAPIConfig);
    ProcessDefinitionResponse processDefinition = bonitaApi.getProcessDefinition(processName);
    bonitaApi.startCase(processDefinition, exchange.getIn().getBody(Map.class));
}
Also used : ProcessDefinitionResponse(org.apache.camel.component.bonita.api.model.ProcessDefinitionResponse) BonitaAPIConfig(org.apache.camel.component.bonita.api.util.BonitaAPIConfig) BonitaAPI(org.apache.camel.component.bonita.api.BonitaAPI) Map(java.util.Map)

Example 2 with BonitaAPIConfig

use of org.apache.camel.component.bonita.api.util.BonitaAPIConfig in project camel by apache.

the class BonitaAPITest method testGetProcessDefinitionEmptyInput.

@Test(expected = IllegalArgumentException.class)
public void testGetProcessDefinitionEmptyInput() {
    BonitaAPI bonitaApi = BonitaAPIBuilder.build(new BonitaAPIConfig("hostname", "port", "username", "password"));
    bonitaApi.getProcessDefinition("");
}
Also used : BonitaAPIConfig(org.apache.camel.component.bonita.api.util.BonitaAPIConfig) Test(org.junit.Test)

Example 3 with BonitaAPIConfig

use of org.apache.camel.component.bonita.api.util.BonitaAPIConfig in project camel by apache.

the class BonitaAuthFilterConnectionTest method testConnectionSupportCSRF.

@Test
public void testConnectionSupportCSRF() throws Exception {
    String port = wireMockRule.port() + "";
    stubFor(post(urlEqualTo("/bonita/loginservice")).willReturn(aResponse().withHeader("Set-Cookie", "JSESSIONID=something", "X-Bonita-API-Token=something")));
    BonitaAPIConfig bonitaApiConfig = new BonitaAPIConfig("localhost", port, "username", "password");
    BonitaAuthFilter bonitaAuthFilter = new BonitaAuthFilter(bonitaApiConfig);
    bonitaAuthFilter.filter(requestContext);
    assertEquals(2, 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 4 with BonitaAPIConfig

use of org.apache.camel.component.bonita.api.util.BonitaAPIConfig in project camel by apache.

the class BonitaAuthFilterTest method testBonitaAuthFilterUsernameEmpty.

@Test(expected = IllegalArgumentException.class)
public void testBonitaAuthFilterUsernameEmpty() throws IOException {
    BonitaAPIConfig bonitaApiConfig = new BonitaAPIConfig("localhost", "port", "", "password");
    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)

Example 5 with BonitaAPIConfig

use of org.apache.camel.component.bonita.api.util.BonitaAPIConfig in project camel by apache.

the class BonitaAPITest method testStartCaseEmptyProcessDefinitionId.

@Test(expected = IllegalArgumentException.class)
public void testStartCaseEmptyProcessDefinitionId() throws Exception {
    BonitaAPI bonitaApi = BonitaAPIBuilder.build(new BonitaAPIConfig("hostname", "port", "username", "password"));
    bonitaApi.startCase(null, new HashMap<String, Serializable>());
}
Also used : Serializable(java.io.Serializable) BonitaAPIConfig(org.apache.camel.component.bonita.api.util.BonitaAPIConfig) Test(org.junit.Test)

Aggregations

BonitaAPIConfig (org.apache.camel.component.bonita.api.util.BonitaAPIConfig)9 Test (org.junit.Test)8 BonitaAuthFilter (org.apache.camel.component.bonita.api.filter.BonitaAuthFilter)5 ProcessDefinitionResponse (org.apache.camel.component.bonita.api.model.ProcessDefinitionResponse)2 Serializable (java.io.Serializable)1 Map (java.util.Map)1 BonitaAPI (org.apache.camel.component.bonita.api.BonitaAPI)1