Search in sources :

Example 1 with QueryInfo

use of com.redhat.service.bridge.infra.models.QueryInfo in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorServiceTest method testMGDOBR_80.

@Test
public void testMGDOBR_80() {
    Bridge b = createPersistBridge(ManagedResourceStatus.READY);
    Set<BaseFilter> filters = new HashSet<>();
    filters.add(new StringEquals("name", "myName"));
    filters.add(new StringEquals("surename", "mySurename"));
    ProcessorRequest r = new ProcessorRequest("My Processor", filters, null, createKafkaAction());
    Processor processor = processorService.createProcessor(b.getId(), b.getCustomerId(), r);
    await().atMost(5, SECONDS).untilAsserted(() -> {
        Processor p = processorDAO.findById(processor.getId());
        assertThat(p).isNotNull();
        assertThat(p.getDependencyStatus()).isEqualTo(ManagedResourceStatus.READY);
    });
    assertThat(processorService.getProcessors(b.getId(), TestConstants.DEFAULT_CUSTOMER_ID, new QueryInfo(0, 100)).getSize()).isEqualTo(1);
}
Also used : StringEquals(com.redhat.service.bridge.infra.models.filters.StringEquals) Processor(com.redhat.service.bridge.manager.models.Processor) ProcessorRequest(com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest) QueryInfo(com.redhat.service.bridge.infra.models.QueryInfo) Bridge(com.redhat.service.bridge.manager.models.Bridge) BaseFilter(com.redhat.service.bridge.infra.models.filters.BaseFilter) HashSet(java.util.HashSet) Test(org.junit.jupiter.api.Test) QuarkusTest(io.quarkus.test.junit.QuarkusTest)

Example 2 with QueryInfo

use of com.redhat.service.bridge.infra.models.QueryInfo in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorServiceTest method getProcessors_noProcessorsOnBridge.

@Test
public void getProcessors_noProcessorsOnBridge() {
    Bridge b = createPersistBridge(ManagedResourceStatus.READY);
    ListResult<Processor> results = processorService.getProcessors(b.getId(), TestConstants.DEFAULT_CUSTOMER_ID, new QueryInfo(0, 100));
    assertThat(results.getPage()).isZero();
    assertThat(results.getSize()).isZero();
    assertThat(results.getTotal()).isZero();
}
Also used : Processor(com.redhat.service.bridge.manager.models.Processor) QueryInfo(com.redhat.service.bridge.infra.models.QueryInfo) Bridge(com.redhat.service.bridge.manager.models.Bridge) Test(org.junit.jupiter.api.Test) QuarkusTest(io.quarkus.test.junit.QuarkusTest)

Example 3 with QueryInfo

use of com.redhat.service.bridge.infra.models.QueryInfo in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorServiceTest method getProcessors.

@Test
public void getProcessors() {
    Bridge b = createPersistBridge(ManagedResourceStatus.READY);
    ProcessorRequest r = new ProcessorRequest("My Processor", createKafkaAction());
    Processor processor = processorService.createProcessor(b.getId(), b.getCustomerId(), r);
    await().atMost(5, SECONDS).untilAsserted(() -> {
        Processor p = processorDAO.findById(processor.getId());
        assertThat(p).isNotNull();
        assertThat(p.getDependencyStatus()).isEqualTo(ManagedResourceStatus.READY);
    });
    ListResult<Processor> results = processorService.getProcessors(b.getId(), TestConstants.DEFAULT_CUSTOMER_ID, new QueryInfo(0, 100));
    assertThat(results.getPage()).isZero();
    assertThat(results.getSize()).isEqualTo(1L);
    assertThat(results.getTotal()).isEqualTo(1L);
    assertThat(results.getItems().get(0).getId()).isEqualTo(processor.getId());
}
Also used : Processor(com.redhat.service.bridge.manager.models.Processor) ProcessorRequest(com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest) QueryInfo(com.redhat.service.bridge.infra.models.QueryInfo) Bridge(com.redhat.service.bridge.manager.models.Bridge) Test(org.junit.jupiter.api.Test) QuarkusTest(io.quarkus.test.junit.QuarkusTest)

Example 4 with QueryInfo

use of com.redhat.service.bridge.infra.models.QueryInfo in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class BridgeDAOTest method testListByCustomerId.

@Test
public void testListByCustomerId() {
    Bridge firstBridge = buildBridge(TestConstants.DEFAULT_BRIDGE_ID, TestConstants.DEFAULT_BRIDGE_NAME);
    bridgeDAO.persist(firstBridge);
    Bridge secondBridge = buildBridge("mySecondBridgeId", "mySecondBridgeName");
    bridgeDAO.persist(secondBridge);
    ListResult<Bridge> retrievedBridges = bridgeDAO.findByCustomerId(TestConstants.DEFAULT_CUSTOMER_ID, new QueryInfo(TestConstants.DEFAULT_PAGE, TestConstants.DEFAULT_PAGE_SIZE));
    assertThat(retrievedBridges).isNotNull();
    assertThat(retrievedBridges.getSize()).isEqualTo(2);
    assertThat(retrievedBridges.getTotal()).isEqualTo(2);
    assertThat(retrievedBridges.getPage()).isZero();
    // Newest istances come first
    assertThat(retrievedBridges.getItems().get(1).getId()).isEqualTo(firstBridge.getId());
    assertThat(retrievedBridges.getItems().get(0).getId()).isEqualTo(secondBridge.getId());
}
Also used : QueryInfo(com.redhat.service.bridge.infra.models.QueryInfo) Bridge(com.redhat.service.bridge.manager.models.Bridge) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Example 5 with QueryInfo

use of com.redhat.service.bridge.infra.models.QueryInfo in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorDAOTest method findByBridgeIdAndCustomerId_noProcessors.

@Test
public void findByBridgeIdAndCustomerId_noProcessors() {
    Bridge b = createBridge();
    ListResult<Processor> listResult = processorDAO.findByBridgeIdAndCustomerId(b.getId(), TestConstants.DEFAULT_CUSTOMER_ID, new QueryInfo(0, 100));
    assertThat(listResult.getPage()).isZero();
    assertThat(listResult.getSize()).isZero();
    assertThat(listResult.getTotal()).isZero();
}
Also used : Processor(com.redhat.service.bridge.manager.models.Processor) QueryInfo(com.redhat.service.bridge.infra.models.QueryInfo) Bridge(com.redhat.service.bridge.manager.models.Bridge) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Aggregations

QueryInfo (com.redhat.service.bridge.infra.models.QueryInfo)11 Bridge (com.redhat.service.bridge.manager.models.Bridge)11 QuarkusTest (io.quarkus.test.junit.QuarkusTest)11 Test (org.junit.jupiter.api.Test)11 Processor (com.redhat.service.bridge.manager.models.Processor)6 BridgeRequest (com.redhat.service.bridge.manager.api.models.requests.BridgeRequest)2 ProcessorRequest (com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest)2 BaseFilter (com.redhat.service.bridge.infra.models.filters.BaseFilter)1 StringEquals (com.redhat.service.bridge.infra.models.filters.StringEquals)1 HashSet (java.util.HashSet)1