From 2975c51d1b89e0d5a06557129ff5d9aac4f31b86 Mon Sep 17 00:00:00 2001 From: richardwang98 Date: Fri, 17 Mar 2023 10:33:14 -0400 Subject: [PATCH] remove old complex workflow and replace it with master Workflow --- workflow-examples/run_examples.sh | 2 +- .../complex/ComplexWorkFlowConfiguration.java | 205 ------------------ .../MockApprovalWorkFlowCheckerTask.java | 54 ----- .../master/MasterWorkFlowConfiguration.java | 37 +++- .../NamespaceApprovalWorkFlowCheckerTask.java | 4 +- .../task/OnboardingAssessmentTask.java | 5 +- .../simple/task/LoggingWorkFlowTask.java | 2 +- ...spaceApprovalWorkFlowCheckerTaskTest.java} | 25 +-- .../task/OnboardingAssessmentTaskTest.java | 3 +- 9 files changed, 55 insertions(+), 282 deletions(-) delete mode 100644 workflow-examples/src/main/java/com/redhat/parodos/examples/complex/ComplexWorkFlowConfiguration.java delete mode 100644 workflow-examples/src/main/java/com/redhat/parodos/examples/complex/checker/MockApprovalWorkFlowCheckerTask.java rename workflow-examples/src/main/java/com/redhat/parodos/examples/{complex => master}/task/OnboardingAssessmentTask.java (98%) rename workflow-examples/src/test/java/com/redhat/parodos/examples/{complex/checker/MockApprovalWorkFlowCheckerTaskTest.java => master/checker/NamespaceApprovalWorkFlowCheckerTaskTest.java} (63%) rename workflow-examples/src/test/java/com/redhat/parodos/examples/{complex => master}/task/OnboardingAssessmentTaskTest.java (95%) diff --git a/workflow-examples/run_examples.sh b/workflow-examples/run_examples.sh index d0b397951..2ba009385 100755 --- a/workflow-examples/run_examples.sh +++ b/workflow-examples/run_examples.sh @@ -292,7 +292,7 @@ run_escalation_flow() { }' | jq -r '.workFlowExecutionId')" echo " " - echo "******** Simple Esalation Flow Completed (check logs as the checkers are still running) ********" + echo "******** Simple Escalation Flow Completed (check logs as the checkers are still running) ********" echo " " } diff --git a/workflow-examples/src/main/java/com/redhat/parodos/examples/complex/ComplexWorkFlowConfiguration.java b/workflow-examples/src/main/java/com/redhat/parodos/examples/complex/ComplexWorkFlowConfiguration.java deleted file mode 100644 index 73a2a50a0..000000000 --- a/workflow-examples/src/main/java/com/redhat/parodos/examples/complex/ComplexWorkFlowConfiguration.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Copyright (c) 2022 Red Hat Developer - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.redhat.parodos.examples.complex; - -import java.util.concurrent.Executors; - -import com.redhat.parodos.examples.complex.checker.MockApprovalWorkFlowCheckerTask; -import com.redhat.parodos.examples.complex.task.OnboardingAssessmentTask; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import com.redhat.parodos.examples.simple.task.LoggingWorkFlowTask; -import com.redhat.parodos.workflow.annotation.Assessment; -import com.redhat.parodos.workflow.annotation.Checker; -import com.redhat.parodos.workflow.annotation.Infrastructure; -import com.redhat.parodos.workflow.consts.WorkFlowConstants; -import com.redhat.parodos.workflow.option.WorkFlowOption; -import com.redhat.parodos.workflows.workflow.ParallelFlow; -import com.redhat.parodos.workflows.workflow.SequentialFlow; -import com.redhat.parodos.workflows.workflow.WorkFlow; - -/** - * A more complex WorkFlow - * - * @author Luke Shannon (Github: lshannon) - */ -@Configuration -public class ComplexWorkFlowConfiguration { - - // START assessmentWorkFlow definition - - // A WorkflowOption describing in user-friendly terms what a Workflow does - this can - // be used in a UI to provide choices to a User on which Workflow to run - @Bean - WorkFlowOption onboardingOption() { - return new WorkFlowOption.Builder("onboardingOption", - "onboardingWorkFlow" + WorkFlowConstants.INFRASTRUCTURE_WORKFLOW) - .addToDetails("An example of a complex WorkFlow with Status checks").displayName("Onboarding") - .setDescription("An example of a complex WorkFlow").build(); - } - - // An AssessmentTask returns one or more WorkFlowOption wrapped in a WorkflowOptions - @Bean - OnboardingAssessmentTask onboardingAssessmentTask( - @Qualifier("onboardingOption") WorkFlowOption awesomeToolsOption) { - return new OnboardingAssessmentTask(awesomeToolsOption); - } - - // A Workflow designed to execute and return WorkflowOption(s) that can be executed - // next. In this case there is only one. - @Bean(name = "onboardingAssessment" + WorkFlowConstants.ASSESSMENT_WORKFLOW) - @Assessment - WorkFlow assessmentWorkFlow( - @Qualifier("onboardingAssessmentTask") OnboardingAssessmentTask onboardingAssessmentTask) { - // @formatter:off - return SequentialFlow.Builder.aNewSequentialFlow() - .named("onboardingAssessment" + WorkFlowConstants.ASSESSMENT_WORKFLOW) - .execute(onboardingAssessmentTask) - .build(); - // @formatter:on - } - - // END assessmentWorkFlow definition - - // Start onboardingWorkFlow" + WorkFlowConstants.INFRASTRUCTURE_WORKFLOW definition - // (this is the Workflow described in the WorkflowOption above) - @Bean - LoggingWorkFlowTask certWorkFlowTask(@Qualifier("namespaceWorkFlow" - + WorkFlowConstants.CHECKER_WORKFLOW) WorkFlow namespaceWorkFlowCheckerWorkFlow) { - LoggingWorkFlowTask loggingWorkFlow = new LoggingWorkFlowTask(); - loggingWorkFlow.setWorkFlowChecker(namespaceWorkFlowCheckerWorkFlow); - return loggingWorkFlow; - } - - @Bean - LoggingWorkFlowTask adGroupWorkFlowTask(@Qualifier("onboardingWorkFlow" - + WorkFlowConstants.CHECKER_WORKFLOW) WorkFlow onboardingWorkFlowCheckerWorkFlow) { - LoggingWorkFlowTask loggingWorkFlow = new LoggingWorkFlowTask(); - loggingWorkFlow.setWorkFlowChecker(onboardingWorkFlowCheckerWorkFlow); - return loggingWorkFlow; - } - - @Bean - LoggingWorkFlowTask dynatraceWorkFlowTask(@Qualifier("onboardingWorkFlow" - + WorkFlowConstants.CHECKER_WORKFLOW) WorkFlow onboardingWorkFlowCheckerWorkFlow) { - LoggingWorkFlowTask loggingWorkFlow = new LoggingWorkFlowTask(); - loggingWorkFlow.setWorkFlowChecker(onboardingWorkFlowCheckerWorkFlow); - return loggingWorkFlow; - } - - // runs the set of Tasks associated with "Onboarding" - @Bean(name = "onboardingWorkFlow" + WorkFlowConstants.INFRASTRUCTURE_WORKFLOW) - @Infrastructure - WorkFlow onboardingWorkflow(@Qualifier("certWorkFlowTask") LoggingWorkFlowTask certWorkFlowTask, - @Qualifier("adGroupWorkFlowTask") LoggingWorkFlowTask adGroupWorkFlowTask, - @Qualifier("dynatraceWorkFlowTask") LoggingWorkFlowTask dynatraceWorkFlowTask) { - // @formatter:off - return ParallelFlow.Builder.aNewParallelFlow() - .named("onboardingWorkFlow" + WorkFlowConstants.INFRASTRUCTURE_WORKFLOW) - .execute(certWorkFlowTask, adGroupWorkFlowTask, dynatraceWorkFlowTask) - .with(Executors.newFixedThreadPool(3)) - .build(); - // @formatter:on - } - // End onboardingWorkFlow" + WorkFlowConstants.INFRASTRUCTURE_WORKFLOW definition - - // Start Name Space Logic - @Bean - LoggingWorkFlowTask nameSpaceWorkFlowTask(@Qualifier("namespaceWorkFlow" - + WorkFlowConstants.CHECKER_WORKFLOW) WorkFlow namespaceWorkFlowCheckerWorkFlow) { - LoggingWorkFlowTask loggingWorkFlow = new LoggingWorkFlowTask(); - loggingWorkFlow.setWorkFlowChecker(namespaceWorkFlowCheckerWorkFlow); - return loggingWorkFlow; - } - - @Bean(name = "nameSpaceWorkFlow" + WorkFlowConstants.INFRASTRUCTURE_WORKFLOW) - @Infrastructure - WorkFlow nameSpaceWorkFlow(@Qualifier("nameSpaceWorkFlowTask") LoggingWorkFlowTask nameSpaceWorkFlowTask) { - // @formatter:off - return SequentialFlow.Builder.aNewSequentialFlow() - .named("nameSpaceWorkFlow" + WorkFlowConstants.INFRASTRUCTURE_WORKFLOW) - .execute(nameSpaceWorkFlowTask) - .build(); - // @formatter:on - } - // End Name Space Logic - - // Start networking workflow Logic - @Bean - LoggingWorkFlowTask loadBalancerFlowTask() { - return new LoggingWorkFlowTask(); - } - - @Bean - LoggingWorkFlowTask failOverWorkFlowTask() { - return new LoggingWorkFlowTask(); - } - - @Bean(name = "networkingWorkFlow" + WorkFlowConstants.INFRASTRUCTURE_WORKFLOW) - @Infrastructure - WorkFlow networkingWorkFlow(@Qualifier("loadBalancerFlowTask") LoggingWorkFlowTask networkingFlowTask, - @Qualifier("failOverWorkFlowTask") LoggingWorkFlowTask failOverWorkFlowTask) { - // @formatter:off - return SequentialFlow.Builder.aNewSequentialFlow() - .named("networkingWorkFlow" + WorkFlowConstants.INFRASTRUCTURE_WORKFLOW) - .execute(networkingFlowTask) - .then(failOverWorkFlowTask) - .build(); - // @formatter:on - } - // End networking workflow Logic - - // Start onboardingWorkFlowCheck Logic - @Bean - MockApprovalWorkFlowCheckerTask approvalChecker() { - return new MockApprovalWorkFlowCheckerTask(); - } - - @Bean("onboardingWorkFlow" + WorkFlowConstants.CHECKER_WORKFLOW) - @Checker(cronExpression = "0/5 * * * * ?") - WorkFlow onboardingWorkFlowCheckerWorkFlow( - @Qualifier("approvalChecker") MockApprovalWorkFlowCheckerTask approvalChecker) { - // @formatter:off - return SequentialFlow.Builder.aNewSequentialFlow() - .named("onboardingWorkFlow" + WorkFlowConstants.CHECKER_WORKFLOW) - .execute(approvalChecker) - .build(); - // @formatter:on - } - // End onboardingWorkFlowCheck Logic - - // Start namespaceWorkFlowCheck Logic - @Bean - MockApprovalWorkFlowCheckerTask processCompletionChecker() { - return new MockApprovalWorkFlowCheckerTask(); - } - - @Bean("namespaceWorkFlow" + WorkFlowConstants.CHECKER_WORKFLOW) - @Checker(cronExpression = "0/5 * * * * ?") - WorkFlow namespaceWorkFlowCheckerWorkFlow( - @Qualifier("processCompletionChecker") MockApprovalWorkFlowCheckerTask processCompletionChecker) { - // @formatter:off - return SequentialFlow.Builder.aNewSequentialFlow() - .named("namespaceWorkFlow" + WorkFlowConstants.CHECKER_WORKFLOW) - .execute(processCompletionChecker) - .build(); - // @formatter:on - } - // End namespaceWorkFlowCheck Logic - -} diff --git a/workflow-examples/src/main/java/com/redhat/parodos/examples/complex/checker/MockApprovalWorkFlowCheckerTask.java b/workflow-examples/src/main/java/com/redhat/parodos/examples/complex/checker/MockApprovalWorkFlowCheckerTask.java deleted file mode 100644 index efa9aceb5..000000000 --- a/workflow-examples/src/main/java/com/redhat/parodos/examples/complex/checker/MockApprovalWorkFlowCheckerTask.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2022 Red Hat Developer - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.redhat.parodos.examples.complex.checker; - -import com.redhat.parodos.workflow.task.enums.WorkFlowTaskOutput; -import com.redhat.parodos.workflow.task.checker.BaseWorkFlowCheckerTask; -import com.redhat.parodos.workflow.task.parameter.WorkFlowTaskParameter; -import com.redhat.parodos.workflows.work.DefaultWorkReport; -import com.redhat.parodos.workflows.work.WorkContext; -import com.redhat.parodos.workflows.work.WorkReport; -import com.redhat.parodos.workflows.work.WorkStatus; -import java.util.List; -import lombok.extern.slf4j.Slf4j; -import java.util.Collections; - -/** - * A simple example of a WorkFlowChecker that always returns true - * - * @author Luke Shannon (Github: lshannon) - * - */ -@Slf4j -public class MockApprovalWorkFlowCheckerTask extends BaseWorkFlowCheckerTask { - - @Override - public WorkReport checkWorkFlowStatus(WorkContext context) { - log.info("Mocking a successful workflow checker task"); - return new DefaultWorkReport(WorkStatus.COMPLETED, context); - } - - @Override - public List getWorkFlowTaskParameters() { - return Collections.emptyList(); - } - - @Override - public List getWorkFlowTaskOutputs() { - return Collections.emptyList(); - } - -} diff --git a/workflow-examples/src/main/java/com/redhat/parodos/examples/master/MasterWorkFlowConfiguration.java b/workflow-examples/src/main/java/com/redhat/parodos/examples/master/MasterWorkFlowConfiguration.java index 367ada129..4bfe547c3 100644 --- a/workflow-examples/src/main/java/com/redhat/parodos/examples/master/MasterWorkFlowConfiguration.java +++ b/workflow-examples/src/main/java/com/redhat/parodos/examples/master/MasterWorkFlowConfiguration.java @@ -1,16 +1,20 @@ package com.redhat.parodos.examples.master; +import com.redhat.parodos.examples.master.checker.NamespaceApprovalWorkFlowCheckerTask; +import com.redhat.parodos.examples.master.checker.SslCertificationApprovalWorkFlowCheckerTask; import com.redhat.parodos.examples.master.task.AdGroupsWorkFlowTask; import com.redhat.parodos.examples.master.task.LoadBalancerWorkFlowTask; import com.redhat.parodos.examples.master.task.NamespaceWorkFlowTask; +import com.redhat.parodos.examples.master.task.OnboardingAssessmentTask; import com.redhat.parodos.examples.master.task.SingleSignOnWorkFlowTask; import com.redhat.parodos.examples.master.task.SplunkMonitoringWorkFlowTask; import com.redhat.parodos.examples.master.task.SslCertificationWorkFlowTask; -import com.redhat.parodos.examples.master.checker.NamespaceApprovalWorkFlowCheckerTask; -import com.redhat.parodos.examples.master.checker.SslCertificationApprovalWorkFlowCheckerTask; +import com.redhat.parodos.workflow.annotation.Assessment; import com.redhat.parodos.workflow.annotation.Checker; import com.redhat.parodos.workflow.annotation.Infrastructure; import com.redhat.parodos.workflow.annotation.Parameter; +import com.redhat.parodos.workflow.consts.WorkFlowConstants; +import com.redhat.parodos.workflow.option.WorkFlowOption; import com.redhat.parodos.workflow.parameter.WorkFlowParameterType; import com.redhat.parodos.workflows.workflow.ParallelFlow; import com.redhat.parodos.workflows.workflow.SequentialFlow; @@ -24,6 +28,35 @@ @Configuration public class MasterWorkFlowConfiguration { + // Assessment workflow + @Bean + WorkFlowOption onboardingOption() { + return new WorkFlowOption.Builder("onboardingOption", "masterWorkFlow") + .addToDetails("An example workflow option of a complex master WorkFlow with Status checks") + .displayName("Onboarding").setDescription("An example of a complex WorkFlow").build(); + } + + // An AssessmentTask returns one or more WorkFlowOption wrapped in a WorkflowOptions + @Bean + OnboardingAssessmentTask onboardingAssessmentTask( + @Qualifier("onboardingOption") WorkFlowOption awesomeToolsOption) { + return new OnboardingAssessmentTask(awesomeToolsOption); + } + + // A Workflow designed to execute and return WorkflowOption(s) that can be executed + // next. In this case there is only one. + @Bean(name = "onboardingAssessment" + WorkFlowConstants.ASSESSMENT_WORKFLOW) + @Assessment + WorkFlow assessmentWorkFlow( + @Qualifier("onboardingAssessmentTask") OnboardingAssessmentTask onboardingAssessmentTask) { + // @formatter:off + return SequentialFlow.Builder.aNewSequentialFlow() + .named("onboardingAssessment" + WorkFlowConstants.ASSESSMENT_WORKFLOW) + .execute(onboardingAssessmentTask) + .build(); + // @formatter:on + } + // SUB WORKFLOW ONE: // Parallel Flow: // - AdGroupsWorkFlowTask diff --git a/workflow-examples/src/main/java/com/redhat/parodos/examples/master/checker/NamespaceApprovalWorkFlowCheckerTask.java b/workflow-examples/src/main/java/com/redhat/parodos/examples/master/checker/NamespaceApprovalWorkFlowCheckerTask.java index b7e53d62a..380c7f1b9 100644 --- a/workflow-examples/src/main/java/com/redhat/parodos/examples/master/checker/NamespaceApprovalWorkFlowCheckerTask.java +++ b/workflow-examples/src/main/java/com/redhat/parodos/examples/master/checker/NamespaceApprovalWorkFlowCheckerTask.java @@ -1,12 +1,12 @@ package com.redhat.parodos.examples.master.checker; -import com.redhat.parodos.workflow.task.enums.WorkFlowTaskOutput; +import com.redhat.parodos.workflows.work.WorkStatus; import com.redhat.parodos.workflow.task.checker.BaseWorkFlowCheckerTask; +import com.redhat.parodos.workflow.task.enums.WorkFlowTaskOutput; import com.redhat.parodos.workflow.task.parameter.WorkFlowTaskParameter; import com.redhat.parodos.workflows.work.DefaultWorkReport; import com.redhat.parodos.workflows.work.WorkContext; import com.redhat.parodos.workflows.work.WorkReport; -import com.redhat.parodos.workflows.work.WorkStatus; import lombok.extern.slf4j.Slf4j; import java.util.Collections; diff --git a/workflow-examples/src/main/java/com/redhat/parodos/examples/complex/task/OnboardingAssessmentTask.java b/workflow-examples/src/main/java/com/redhat/parodos/examples/master/task/OnboardingAssessmentTask.java similarity index 98% rename from workflow-examples/src/main/java/com/redhat/parodos/examples/complex/task/OnboardingAssessmentTask.java rename to workflow-examples/src/main/java/com/redhat/parodos/examples/master/task/OnboardingAssessmentTask.java index 6e1193e5a..cbf72078a 100644 --- a/workflow-examples/src/main/java/com/redhat/parodos/examples/complex/task/OnboardingAssessmentTask.java +++ b/workflow-examples/src/main/java/com/redhat/parodos/examples/master/task/OnboardingAssessmentTask.java @@ -13,19 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.redhat.parodos.examples.complex.task; +package com.redhat.parodos.examples.master.task; import com.redhat.parodos.workflow.context.WorkContextDelegate; import com.redhat.parodos.workflow.option.WorkFlowOption; import com.redhat.parodos.workflow.option.WorkFlowOptions; -import com.redhat.parodos.workflow.task.enums.WorkFlowTaskOutput; import com.redhat.parodos.workflow.task.assessment.BaseAssessmentTask; +import com.redhat.parodos.workflow.task.enums.WorkFlowTaskOutput; import com.redhat.parodos.workflow.task.parameter.WorkFlowTaskParameter; import com.redhat.parodos.workflow.task.parameter.WorkFlowTaskParameterType; import com.redhat.parodos.workflows.work.DefaultWorkReport; import com.redhat.parodos.workflows.work.WorkContext; import com.redhat.parodos.workflows.work.WorkReport; import com.redhat.parodos.workflows.work.WorkStatus; + import java.util.Collections; import java.util.List; diff --git a/workflow-examples/src/main/java/com/redhat/parodos/examples/simple/task/LoggingWorkFlowTask.java b/workflow-examples/src/main/java/com/redhat/parodos/examples/simple/task/LoggingWorkFlowTask.java index d9fb83bb5..446dce200 100644 --- a/workflow-examples/src/main/java/com/redhat/parodos/examples/simple/task/LoggingWorkFlowTask.java +++ b/workflow-examples/src/main/java/com/redhat/parodos/examples/simple/task/LoggingWorkFlowTask.java @@ -57,7 +57,7 @@ public WorkReport execute(WorkContext workContext) { catch (Exception e) { log.error("There was an issue with the task {}: {}", getName(), e.getMessage()); } - return new DefaultWorkReport(WorkStatus.COMPLETED, workContext); + return new DefaultWorkReport(WorkStatus.FAILED, workContext); } @Override diff --git a/workflow-examples/src/test/java/com/redhat/parodos/examples/complex/checker/MockApprovalWorkFlowCheckerTaskTest.java b/workflow-examples/src/test/java/com/redhat/parodos/examples/master/checker/NamespaceApprovalWorkFlowCheckerTaskTest.java similarity index 63% rename from workflow-examples/src/test/java/com/redhat/parodos/examples/complex/checker/MockApprovalWorkFlowCheckerTaskTest.java rename to workflow-examples/src/test/java/com/redhat/parodos/examples/master/checker/NamespaceApprovalWorkFlowCheckerTaskTest.java index 77d16e017..044005411 100644 --- a/workflow-examples/src/test/java/com/redhat/parodos/examples/complex/checker/MockApprovalWorkFlowCheckerTaskTest.java +++ b/workflow-examples/src/test/java/com/redhat/parodos/examples/master/checker/NamespaceApprovalWorkFlowCheckerTaskTest.java @@ -1,9 +1,8 @@ -package com.redhat.parodos.examples.complex.checker; +package com.redhat.parodos.examples.master.checker; import com.redhat.parodos.examples.base.BaseWorkFlowCheckerTaskTest; -import com.redhat.parodos.examples.complex.checker.MockApprovalWorkFlowCheckerTask; -import com.redhat.parodos.workflow.task.enums.WorkFlowTaskOutput; import com.redhat.parodos.workflow.task.checker.BaseWorkFlowCheckerTask; +import com.redhat.parodos.workflow.task.enums.WorkFlowTaskOutput; import com.redhat.parodos.workflow.task.parameter.WorkFlowTaskParameter; import com.redhat.parodos.workflows.work.WorkContext; import com.redhat.parodos.workflows.work.WorkReport; @@ -17,26 +16,26 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; -import static org.mockito.Mockito.spy; /** - * Mock Approval WorkFlow Checker Task execution test + * Namespace Approval WorkFlow Checker Task execution test * * @author Gloria Ciavarrini (Github: gciavarrini) + * @author Richard Wang(Github: richardw98) */ -public class MockApprovalWorkFlowCheckerTaskTest extends BaseWorkFlowCheckerTaskTest { +public class NamespaceApprovalWorkFlowCheckerTaskTest extends BaseWorkFlowCheckerTaskTest { - MockApprovalWorkFlowCheckerTask mockApprovalWorkFlowCheckerTask; + NamespaceApprovalWorkFlowCheckerTask namespaceApprovalWorkFlowCheckerTask; @Before public void setUp() { - mockApprovalWorkFlowCheckerTask = Mockito - .spy((MockApprovalWorkFlowCheckerTask) getConcretePersonImplementation()); + namespaceApprovalWorkFlowCheckerTask = Mockito + .spy((NamespaceApprovalWorkFlowCheckerTask) getConcretePersonImplementation()); } @Override protected BaseWorkFlowCheckerTask getConcretePersonImplementation() { - return new MockApprovalWorkFlowCheckerTask(); + return new NamespaceApprovalWorkFlowCheckerTask(); } @Test @@ -45,7 +44,7 @@ public void checkWorkFlowStatus() { WorkContext workContext = Mockito.mock(WorkContext.class); // when - WorkReport workReport = mockApprovalWorkFlowCheckerTask.checkWorkFlowStatus(workContext); + WorkReport workReport = namespaceApprovalWorkFlowCheckerTask.checkWorkFlowStatus(workContext); assertNotNull(workReport); assertEquals(WorkStatus.COMPLETED, workReport.getStatus()); assertNull(workReport.getError()); @@ -54,7 +53,7 @@ public void checkWorkFlowStatus() { @Test public void getWorkFlowTaskParameters() { // when - List workFlowTaskParameters = mockApprovalWorkFlowCheckerTask + List workFlowTaskParameters = namespaceApprovalWorkFlowCheckerTask .getWorkFlowTaskParameters(); // then @@ -65,7 +64,7 @@ public void getWorkFlowTaskParameters() { @Test public void getWorkFlowTaskOutputs() { // when - List workFlowTaskOutputs = mockApprovalWorkFlowCheckerTask.getWorkFlowTaskOutputs(); + List workFlowTaskOutputs = namespaceApprovalWorkFlowCheckerTask.getWorkFlowTaskOutputs(); // then assertNotNull(workFlowTaskOutputs); diff --git a/workflow-examples/src/test/java/com/redhat/parodos/examples/complex/task/OnboardingAssessmentTaskTest.java b/workflow-examples/src/test/java/com/redhat/parodos/examples/master/task/OnboardingAssessmentTaskTest.java similarity index 95% rename from workflow-examples/src/test/java/com/redhat/parodos/examples/complex/task/OnboardingAssessmentTaskTest.java rename to workflow-examples/src/test/java/com/redhat/parodos/examples/master/task/OnboardingAssessmentTaskTest.java index 6b3f350e6..2dd279956 100644 --- a/workflow-examples/src/test/java/com/redhat/parodos/examples/complex/task/OnboardingAssessmentTaskTest.java +++ b/workflow-examples/src/test/java/com/redhat/parodos/examples/master/task/OnboardingAssessmentTaskTest.java @@ -1,7 +1,6 @@ -package com.redhat.parodos.examples.complex.task; +package com.redhat.parodos.examples.master.task; import com.redhat.parodos.examples.base.BaseAssessmentTaskTest; -import com.redhat.parodos.examples.complex.task.OnboardingAssessmentTask; import com.redhat.parodos.workflow.option.WorkFlowOption; import com.redhat.parodos.workflow.task.assessment.BaseAssessmentTask; import com.redhat.parodos.workflow.task.enums.WorkFlowTaskOutput;