Skip to content

Commit

Permalink
Fix save activity name test
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelCourtney committed Oct 9, 2024
1 parent 23dd612 commit 5a098ca
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
import gov.nasa.ammos.aerie.procedural.scheduling.plan.EditablePlan;
import gov.nasa.ammos.aerie.procedural.scheduling.Goal;
import gov.nasa.ammos.aerie.procedural.scheduling.annotations.SchedulingProcedure;
import gov.nasa.ammos.aerie.procedural.scheduling.plan.NewDirective;
import gov.nasa.ammos.aerie.procedural.timeline.payloads.activities.AnyDirective;
import gov.nasa.jpl.aerie.merlin.protocol.types.Duration;
import gov.nasa.ammos.aerie.procedural.timeline.payloads.activities.DirectiveStart;
import gov.nasa.jpl.aerie.merlin.protocol.types.SerializedValue;
import org.jetbrains.annotations.NotNull;

import java.util.Map;
Expand All @@ -23,9 +26,12 @@ public void run(@NotNull final EditablePlan plan) {
var currentTime = firstTime;
for (var i = 0; i < quantity; i++) {
plan.create(
"BiteBanana",
new DirectiveStart.Absolute(currentTime),
Map.of()
new NewDirective(
new AnyDirective(Map.of("biteSize", SerializedValue.of(1))),
"It's a bite banana activity",
"BiteBanana",
new DirectiveStart.Absolute(currentTime)
)
);
currentTime = currentTime.plus(step);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1000,20 +1000,5 @@ void schedulingIgnoreDisabledGoals() throws IOException {
}
}
}
/**
* Run a spec with one procedure and make sure the activity names are saved to the database
*/
@Test
void saveActivityName() throws IOException {
final var args = Json.createObjectBuilder().add("quantity", 2).build();
hasura.updateSchedulingSpecGoalArguments(procedureId.invocationId(), args);

final var resp = hasura.awaitScheduling(specId);

final var plan = hasura.getPlan(planId);
final var activities = plan.activityDirectives();

assertEquals(2, activities.size());
assertEquals("It's a bite banana activity", activities.getFirst().name());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,21 @@ void executeEDSLAndProcedure() throws IOException {

assertEquals(52, activities.size());
}

/**
* Run a spec with one procedure and make sure the activity names are saved to the database
*/
@Test
void saveActivityName() throws IOException {
final var args = Json.createObjectBuilder().add("quantity", 2).build();
hasura.updateSchedulingSpecGoalArguments(procedureId.invocationId(), args);

hasura.awaitScheduling(specId);

final var plan = hasura.getPlan(planId);
final var activities = plan.activityDirectives();

assertEquals(2, activities.size());
assertEquals("It's a bite banana activity", activities.getFirst().name());
}
}

0 comments on commit 5a098ca

Please sign in to comment.