Search in sources :

Example 6 with ProcessorResponse

use of com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorAPITest method getProcessor.

@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void getProcessor() {
    BridgeResponse bridgeResponse = createAndDeployBridge();
    Response response = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor", createKafkaAction()));
    assertThat(response.getStatusCode()).isEqualTo(201);
    ProcessorResponse pr = response.as(ProcessorResponse.class);
    assertThat(pr.getAction().getType()).isEqualTo(KafkaTopicAction.TYPE);
    assertThat(pr.getAction().getParameters()).containsEntry(KafkaTopicAction.TOPIC_PARAM, TestConstants.DEFAULT_KAFKA_TOPIC);
    ProcessorResponse found = TestUtils.getProcessor(bridgeResponse.getId(), pr.getId()).as(ProcessorResponse.class);
    assertThat(found.getId()).isEqualTo(pr.getId());
    assertThat(found.getAction().getType()).isEqualTo(KafkaTopicAction.TYPE);
    assertThat(found.getAction().getParameters()).containsEntry(KafkaTopicAction.TOPIC_PARAM, TestConstants.DEFAULT_KAFKA_TOPIC);
}
Also used : ProcessorListResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorListResponse) BridgeResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeResponse) ProcessorResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse) Response(io.restassured.response.Response) ProcessorResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse) ProcessorRequest(com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest) BridgeResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeResponse) TestSecurity(io.quarkus.test.security.TestSecurity) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 7 with ProcessorResponse

use of com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorAPITest method addProcessorWithNullFiltersToBridge.

@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void addProcessorWithNullFiltersToBridge() {
    BridgeResponse bridgeResponse = createAndDeployBridge();
    Response response = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor", createKafkaAction()));
    assertThat(response.getStatusCode()).isEqualTo(201);
    ProcessorResponse processorResponse = response.as(ProcessorResponse.class);
    assertThat(processorResponse.getName()).isEqualTo("myProcessor");
    assertThat(processorResponse.getFilters()).isNull();
    assertThat(processorResponse.getTransformationTemplate()).isNull();
    assertRequestedAction(processorResponse);
}
Also used : ProcessorListResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorListResponse) BridgeResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeResponse) ProcessorResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse) Response(io.restassured.response.Response) ProcessorResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse) ProcessorRequest(com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest) BridgeResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeResponse) TestSecurity(io.quarkus.test.security.TestSecurity) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 8 with ProcessorResponse

use of com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorAPITest method addProcessorToBridgeAndRetrieve.

@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void addProcessorToBridgeAndRetrieve() {
    BridgeResponse bridgeResponse = createAndDeployBridge();
    Set<BaseFilter> filters = Collections.singleton(new StringEquals("json.key", "value"));
    Response response = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor", filters, null, createKafkaAction()));
    assertThat(response.getStatusCode()).isEqualTo(201);
    ProcessorResponse retrieved = TestUtils.getProcessor(bridgeResponse.getId(), response.as(ProcessorResponse.class).getId()).as(ProcessorResponse.class);
    assertThat(retrieved.getName()).isEqualTo("myProcessor");
    assertThat(retrieved.getFilters().size()).isEqualTo(1);
    assertThat(retrieved.getTransformationTemplate()).isNull();
    assertRequestedAction(retrieved);
}
Also used : StringEquals(com.redhat.service.bridge.infra.models.filters.StringEquals) ProcessorListResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorListResponse) BridgeResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeResponse) ProcessorResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse) Response(io.restassured.response.Response) ProcessorResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse) ProcessorRequest(com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest) BridgeResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeResponse) BaseFilter(com.redhat.service.bridge.infra.models.filters.BaseFilter) TestSecurity(io.quarkus.test.security.TestSecurity) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 9 with ProcessorResponse

use of com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorAPITest method testDeleteProcessor.

@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void testDeleteProcessor() {
    BridgeResponse bridgeResponse = createAndDeployBridge();
    ProcessorResponse processorResponse = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor", null, null, createKafkaAction())).as(ProcessorResponse.class);
    TestUtils.deleteProcessor(bridgeResponse.getId(), processorResponse.getId()).then().statusCode(202);
    processorResponse = TestUtils.getProcessor(bridgeResponse.getId(), processorResponse.getId()).as(ProcessorResponse.class);
    assertThat(processorResponse.getStatus()).isEqualTo(ManagedResourceStatus.DEPROVISION);
}
Also used : ProcessorResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse) ProcessorRequest(com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest) BridgeResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeResponse) TestSecurity(io.quarkus.test.security.TestSecurity) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 10 with ProcessorResponse

use of com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorAPITest method getProcessorWithSendToBridgeAction.

@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void getProcessorWithSendToBridgeAction() {
    BridgeResponse bridgeResponse = createAndDeployBridge();
    String bridgeId = bridgeResponse.getId();
    Response response = TestUtils.addProcessorToBridge(bridgeId, new ProcessorRequest("myProcessor", createSendToBridgeAction(bridgeId)));
    assertThat(response.getStatusCode()).isEqualTo(201);
    ProcessorResponse pr = response.as(ProcessorResponse.class);
    assertThat(pr.getAction().getType()).isEqualTo(SendToBridgeAction.TYPE);
    assertThat(pr.getAction().getParameters()).containsEntry(SendToBridgeAction.BRIDGE_ID_PARAM, bridgeId);
    ProcessorResponse found = TestUtils.getProcessor(bridgeId, pr.getId()).as(ProcessorResponse.class);
    assertThat(found.getId()).isEqualTo(pr.getId());
    assertThat(found.getAction().getType()).isEqualTo(SendToBridgeAction.TYPE);
    assertThat(found.getAction().getParameters()).containsEntry(SendToBridgeAction.BRIDGE_ID_PARAM, bridgeId);
}
Also used : ProcessorListResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorListResponse) BridgeResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeResponse) ProcessorResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse) Response(io.restassured.response.Response) ProcessorResponse(com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse) ProcessorRequest(com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest) BridgeResponse(com.redhat.service.bridge.manager.api.models.responses.BridgeResponse) TestSecurity(io.quarkus.test.security.TestSecurity) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Aggregations

ProcessorResponse (com.redhat.service.bridge.manager.api.models.responses.ProcessorResponse)13 QuarkusTest (io.quarkus.test.junit.QuarkusTest)10 Test (org.junit.jupiter.api.Test)10 ProcessorRequest (com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest)9 BridgeResponse (com.redhat.service.bridge.manager.api.models.responses.BridgeResponse)9 TestSecurity (io.quarkus.test.security.TestSecurity)9 ProcessorListResponse (com.redhat.service.bridge.manager.api.models.responses.ProcessorListResponse)8 Response (io.restassured.response.Response)6 BaseAction (com.redhat.service.bridge.infra.models.actions.BaseAction)2 BaseFilter (com.redhat.service.bridge.infra.models.filters.BaseFilter)2 StringEquals (com.redhat.service.bridge.infra.models.filters.StringEquals)2 ProcessorDefinition (com.redhat.service.bridge.infra.models.processors.ProcessorDefinition)2 BridgeContext (com.redhat.service.bridge.integration.tests.context.BridgeContext)2 Bridge (com.redhat.service.bridge.manager.models.Bridge)1 Processor (com.redhat.service.bridge.manager.models.Processor)1 And (io.cucumber.java.en.And)1 When (io.cucumber.java.en.When)1 JsonObject (io.vertx.core.json.JsonObject)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1