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);
}
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);
}
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());
}
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);
}
Aggregations