use of com.redhat.service.bridge.manager.api.models.requests.BridgeRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgesServiceTest method testGetBridge.
@Test
public void testGetBridge() {
BridgeRequest request = new BridgeRequest(TestConstants.DEFAULT_BRIDGE_NAME);
Bridge bridge = bridgesService.createBridge(TestConstants.DEFAULT_CUSTOMER_ID, request);
Bridge retrievedBridge = bridgesService.getBridge(bridge.getId(), TestConstants.DEFAULT_CUSTOMER_ID);
assertThat(retrievedBridge).isNotNull();
assertThat(retrievedBridge.getName()).isEqualTo(bridge.getName());
assertThat(retrievedBridge.getCustomerId()).isEqualTo(bridge.getCustomerId());
assertThat(retrievedBridge.getStatus()).isEqualTo(bridge.getStatus());
assertThat(retrievedBridge.getShardId()).isEqualTo(TestConstants.SHARD_ID);
}
use of com.redhat.service.bridge.manager.api.models.requests.BridgeRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class BridgesServiceTest method getBridge.
@Test
public void getBridge() {
BridgeRequest request = new BridgeRequest(TestConstants.DEFAULT_BRIDGE_NAME);
Bridge bridge = bridgesService.createBridge(TestConstants.DEFAULT_CUSTOMER_ID, request);
Bridge found = bridgesService.getBridge(bridge.getId());
assertThat(found).isNotNull();
assertThat(found.getId()).isEqualTo(bridge.getId());
}
use of com.redhat.service.bridge.manager.api.models.requests.BridgeRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ShardBridgesSyncAPITest method testGetBridgesToDeploy.
@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void testGetBridgesToDeploy() {
TestUtils.createBridge(new BridgeRequest(TestConstants.DEFAULT_BRIDGE_NAME));
List<BridgeDTO> response = TestUtils.getBridgesToDeployOrDelete().as(new TypeRef<List<BridgeDTO>>() {
});
assertThat(response.stream().filter(x -> x.getStatus().equals(ManagedResourceStatus.ACCEPTED)).count()).isEqualTo(1);
BridgeDTO bridge = response.get(0);
assertThat(bridge.getName()).isEqualTo(TestConstants.DEFAULT_BRIDGE_NAME);
assertThat(bridge.getCustomerId()).isEqualTo(TestConstants.DEFAULT_CUSTOMER_ID);
assertThat(bridge.getStatus()).isEqualTo(ManagedResourceStatus.ACCEPTED);
assertThat(bridge.getEndpoint()).isNull();
}
use of com.redhat.service.bridge.manager.api.models.requests.BridgeRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ShardBridgesSyncAPITest method testNotifyDeployment.
@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void testNotifyDeployment() {
TestUtils.createBridge(new BridgeRequest(TestConstants.DEFAULT_BRIDGE_NAME));
List<BridgeDTO> bridgesToDeployOrDelete = TestUtils.getBridgesToDeployOrDelete().as(new TypeRef<List<BridgeDTO>>() {
});
assertThat(bridgesToDeployOrDelete.stream().filter(x -> x.getStatus().equals(ManagedResourceStatus.ACCEPTED)).count()).isEqualTo(1);
BridgeDTO bridge = bridgesToDeployOrDelete.get(0);
bridge.setStatus(ManagedResourceStatus.PROVISIONING);
TestUtils.updateBridge(bridge).then().statusCode(200);
bridgesToDeployOrDelete = TestUtils.getBridgesToDeployOrDelete().as(new TypeRef<List<BridgeDTO>>() {
});
assertThat(bridgesToDeployOrDelete.size()).isZero();
}
use of com.redhat.service.bridge.manager.api.models.requests.BridgeRequest in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.
the class ShardBridgesSyncAPITest method getProcessorsWithKafkaAction.
@Test
@TestSecurity(user = TestConstants.DEFAULT_CUSTOMER_ID)
public void getProcessorsWithKafkaAction() {
BridgeResponse bridgeResponse = TestUtils.createBridge(new BridgeRequest(TestConstants.DEFAULT_BRIDGE_NAME)).as(BridgeResponse.class);
BridgeDTO bridge = new BridgeDTO(bridgeResponse.getId(), bridgeResponse.getName(), TEST_BRIDGE_ENDPOINT, TestConstants.DEFAULT_CUSTOMER_ID, ManagedResourceStatus.READY, new KafkaConnectionDTO());
Set<BaseFilter> filters = Collections.singleton(new StringEquals("json.key", "value"));
TestUtils.updateBridge(bridge);
TestUtils.addProcessorToBridge(bridgeResponse.getId(), new ProcessorRequest(TestConstants.DEFAULT_PROCESSOR_NAME, filters, null, TestUtils.createKafkaAction()));
List<ProcessorDTO> processors = TestUtils.getProcessorsToDeployOrDelete().as(new TypeRef<List<ProcessorDTO>>() {
});
assertThat(processors.size()).isEqualTo(1);
ProcessorDTO processor = processors.get(0);
assertThat(processor.getName()).isEqualTo(TestConstants.DEFAULT_PROCESSOR_NAME);
assertThat(processor.getStatus()).isEqualTo(ManagedResourceStatus.ACCEPTED);
assertThat(processor.getDefinition().getFilters().size()).isEqualTo(1);
assertThat(processor.getDefinition().getRequestedAction()).isNotNull();
assertThat(processor.getDefinition().getRequestedAction().getType()).isEqualTo(KafkaTopicAction.TYPE);
assertThat(processor.getDefinition().getRequestedAction().getParameters()).containsEntry(KafkaTopicAction.TOPIC_PARAM, TestConstants.DEFAULT_KAFKA_TOPIC);
assertThat(processor.getDefinition().getResolvedAction()).isNotNull();
assertThat(processor.getDefinition().getResolvedAction().getType()).isEqualTo(KafkaTopicAction.TYPE);
assertThat(processor.getDefinition().getResolvedAction().getParameters()).containsEntry(KafkaTopicAction.TOPIC_PARAM, TestConstants.DEFAULT_KAFKA_TOPIC);
}
Aggregations