diff --git a/e2e-tests/src/main/java/gov/nasa/jpl/aerie/e2e/procedural/scheduling/procedures/ExternalEventsSourceQueryGoal.java b/e2e-tests/src/main/java/gov/nasa/jpl/aerie/e2e/procedural/scheduling/procedures/ExternalEventsSourceQueryGoal.java index bc285a9d98..e48739c2a7 100644 --- a/e2e-tests/src/main/java/gov/nasa/jpl/aerie/e2e/procedural/scheduling/procedures/ExternalEventsSourceQueryGoal.java +++ b/e2e-tests/src/main/java/gov/nasa/jpl/aerie/e2e/procedural/scheduling/procedures/ExternalEventsSourceQueryGoal.java @@ -17,7 +17,7 @@ public record ExternalEventsSourceQueryGoal() implements Goal { @Override public void run(@NotNull final EditablePlan plan) { - // demonstrate more complicated query functionality + // extract events belonging to the second source EventQuery eventQuery = new EventQuery( null, null, @@ -25,7 +25,14 @@ public void run(@NotNull final EditablePlan plan) { ); for (final var e: plan.events(eventQuery)) { - plan.create("BiteBanana", new DirectiveStart.Absolute(e.getInterval().start), Map.of("biteSize", SerializedValue.of(1))); + // filter events that we schedule off of by key + if (e.key.contains("01")) { + plan.create( + "BiteBanana", + // place the directive such that it is coincident with the event's start + new DirectiveStart.Absolute(e.getInterval().start), + Map.of("biteSize", SerializedValue.of(1))); + } } plan.commit(); } diff --git a/e2e-tests/src/test/java/gov/nasa/jpl/aerie/e2e/procedural/scheduling/ExternalEventsTests.java b/e2e-tests/src/test/java/gov/nasa/jpl/aerie/e2e/procedural/scheduling/ExternalEventsTests.java index 0b9d1b68f0..c1928a9c54 100644 --- a/e2e-tests/src/test/java/gov/nasa/jpl/aerie/e2e/procedural/scheduling/ExternalEventsTests.java +++ b/e2e-tests/src/test/java/gov/nasa/jpl/aerie/e2e/procedural/scheduling/ExternalEventsTests.java @@ -41,7 +41,7 @@ public class ExternalEventsTests extends ProceduralSchedulingSetup { externalSource.key(), externalSource.derivation_group_name(), "2023-01-01T01:00:00Z", - "00:10:00" + "01:00:00" ), new HasuraRequests.ExternalEvent( "Event_02", @@ -49,7 +49,7 @@ public class ExternalEventsTests extends ProceduralSchedulingSetup { externalSource.key(), externalSource.derivation_group_name(), "2023-01-01T03:00:00Z", - "00:10:00" + "01:00:00" ), new HasuraRequests.ExternalEvent( "Event_03", @@ -57,7 +57,7 @@ public class ExternalEventsTests extends ProceduralSchedulingSetup { externalSource.key(), externalSource.derivation_group_name(), "2023-01-01T05:00:00Z", - "00:10:00" + "01:00:00" ) ); @@ -65,7 +65,7 @@ public class ExternalEventsTests extends ProceduralSchedulingSetup { "NewTest.json", SOURCE_TYPE, ADDITIONAL_DERIVATION_GROUP, - "2024-01-02T00:00:00Z", + "2024-01-01T00:00:00Z", "2023-01-01T00:00:00Z", "2023-01-08T00:00:00Z", "2024-10-01T00:00:00Z" @@ -78,7 +78,7 @@ public class ExternalEventsTests extends ProceduralSchedulingSetup { additionalExternalSource.key(), additionalExternalSource.derivation_group_name(), "2023-01-02T01:00:00Z", - "00:10:00" + "01:00:00" ), new HasuraRequests.ExternalEvent( "Event_02", @@ -86,7 +86,7 @@ public class ExternalEventsTests extends ProceduralSchedulingSetup { additionalExternalSource.key(), additionalExternalSource.derivation_group_name(), "2023-01-02T03:00:00Z", - "00:10:00" + "01:00:00" ), new HasuraRequests.ExternalEvent( "Event_03", @@ -94,7 +94,7 @@ public class ExternalEventsTests extends ProceduralSchedulingSetup { additionalExternalSource.key(), additionalExternalSource.derivation_group_name(), "2023-01-02T05:00:00Z", - "00:10:00" + "01:00:00" ) ); @@ -223,17 +223,12 @@ void testExternalEventSourceQuery() throws IOException { final var plan = hasura.getPlan(planId); final var activities = plan.activityDirectives(); - // ensure the orderings line up - activities.sort(Comparator.comparing(Plan.ActivityDirective::startOffset)); - - // compare arrays - assertEquals(additionalExternalEvents.size(), activities.size()); - for (int i = 0; i < activities.size(); i++) { - Instant activityStartTime = Duration.addToInstant( - Instant.parse(planStartTimestamp), - Duration.fromString(activities.get(i).startOffset()) - ); - assertEquals(activityStartTime.toString(), additionalExternalEvents.get(i).start_time()); - } + // only 1 activity this time + assertEquals(1, activities.size()); + Instant activityStartTime = Duration.addToInstant( + Instant.parse(planStartTimestamp), + Duration.fromString(activities.get(0).startOffset()) + ); + assertEquals(activityStartTime.toString(), additionalExternalEvents.get(0).start_time()); } }