use of com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgesAPITest method getBridgeWithErrorHandler.
@Test
@TestSecurity(user = DEFAULT_CUSTOMER_ID)
public void getBridgeWithErrorHandler() {
Action errorHandler = createWebhookAction();
Response bridgeCreateResponse = TestUtils.createBridge(new BridgeRequest(DEFAULT_BRIDGE_NAME, errorHandler));
bridgeCreateResponse.then().statusCode(202);
BridgeResponse bridge = bridgeCreateResponse.as(BridgeResponse.class);
BridgeResponse retrievedBridge = TestUtils.getBridge(bridge.getId()).as(BridgeResponse.class);
assertThat(retrievedBridge).isNotNull();
assertThat(retrievedBridge.getId()).isEqualTo(bridge.getId());
assertThat(retrievedBridge.getName()).isEqualTo(bridge.getName());
assertThat(retrievedBridge.getEndpoint()).isEqualTo(bridge.getEndpoint());
assertThat(retrievedBridge.getErrorHandler()).isNotNull();
assertThat(retrievedBridge.getErrorHandler()).isEqualTo(errorHandler);
}
use of com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgesAPITest method testGetBridgesFilterByNameAndStatus.
@Test
@TestSecurity(user = DEFAULT_CUSTOMER_ID)
public void testGetBridgesFilterByNameAndStatus() {
Bridge bridge1 = Fixtures.createBridge();
bridge1.setName(DEFAULT_BRIDGE_NAME + "1");
bridge1.setStatus(READY);
bridgeDAO.persist(bridge1);
Bridge bridge2 = Fixtures.createBridge();
bridge2.setName(DEFAULT_BRIDGE_NAME + "2");
bridge2.setStatus(READY);
bridgeDAO.persist(bridge2);
BridgeListResponse bridgeListResponse = TestUtils.getBridgesFilterByNameAndStatus(DEFAULT_BRIDGE_NAME + "1", READY).as(BridgeListResponse.class);
assertThat(bridgeListResponse.getItems().size()).isEqualTo(1);
BridgeResponse bridgeResponse = bridgeListResponse.getItems().get(0);
assertThat(bridgeResponse.getName()).isEqualTo(bridge1.getName());
assertThat(bridgeResponse.getStatus()).isEqualTo(bridge1.getStatus());
assertThat(bridgeResponse.getHref()).isEqualTo(USER_API_BASE_PATH + bridgeResponse.getId());
assertThat(bridgeResponse.getSubmittedAt()).isNotNull();
assertThat(bridgeResponse.getEndpoint()).isNotNull();
}
use of com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgesAPITest method testGetBridgesFilterByMultipleStatuses.
@Test
@TestSecurity(user = DEFAULT_CUSTOMER_ID)
public void testGetBridgesFilterByMultipleStatuses() {
Bridge bridge1 = Fixtures.createBridge();
bridge1.setName(DEFAULT_BRIDGE_NAME + "1");
bridge1.setStatus(READY);
bridgeDAO.persist(bridge1);
Bridge bridge2 = Fixtures.createBridge();
bridge2.setName(DEFAULT_BRIDGE_NAME + "2");
bridge2.setStatus(ACCEPTED);
bridgeDAO.persist(bridge2);
BridgeListResponse bridgeListResponse = TestUtils.getBridgesFilterByStatus(READY, ACCEPTED).as(BridgeListResponse.class);
// The default sorting is by submission date descending; so Bridge2 will be first
assertThat(bridgeListResponse.getItems().size()).isEqualTo(2);
BridgeResponse bridgeResponse1 = bridgeListResponse.getItems().get(0);
assertThat(bridgeResponse1.getName()).isEqualTo(bridge2.getName());
assertThat(bridgeResponse1.getStatus()).isEqualTo(bridge2.getStatus());
assertThat(bridgeResponse1.getHref()).isEqualTo(USER_API_BASE_PATH + bridgeResponse1.getId());
assertThat(bridgeResponse1.getSubmittedAt()).isNotNull();
assertThat(bridgeResponse1.getEndpoint()).isNotNull();
BridgeResponse bridgeResponse2 = bridgeListResponse.getItems().get(1);
assertThat(bridgeResponse2.getName()).isEqualTo(bridge1.getName());
assertThat(bridgeResponse2.getStatus()).isEqualTo(bridge1.getStatus());
assertThat(bridgeResponse2.getHref()).isEqualTo(USER_API_BASE_PATH + bridgeResponse2.getId());
assertThat(bridgeResponse2.getSubmittedAt()).isNotNull();
assertThat(bridgeResponse2.getEndpoint()).isNotNull();
}
use of com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgesAPITest method testDeleteBridge.
@Test
@TestSecurity(user = DEFAULT_CUSTOMER_ID)
public void testDeleteBridge() {
Bridge bridge = Fixtures.createBridge();
bridge.setStatus(READY);
bridgeDAO.persist(bridge);
TestUtils.deleteBridge(bridge.getId()).then().statusCode(202);
BridgeResponse response = TestUtils.getBridge(bridge.getId()).as(BridgeResponse.class);
assertThat(response.getStatus()).isEqualTo(ManagedResourceStatus.DEPROVISION);
}
use of com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgesAPITest method testDeleteBridgeWithActiveProcessors.
@Test
@TestSecurity(user = DEFAULT_CUSTOMER_ID)
public void testDeleteBridgeWithActiveProcessors() {
BridgeResponse bridgeResponse = TestUtils.createBridge(new BridgeRequest(DEFAULT_BRIDGE_NAME)).as(BridgeResponse.class);
TestUtils.updateBridge(new BridgeDTO(bridgeResponse.getId(), bridgeResponse.getName(), bridgeResponse.getEndpoint(), DEFAULT_CUSTOMER_ID, DEFAULT_USER_NAME, READY, new KafkaConnectionDTO()));
TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest(DEFAULT_PROCESSOR_NAME, TestUtils.createKafkaAction())).then().statusCode(202);
TestUtils.deleteBridge(bridgeResponse.getId()).then().statusCode(400);
}
Aggregations