Search in sources :

Example 21 with Processor

use of com.redhat.service.bridge.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ConnectorsServiceTest method testProcessor.

private Processor testProcessor() {
    Processor processor = new Processor();
    processor.setId(TEST_PROCESSOR_ID);
    processor.setName(TEST_PROCESSOR_NAME);
    return processor;
}
Also used : Processor(com.redhat.service.bridge.manager.models.Processor)

Example 22 with Processor

use of com.redhat.service.bridge.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorDAOTest method createProcessor.

private Processor createProcessor(Bridge bridge, String name) {
    Processor p = new Processor();
    p.setBridge(bridge);
    p.setName(name);
    p.setStatus(ManagedResourceStatus.ACCEPTED);
    p.setSubmittedAt(ZonedDateTime.now());
    p.setPublishedAt(ZonedDateTime.now());
    p.setShardId(TestConstants.SHARD_ID);
    BaseAction a = new BaseAction();
    a.setType(KafkaTopicAction.TYPE);
    Map<String, String> params = new HashMap<>();
    params.put(KafkaTopicAction.TOPIC_PARAM, TestConstants.DEFAULT_KAFKA_TOPIC);
    a.setParameters(params);
    ProcessorDefinition definition = new ProcessorDefinition(Collections.emptySet(), null, a);
    p.setDefinition(mapper.valueToTree(definition));
    processorDAO.persist(p);
    return p;
}
Also used : Processor(com.redhat.service.bridge.manager.models.Processor) HashMap(java.util.HashMap) ProcessorDefinition(com.redhat.service.bridge.infra.models.processors.ProcessorDefinition) BaseAction(com.redhat.service.bridge.infra.models.actions.BaseAction)

Example 23 with Processor

use of com.redhat.service.bridge.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ProcessorDAOTest method findProcessorsToBeDeployedOrDelete.

@Test
@Transactional
public void findProcessorsToBeDeployedOrDelete() {
    Bridge b = createBridge();
    // To be provisioned
    Processor p = createProcessor(b, "foo");
    p.setDependencyStatus(ManagedResourceStatus.READY);
    processorDAO.getEntityManager().merge(p);
    // Already provisioned
    Processor q = createProcessor(b, "bob");
    q.setStatus(ManagedResourceStatus.READY);
    q.setDependencyStatus(ManagedResourceStatus.READY);
    processorDAO.getEntityManager().merge(q);
    // To be de-provisioned
    Processor r = createProcessor(b, "frank");
    r.setStatus(ManagedResourceStatus.DEPROVISION);
    r.setDependencyStatus(ManagedResourceStatus.DELETED);
    processorDAO.getEntityManager().merge(r);
    List<Processor> processors = processorDAO.findByShardIdWithReadyDependencies(TestConstants.SHARD_ID);
    assertThat(processors.size()).isEqualTo(2);
    processors.forEach((px) -> assertThat(px.getName()).isIn("foo", "frank"));
}
Also used : Processor(com.redhat.service.bridge.manager.models.Processor) Bridge(com.redhat.service.bridge.manager.models.Bridge) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test) Transactional(javax.transaction.Transactional)

Example 24 with Processor

use of com.redhat.service.bridge.manager.models.Processor 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)

Example 25 with Processor

use of com.redhat.service.bridge.manager.models.Processor in project sandbox by 5733d9e2be6485d52ffa08870cabdee0.

the class ConnectorsApiClientTest method testProcessor.

private Processor testProcessor() {
    Processor processor = new Processor();
    processor.setId(TEST_PROCESSOR_ID);
    processor.setName(TEST_PROCESSOR_NAME);
    return processor;
}
Also used : Processor(com.redhat.service.bridge.manager.models.Processor)

Aggregations

Processor (com.redhat.service.bridge.manager.models.Processor)52 Bridge (com.redhat.service.bridge.manager.models.Bridge)34 QuarkusTest (io.quarkus.test.junit.QuarkusTest)32 Test (org.junit.jupiter.api.Test)32 ProcessorRequest (com.redhat.service.bridge.manager.api.models.requests.ProcessorRequest)14 ConnectorEntity (com.redhat.service.bridge.manager.models.ConnectorEntity)9 BaseAction (com.redhat.service.bridge.infra.models.actions.BaseAction)7 ItemNotFoundException (com.redhat.service.bridge.infra.exceptions.definitions.user.ItemNotFoundException)6 QueryInfo (com.redhat.service.bridge.infra.models.QueryInfo)6 Transactional (javax.transaction.Transactional)6 Connector (com.openshift.cloud.api.connector.models.Connector)5 ProcessorDefinition (com.redhat.service.bridge.infra.models.processors.ProcessorDefinition)5 ConnectorStatusStatus (com.openshift.cloud.api.connector.models.ConnectorStatusStatus)4 InternalPlatformException (com.redhat.service.bridge.infra.exceptions.definitions.platform.InternalPlatformException)4 Work (com.redhat.service.bridge.manager.models.Work)4 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 ZonedDateTime (java.time.ZonedDateTime)3 ConnectorRequest (com.openshift.cloud.api.connector.models.ConnectorRequest)2 AlreadyExistingItemException (com.redhat.service.bridge.infra.exceptions.definitions.user.AlreadyExistingItemException)2 ProcessorDTO (com.redhat.service.bridge.infra.models.dto.ProcessorDTO)2