use of com.redhat.service.bridge.manager.api.models.responses.BridgeResponse 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);
}
use of com.redhat.service.bridge.manager.api.models.responses.BridgeResponse 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);
}
use of com.redhat.service.bridge.manager.api.models.responses.BridgeResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorAPITest method createAndDeployBridge.
private BridgeResponse createAndDeployBridge() {
BridgeResponse bridgeResponse = createBridge();
BridgeDTO dto = new BridgeDTO();
dto.setId(bridgeResponse.getId());
dto.setStatus(ManagedResourceStatus.READY);
dto.setCustomerId(TestConstants.DEFAULT_CUSTOMER_ID);
dto.setEndpoint("https://foo.bridges.redhat.com");
Response deployment = TestUtils.updateBridge(dto);
assertThat(deployment.getStatusCode()).isEqualTo(200);
return bridgeResponse;
}
use of com.redhat.service.bridge.manager.api.models.responses.BridgeResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ProcessorAPITest method getProcessor_bridgeDoesNotExist.
@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void getProcessor_bridgeDoesNotExist() {
BridgeResponse bridgeResponse = createAndDeployBridge();
ProcessorResponse response = TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest("myProcessor", createKafkaAction())).as(ProcessorResponse.class);
Response found = TestUtils.getProcessor("doesNotExist", response.getId());
assertThat(found.getStatusCode()).isEqualTo(404);
}
use of com.redhat.service.bridge.manager.api.models.responses.BridgeResponse in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgeSteps method createNewBridge.
@When("^create a new Bridge \"([^\"]*)\"$")
public void createNewBridge(String testBridgeName) {
String systemBridgeName = Utils.generateId("test-" + testBridgeName);
int creationRetry = 1;
while (creationRetry <= BRIDGE_NAME_CREATE_RETRY && isBridgeExisting(systemBridgeName)) {
creationRetry++;
systemBridgeName = Utils.generateId("test-" + testBridgeName);
}
if (isBridgeExisting(systemBridgeName)) {
throw new RuntimeException("Cannot create and initiate a random bridge name correctly. Please cleanup the environment...");
}
BridgeResponse response = BridgeResource.addBridge(context.getManagerToken(), systemBridgeName);
assertThat(response.getName()).isEqualTo(systemBridgeName);
assertThat(response.getStatus()).isEqualTo(ManagedResourceStatus.ACCEPTED);
assertThat(response.getEndpoint()).isNull();
assertThat(response.getPublishedAt()).isNull();
assertThat(response.getHref()).isNotNull();
assertThat(response.getSubmittedAt()).isNotNull();
context.newBridge(testBridgeName, response.getId(), systemBridgeName);
}
Aggregations