X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=runtime%2Forg.argeo.slc.unit%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Funit%2Fprocess%2FSlcExecutionTestUtils.java;h=65f3ec1dd271a768ce30d3369536981dd5631e95;hb=b811ec0603b1e596f26eee8a5378c6294cba495d;hp=8bf94160175e87784f2ed313bda2c8582b90af3f;hpb=ee6c3543a0ff9403420ce6a9c647723269f14331;p=gpl%2Fargeo-slc.git diff --git a/runtime/org.argeo.slc.unit/src/main/java/org/argeo/slc/unit/process/SlcExecutionTestUtils.java b/runtime/org.argeo.slc.unit/src/main/java/org/argeo/slc/unit/process/SlcExecutionTestUtils.java index 8bf941601..65f3ec1dd 100644 --- a/runtime/org.argeo.slc.unit/src/main/java/org/argeo/slc/unit/process/SlcExecutionTestUtils.java +++ b/runtime/org.argeo.slc.unit/src/main/java/org/argeo/slc/unit/process/SlcExecutionTestUtils.java @@ -1,13 +1,34 @@ +/* + * Copyright (C) 2010 Mathieu Baudier + * + * 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 + * + * http://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 org.argeo.slc.unit.process; import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNotNull; import static org.argeo.slc.unit.UnitUtils.assertDateSec; +import java.util.ArrayList; +import java.util.List; import java.util.UUID; +import org.argeo.slc.execution.ExecutionFlowDescriptor; +import org.argeo.slc.process.RealizedFlow; import org.argeo.slc.process.SlcExecution; import org.argeo.slc.process.SlcExecutionStep; +import org.argeo.slc.unit.execution.ExecutionFlowDescriptorTestUtils; public abstract class SlcExecutionTestUtils { @@ -22,6 +43,21 @@ public abstract class SlcExecutionTestUtils { return slcExec; } + public static SlcExecution createSlcExecutionWithRealizedFlows() { + SlcExecution slcExec = SlcExecutionTestUtils.createSimpleSlcExecution(); + List realizedFlows = new ArrayList(); + RealizedFlow realizedFlow = new RealizedFlow(); + ExecutionFlowDescriptor flowDescriptor = ExecutionFlowDescriptorTestUtils + .createSimpleExecutionFlowDescriptor(); + realizedFlow.setModuleName("test.module"); + realizedFlow.setModuleVersion("1.0.0"); + realizedFlow.setFlowDescriptor(flowDescriptor); + realizedFlow.setExecutionSpec(flowDescriptor.getExecutionSpec()); + realizedFlows.add(realizedFlow); + slcExec.setRealizedFlows(realizedFlows); + return slcExec; + } + public static void assertSlcExecution(SlcExecution expected, SlcExecution reached) { assertNotNull(reached); @@ -46,6 +82,11 @@ public abstract class SlcExecutionTestUtils { SlcExecutionStep stepReached = reached.getSteps().get(i); assertSlcExecutionStep(stepExpected, stepReached); } + + // FIXME: compare realized flows + // assertEquals(expected.getRealizedFlows().size(), reached + // .getRealizedFlows().size()); + } public static void assertSlcExecutionStep(SlcExecutionStep expected, @@ -53,7 +94,13 @@ public abstract class SlcExecutionTestUtils { assertNotNull(reached); assertEquals(expected.getUuid(), reached.getUuid()); assertEquals(expected.getType(), reached.getType()); - assertDateSec(expected.getBegin(), reached.getBegin()); + assertDateSec(expected.getTimestamp(), reached.getTimestamp()); + assertEquals(expected.getLogLines().size(), reached.getLogLines() + .size()); + for (int i = 0; i < expected.getLogLines().size(); i++) { + assertEquals(expected.getLogLines().get(i), reached.getLogLines() + .get(i)); + } } private SlcExecutionTestUtils() {