use of org.kie.kogito.index.model.ProcessInstance in project kogito-apps by kiegroup.
the class ProcessInstanceEntityMapperIT method testMapToModel.
@Test
void testMapToModel() {
ProcessInstance result = mapper.mapToModel(processInstanceEntity);
assertThat(result).usingRecursiveComparison().isEqualTo(processInstance);
}
use of org.kie.kogito.index.model.ProcessInstance in project kogito-apps by kiegroup.
the class ProcessInstanceMarshallerTest method testWriteTo.
@Test
void testWriteTo() throws IOException {
ProcessInstance pi = new ProcessInstance();
pi.setId("id");
pi.setEndpoint("endpoint");
pi.setProcessId("processId");
pi.setProcessName("processName");
pi.setRootProcessInstanceId("rootProcessInstanceId");
pi.setParentProcessInstanceId("rootProcessInstanceId");
pi.setRootProcessId("rootProcessId");
pi.setRoles(singleton("admin"));
pi.setVariables(null);
pi.setNodes(emptyList());
pi.setState(ProcessInstanceState.ERROR.ordinal());
pi.setStart(ZonedDateTime.now());
pi.setError(new ProcessInstanceError("StartEvent_1", "Something went wrong"));
pi.setMilestones(emptyList());
MessageMarshaller.ProtoStreamWriter writer = mock(MessageMarshaller.ProtoStreamWriter.class);
ProcessInstanceMarshaller marshaller = new ProcessInstanceMarshaller(null);
marshaller.writeTo(writer, pi);
InOrder inOrder = inOrder(writer);
inOrder.verify(writer).writeString(ID, pi.getId());
inOrder.verify(writer).writeString(PROCESS_ID, pi.getProcessId());
inOrder.verify(writer).writeCollection(ROLES, pi.getRoles(), String.class);
inOrder.verify(writer).writeString(VARIABLES, null);
inOrder.verify(writer).writeString(ENDPOINT, pi.getEndpoint());
inOrder.verify(writer).writeCollection(NODES, pi.getNodes(), NodeInstance.class);
inOrder.verify(writer).writeInt(STATE, pi.getState());
inOrder.verify(writer).writeDate(START, marshaller.zonedDateTimeToDate(pi.getStart()));
inOrder.verify(writer).writeDate(END, marshaller.zonedDateTimeToDate(pi.getEnd()));
inOrder.verify(writer).writeString(ROOT_PROCESS_INSTANCE_ID, pi.getRootProcessInstanceId());
inOrder.verify(writer).writeString(ROOT_PROCESS_ID, pi.getRootProcessId());
inOrder.verify(writer).writeString(PARENT_PROCESS_INSTANCE_ID, pi.getParentProcessInstanceId());
inOrder.verify(writer).writeString(PROCESS_NAME, pi.getProcessName());
inOrder.verify(writer).writeObject(ERROR, pi.getError(), ProcessInstanceError.class);
inOrder.verify(writer).writeCollection(ADDONS, pi.getAddons(), String.class);
inOrder.verify(writer).writeDate(LAST_UPDATE, marshaller.zonedDateTimeToDate(pi.getLastUpdate()));
inOrder.verify(writer).writeString(BUSINESS_KEY, pi.getBusinessKey());
inOrder.verify(writer).writeCollection(MILESTONES, pi.getMilestones(), Milestone.class);
}
use of org.kie.kogito.index.model.ProcessInstance in project kogito-apps by kiegroup.
the class ProcessInstanceStorageIT method testProcessInstanceEntity.
@Test
@Transactional
public void testProcessInstanceEntity() {
String processInstanceId = UUID.randomUUID().toString();
ProcessInstance processInstance1 = TestUtils.createProcessInstance(processInstanceId, RandomStringUtils.randomAlphabetic(5), UUID.randomUUID().toString(), RandomStringUtils.randomAlphabetic(10), ProcessInstanceState.ACTIVE.ordinal(), 0L);
ProcessInstance processInstance2 = TestUtils.createProcessInstance(processInstanceId, RandomStringUtils.randomAlphabetic(5), UUID.randomUUID().toString(), RandomStringUtils.randomAlphabetic(10), ProcessInstanceState.COMPLETED.ordinal(), 1000L);
testStorage(processInstanceId, processInstance1, processInstance2);
}
use of org.kie.kogito.index.model.ProcessInstance in project kogito-apps by kiegroup.
the class ProcessInstanceEntityMapperTest method testMapToModel.
@Test
void testMapToModel() {
ProcessInstance result = processInstanceEntityMapper.mapToModel(processInstanceEntity);
assertEquals(processInstance, result);
}
use of org.kie.kogito.index.model.ProcessInstance in project kogito-apps by kiegroup.
the class ProcessInstanceStorageIT method testProcessInstanceEntity.
@Test
@Transactional
public void testProcessInstanceEntity() {
String processInstanceId = UUID.randomUUID().toString();
ProcessInstance processInstance1 = TestUtils.createProcessInstance(processInstanceId, RandomStringUtils.randomAlphabetic(5), UUID.randomUUID().toString(), RandomStringUtils.randomAlphabetic(10), ProcessInstanceState.ACTIVE.ordinal(), 0L);
ProcessInstance processInstance2 = TestUtils.createProcessInstance(processInstanceId, RandomStringUtils.randomAlphabetic(5), UUID.randomUUID().toString(), RandomStringUtils.randomAlphabetic(10), ProcessInstanceState.COMPLETED.ordinal(), 1000L);
testStorage(processInstanceId, processInstance1, processInstance2);
}
Aggregations