Search in sources :

Example 1 with PROVISIONING

use of com.redhat.service.smartevents.infra.models.dto.ManagedResourceStatus.PROVISIONING in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ShardBridgesSyncAPITest method testNotifyDeployment.

@Test
@TestSecurity(user = DEFAULT_CUSTOMER_ID)
public void testNotifyDeployment() {
    TestUtils.createBridge(new BridgeRequest(DEFAULT_BRIDGE_NAME));
    final List<BridgeDTO> bridgesToDeployOrDelete = new ArrayList<>();
    await().atMost(5, SECONDS).untilAsserted(() -> {
        bridgesToDeployOrDelete.clear();
        bridgesToDeployOrDelete.addAll(TestUtils.getBridgesToDeployOrDelete().as(new TypeRef<List<BridgeDTO>>() {
        }));
        assertThat(bridgesToDeployOrDelete.stream().filter(x -> x.getStatus().equals(PREPARING)).count()).isEqualTo(1);
    });
    BridgeDTO bridge = bridgesToDeployOrDelete.get(0);
    bridge.setStatus(PROVISIONING);
    TestUtils.updateBridge(bridge).then().statusCode(200);
    await().atMost(5, SECONDS).untilAsserted(() -> {
        bridgesToDeployOrDelete.clear();
        bridgesToDeployOrDelete.addAll(TestUtils.getBridgesToDeployOrDelete().as(new TypeRef<List<BridgeDTO>>() {
        }));
        assertThat(bridgesToDeployOrDelete).isEmpty();
    });
}
Also used : BeforeEach(org.junit.jupiter.api.BeforeEach) PREPARING(com.redhat.service.smartevents.infra.models.dto.ManagedResourceStatus.PREPARING) Action(com.redhat.service.smartevents.infra.models.gateways.Action) PROVISIONING(com.redhat.service.smartevents.infra.models.dto.ManagedResourceStatus.PROVISIONING) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) DatabaseManagerUtils(com.redhat.service.smartevents.manager.utils.DatabaseManagerUtils) TestUtils(com.redhat.service.smartevents.manager.utils.TestUtils) ACCOUNT_ID_SERVICE_ACCOUNT_ATTRIBUTE_CLAIM(com.redhat.service.smartevents.infra.api.APIConstants.ACCOUNT_ID_SERVICE_ACCOUNT_ATTRIBUTE_CLAIM) DEFAULT_USER_NAME(com.redhat.service.smartevents.manager.TestConstants.DEFAULT_USER_NAME) DEPROVISION(com.redhat.service.smartevents.infra.models.dto.ManagedResourceStatus.DEPROVISION) DEFAULT_ORGANISATION_ID(com.redhat.service.smartevents.manager.TestConstants.DEFAULT_ORGANISATION_ID) DEFAULT_CUSTOMER_ID(com.redhat.service.smartevents.manager.TestConstants.DEFAULT_CUSTOMER_ID) TypeRef(io.restassured.common.mapper.TypeRef) WebhookAction(com.redhat.service.smartevents.processor.actions.webhook.WebhookAction) Awaitility.await(org.awaitility.Awaitility.await) ProcessorDTO(com.redhat.service.smartevents.infra.models.dto.ProcessorDTO) TestProfile(io.quarkus.test.junit.TestProfile) ContentType(io.restassured.http.ContentType) DEFAULT_PROCESSOR_NAME(com.redhat.service.smartevents.manager.TestConstants.DEFAULT_PROCESSOR_NAME) Set(java.util.Set) Test(org.junit.jupiter.api.Test) List(java.util.List) BridgeDTO(com.redhat.service.smartevents.infra.models.dto.BridgeDTO) KafkaConnectionDTO(com.redhat.service.smartevents.infra.models.dto.KafkaConnectionDTO) RestAssured.given(io.restassured.RestAssured.given) TestSecurity(io.quarkus.test.security.TestSecurity) MetricsService(com.redhat.service.smartevents.manager.metrics.MetricsService) READY(com.redhat.service.smartevents.infra.models.dto.ManagedResourceStatus.READY) TestConstants(com.redhat.service.smartevents.manager.TestConstants) KafkaTopicAction(com.redhat.service.smartevents.processor.actions.kafkatopic.KafkaTopicAction) ArrayList(java.util.ArrayList) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Inject(javax.inject.Inject) BridgeResponse(com.redhat.service.smartevents.manager.api.models.responses.BridgeResponse) DELETED(com.redhat.service.smartevents.infra.models.dto.ManagedResourceStatus.DELETED) USER_NAME_ATTRIBUTE_CLAIM(com.redhat.service.smartevents.infra.api.APIConstants.USER_NAME_ATTRIBUTE_CLAIM) ProcessorRequest(com.redhat.service.smartevents.manager.api.models.requests.ProcessorRequest) ORG_ID_SERVICE_ACCOUNT_ATTRIBUTE_CLAIM(com.redhat.service.smartevents.infra.api.APIConstants.ORG_ID_SERVICE_ACCOUNT_ATTRIBUTE_CLAIM) StringEquals(com.redhat.service.smartevents.infra.models.filters.StringEquals) InjectMock(io.quarkus.test.junit.mockito.InjectMock) DEFAULT_BRIDGE_NAME(com.redhat.service.smartevents.manager.TestConstants.DEFAULT_BRIDGE_NAME) ResponseLoggingFilter(io.restassured.filter.log.ResponseLoggingFilter) SHARD_ID(com.redhat.service.smartevents.manager.TestConstants.SHARD_ID) Mockito.when(org.mockito.Mockito.when) WorkerSchedulerProfile(com.redhat.service.smartevents.manager.WorkerSchedulerProfile) JsonWebToken(org.eclipse.microprofile.jwt.JsonWebToken) RhoasService(com.redhat.service.smartevents.manager.RhoasService) ManagedResourceStatus(com.redhat.service.smartevents.infra.models.dto.ManagedResourceStatus) BridgeRequest(com.redhat.service.smartevents.manager.api.models.requests.BridgeRequest) SendToBridgeAction(com.redhat.service.smartevents.processor.actions.sendtobridge.SendToBridgeAction) Collections(java.util.Collections) Mockito.reset(org.mockito.Mockito.reset) SECONDS(java.util.concurrent.TimeUnit.SECONDS) BaseFilter(com.redhat.service.smartevents.infra.models.filters.BaseFilter) BridgeRequest(com.redhat.service.smartevents.manager.api.models.requests.BridgeRequest) BridgeDTO(com.redhat.service.smartevents.infra.models.dto.BridgeDTO) TypeRef(io.restassured.common.mapper.TypeRef) ArrayList(java.util.ArrayList) TestSecurity(io.quarkus.test.security.TestSecurity) Test(org.junit.jupiter.api.Test) QuarkusTest(io.quarkus.test.junit.QuarkusTest)

Aggregations

ACCOUNT_ID_SERVICE_ACCOUNT_ATTRIBUTE_CLAIM (com.redhat.service.smartevents.infra.api.APIConstants.ACCOUNT_ID_SERVICE_ACCOUNT_ATTRIBUTE_CLAIM)1 ORG_ID_SERVICE_ACCOUNT_ATTRIBUTE_CLAIM (com.redhat.service.smartevents.infra.api.APIConstants.ORG_ID_SERVICE_ACCOUNT_ATTRIBUTE_CLAIM)1 USER_NAME_ATTRIBUTE_CLAIM (com.redhat.service.smartevents.infra.api.APIConstants.USER_NAME_ATTRIBUTE_CLAIM)1 BridgeDTO (com.redhat.service.smartevents.infra.models.dto.BridgeDTO)1 KafkaConnectionDTO (com.redhat.service.smartevents.infra.models.dto.KafkaConnectionDTO)1 ManagedResourceStatus (com.redhat.service.smartevents.infra.models.dto.ManagedResourceStatus)1 DELETED (com.redhat.service.smartevents.infra.models.dto.ManagedResourceStatus.DELETED)1 DEPROVISION (com.redhat.service.smartevents.infra.models.dto.ManagedResourceStatus.DEPROVISION)1 PREPARING (com.redhat.service.smartevents.infra.models.dto.ManagedResourceStatus.PREPARING)1 PROVISIONING (com.redhat.service.smartevents.infra.models.dto.ManagedResourceStatus.PROVISIONING)1 READY (com.redhat.service.smartevents.infra.models.dto.ManagedResourceStatus.READY)1 ProcessorDTO (com.redhat.service.smartevents.infra.models.dto.ProcessorDTO)1 BaseFilter (com.redhat.service.smartevents.infra.models.filters.BaseFilter)1 StringEquals (com.redhat.service.smartevents.infra.models.filters.StringEquals)1 Action (com.redhat.service.smartevents.infra.models.gateways.Action)1 RhoasService (com.redhat.service.smartevents.manager.RhoasService)1 TestConstants (com.redhat.service.smartevents.manager.TestConstants)1 DEFAULT_BRIDGE_NAME (com.redhat.service.smartevents.manager.TestConstants.DEFAULT_BRIDGE_NAME)1 DEFAULT_CUSTOMER_ID (com.redhat.service.smartevents.manager.TestConstants.DEFAULT_CUSTOMER_ID)1 DEFAULT_ORGANISATION_ID (com.redhat.service.smartevents.manager.TestConstants.DEFAULT_ORGANISATION_ID)1