Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[incubator-kie-issues-1131] test migration from V7 to code generation-28 #3651

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Abhitocode
Copy link
Contributor

@Abhitocode Abhitocode commented Aug 29, 2024

Below are the tests with issues, commented the same for each test.

1. CompensationTest

  • compensationInSubSubProcesses
    It appears there are a few nodes that are missing outbound or inbound connections. The BPMN editor didn't indicate any problems, but it turns out that these nodes have no connection to the start node.

error:
java.lang.IllegalStateException: Process could not be validated ![Process 'Default Process' [InSubSubProcess]: Node 'Boundary Compensate 3' [_X-1] Event has no outgoing connection
Process 'Default Process' [InSubSubProcess]: Node 'Compensate Handler 3' [_X-2] Action has no incoming connection.,
Process 'Default Process' [InSubSubProcess]: Node 'Boundary Compensate 2' [_Y-1] Event has no outgoing connection,
Process 'Default Process' [InSubSubProcess]: Node 'Compensate Handler 2' [_Y-2] Action has no incoming connection.,
Process 'Default Process' [InSubSubProcess]: Node 'Compensate Handler 3' [_X-2] Has no connection to the start node.,
Process 'Default Process' [InSubSubProcess]: Node 'Compensate Handler 2' [_Y-2] Has no connection to the start node.]*

2. DataTest

  • testDataStore and testAssociation
    When compiling the code, we cannot resolve method 'metaData' in 'Process'.
    As I understand, the metaData() method is protected, and thus, it isn't directly accessible in the test class.
    How to get process metadata from the process object(only then we can get the definition metadata).

  • testDefaultProcessVariableValue
    CorrelationKeyModel does not have methods named getProcVar and getIntVar .
    This may be due to acutal variables/methods being different in the CorrelationKeyModel.

guidance on above would be helpful.

Closes apache/incubator-kie-issues#1131.

Note: This pr contains tests with error, only for review purpose.

@elguardian elguardian added the question Further information is requested label Aug 30, 2024
@elguardian elguardian self-requested a review September 16, 2024 06:40
assertProcessInstanceAborted(processInstance.getStringId() + 1, kruntime);

assertProcessVarValue(processInstance, "event", "error desde Subproceso");
Application app = ProcessTestHelper.newApplication();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to declare both process

        Application app = ProcessTestHelper.newApplication();
        ProcessTestHelper.registerProcessEventListener(app, new DefaultKogitoProcessEventListener() {
            @Override
            public void afterProcessCompleted(ProcessCompletedEvent event) {
                if ("ErrorsBetweenSubProcess".equals(event.getProcessInstance().getProcessId())) {
                    assertThat(event.getProcessInstance().getState()).isEqualTo(ProcessInstance.STATE_ABORTED);
                }
            }
        });
        ErrorsBetweenSubProcessProcess.newProcess(app);
        org.kie.kogito.process.Process<ErrorsBetweenProcessModel> process = ErrorsBetweenProcessProcess.newProcess(app);
        ErrorsBetweenProcessModel model = process.createModel();
        model.setTipoEvento("error");
        model.setPasoVariable(3);
        ProcessInstance<ErrorsBetweenProcessModel> processInstance = process.createInstance(model);
        processInstance.start();
        assertThat(processInstance.status()).isEqualTo(ProcessInstance.STATE_COMPLETED);

        Assertions.assertEquals("error desde Subproceso", processInstance.variables().getEvent());

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Migrated as above and created a separate pr for the same #3665. Thank you @elguardian : )

Copy link
Contributor

@elguardian elguardian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate process test migration from v7 legacy runtime to code generation
2 participants