Search in sources :

Example 1 with MessageDesc

use of org.jbpm.services.api.model.MessageDesc in project jbpm by kiegroup.

the class MessageDescImplTest method testEqualsHashCode.

@Test
public void testEqualsHashCode() {
    MessageDesc message1 = MessageDescImpl.from(new Message("id"));
    MessageDesc message2 = MessageDescImpl.from(new Message("id"));
    assertEquals(message1.hashCode(), message2.hashCode());
    assertEquals(message1, message2);
}
Also used : Message(org.jbpm.bpmn2.core.Message) MessageDesc(org.jbpm.services.api.model.MessageDesc) Test(org.junit.Test)

Example 2 with MessageDesc

use of org.jbpm.services.api.model.MessageDesc in project jbpm by kiegroup.

the class MessageDescImplTest method testNotEqualsHashCode.

@Test
public void testNotEqualsHashCode() {
    Message message1 = new Message("id");
    Message message2 = new Message("id");
    message2.setName("name");
    message2.setName("type");
    MessageDesc messageDesc1 = MessageDescImpl.from(message1);
    MessageDesc messageDesc2 = MessageDescImpl.from(message2);
    assertNotEquals(messageDesc1.hashCode(), messageDesc2.hashCode());
    assertNotEquals(messageDesc1, messageDesc2);
}
Also used : Message(org.jbpm.bpmn2.core.Message) MessageDesc(org.jbpm.services.api.model.MessageDesc) Test(org.junit.Test)

Example 3 with MessageDesc

use of org.jbpm.services.api.model.MessageDesc in project jbpm by kiegroup.

the class BPMN2DataServicesReferencesTest method testMessageDesc.

@Test
public void testMessageDesc() {
    ProcessDefinition procDef = bpmn2Service.getProcessDefinition(deploymentId, "Minimal");
    assertNotNull(procDef);
    Collection<MessageDesc> signals = procDef.getMessagesDesc();
    assertNotNull("Message description should not be null", signals);
    assertFalse("Message description should not be empty", signals.isEmpty());
    MessageDesc message = signals.iterator().next();
    assertEquals("HelloMessage", message.getId());
    assertEquals("HelloMessage", message.getName());
    assertFalse(message.getIncomingNodes().isEmpty());
    Node startNode = message.getIncomingNodes().iterator().next();
    assertTrue(startNode instanceof StartNode);
    assertTrue(message.getOutgoingNodes().isEmpty());
    assertEquals("String", message.getStructureRef());
}
Also used : StartNode(org.jbpm.workflow.core.node.StartNode) StartNode(org.jbpm.workflow.core.node.StartNode) Node(org.kie.api.definition.process.Node) ProcessDefinition(org.jbpm.services.api.model.ProcessDefinition) MessageDesc(org.jbpm.services.api.model.MessageDesc) AbstractKieServicesBaseTest(org.jbpm.kie.test.util.AbstractKieServicesBaseTest) Test(org.junit.Test)

Example 4 with MessageDesc

use of org.jbpm.services.api.model.MessageDesc in project droolsjbpm-integration by kiegroup.

the class KafkaServerRegistrationTest method testVersionedDeployment.

@Test
public void testVersionedDeployment() {
    KafkaServerRegistration register = new KafkaServerRegistration();
    DeployedUnitImpl du1 = new DeployedUnitImpl(new KModuleDeploymentUnit("individuo", "pepe", "1.0"));
    DeployedUnitImpl du2 = new DeployedUnitImpl(new KModuleDeploymentUnit("individuo", "pepe", "2.0"));
    Message message = new Message("pepe");
    message.setName("pepe");
    Node node = mock(Node.class);
    message.addIncomingNode(node);
    MessageDesc signal = MessageDescImpl.from(message);
    ProcessAssetDesc processDesc = new ProcessAssetDesc();
    processDesc.setMessagesDesc(Collections.singletonList(signal));
    du1.addAssetLocation("pepe", processDesc);
    du2.addAssetLocation("pepe", processDesc);
    DeploymentEvent event1 = new DeploymentEvent(du1.getDeploymentUnit().getIdentifier(), du1);
    DeploymentEvent event2 = new DeploymentEvent(du2.getDeploymentUnit().getIdentifier(), du2);
    register.addRegistration(event1);
    register.addRegistration(event2);
    ConsumerRecord<String, byte[]> record = mock(ConsumerRecord.class);
    when(record.topic()).thenReturn("pepe");
    KafkaServerEventProcessor<MessageDesc> processor = mock(KafkaServerEventProcessor.class);
    register.forEachMessage(record, processor);
    verify(processor).accept(record, event1.getDeploymentId(), signal);
    verify(processor).accept(record, event2.getDeploymentId(), signal);
    reset(processor);
    message.addIncomingNode(mock(StartNode.class));
    register.forEachMessage(record, processor);
    verify(processor, times(0)).accept(record, event1.getDeploymentId(), signal);
    verify(processor).accept(record, event2.getDeploymentId(), signal);
}
Also used : StartNode(org.jbpm.workflow.core.node.StartNode) ProcessAssetDesc(org.jbpm.kie.services.impl.model.ProcessAssetDesc) Message(org.jbpm.bpmn2.core.Message) StartNode(org.jbpm.workflow.core.node.StartNode) Node(org.kie.api.definition.process.Node) DeployedUnitImpl(org.jbpm.kie.services.impl.DeployedUnitImpl) KModuleDeploymentUnit(org.jbpm.kie.services.impl.KModuleDeploymentUnit) MessageDesc(org.jbpm.services.api.model.MessageDesc) DeploymentEvent(org.jbpm.services.api.DeploymentEvent) Test(org.junit.Test)

Aggregations

MessageDesc (org.jbpm.services.api.model.MessageDesc)4 Test (org.junit.Test)4 Message (org.jbpm.bpmn2.core.Message)3 StartNode (org.jbpm.workflow.core.node.StartNode)2 Node (org.kie.api.definition.process.Node)2 DeployedUnitImpl (org.jbpm.kie.services.impl.DeployedUnitImpl)1 KModuleDeploymentUnit (org.jbpm.kie.services.impl.KModuleDeploymentUnit)1 ProcessAssetDesc (org.jbpm.kie.services.impl.model.ProcessAssetDesc)1 AbstractKieServicesBaseTest (org.jbpm.kie.test.util.AbstractKieServicesBaseTest)1 DeploymentEvent (org.jbpm.services.api.DeploymentEvent)1 ProcessDefinition (org.jbpm.services.api.model.ProcessDefinition)1