diff --git a/examples/banananation/src/test/java/gov/nasa/jpl/aerie/banananation/SimulationUtility.java b/examples/banananation/src/test/java/gov/nasa/jpl/aerie/banananation/SimulationUtility.java index 093b93fce7..e0383b3a08 100644 --- a/examples/banananation/src/test/java/gov/nasa/jpl/aerie/banananation/SimulationUtility.java +++ b/examples/banananation/src/test/java/gov/nasa/jpl/aerie/banananation/SimulationUtility.java @@ -3,15 +3,20 @@ import gov.nasa.jpl.aerie.banananation.generated.GeneratedModelType; import gov.nasa.jpl.aerie.merlin.driver.*; import gov.nasa.jpl.aerie.merlin.protocol.types.Duration; +import gov.nasa.jpl.aerie.merlin.protocol.types.SerializedValue; import gov.nasa.jpl.aerie.types.ActivityDirective; import gov.nasa.jpl.aerie.types.ActivityDirectiveId; +import gov.nasa.jpl.aerie.types.Plan; import gov.nasa.jpl.aerie.types.SerializedActivity; +import gov.nasa.jpl.aerie.types.Timestamp; import org.apache.commons.lang3.tuple.Pair; import java.nio.file.Path; import java.time.Instant; +import java.time.temporal.ChronoUnit; import java.util.HashMap; import java.util.Map; +import java.util.concurrent.ExecutionException; public final class SimulationUtility { public static SimulationResults @@ -19,19 +24,23 @@ public final class SimulationUtility { final var dataPath = Path.of(SimulationUtility.class.getResource("data/lorem_ipsum.txt").getPath()); final var config = new Configuration(Configuration.DEFAULT_PLANT_COUNT, Configuration.DEFAULT_PRODUCER, dataPath, Configuration.DEFAULT_INITIAL_CONDITIONS); final var startTime = Instant.now(); - final var missionModel = gov.nasa.jpl.aerie.stateless.simulation.SimulationUtility.instantiateMissionModel( + final var missionModel = gov.nasa.jpl.aerie.orchestration.simulation.SimulationUtility.instantiateMissionModel( new GeneratedModelType(), Instant.EPOCH, config); - return SimulationDriver.simulate( - missionModel, + final var plan = new Plan( + "plan", + new Timestamp(startTime), + new Timestamp(startTime.plus(simulationDuration.in(Duration.MICROSECOND), ChronoUnit.MICROS)), schedule, - startTime, - simulationDuration, - startTime, - simulationDuration, - () -> false); + Map.of("initialDataPath", SerializedValue.of(dataPath.toString()))); + + try(final var simUtil = new gov.nasa.jpl.aerie.orchestration.simulation.SimulationUtility()) { + return simUtil.simulate(missionModel, plan).get(); + } catch (ExecutionException | InterruptedException e) { + throw new RuntimeException(e); + } } @SafeVarargs