Skip to content

Commit

Permalink
Replace singular imports by plural
Browse files Browse the repository at this point in the history
  • Loading branch information
adrienmaillard committed Oct 3, 2023
1 parent 9ed25ff commit 6cc747e
Showing 1 changed file with 24 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import static gov.nasa.jpl.aerie.merlin.protocol.types.Duration.HOUR;
import static gov.nasa.jpl.aerie.merlin.protocol.types.Duration.HOURS;
import static gov.nasa.jpl.aerie.merlin.protocol.types.Duration.MICROSECOND;
import static gov.nasa.jpl.aerie.merlin.protocol.types.Duration.MICROSECONDS;
import static gov.nasa.jpl.aerie.merlin.protocol.types.Duration.MILLISECONDS;
import static gov.nasa.jpl.aerie.merlin.protocol.types.Duration.MINUTE;
import static gov.nasa.jpl.aerie.merlin.protocol.types.Duration.MINUTES;
import static gov.nasa.jpl.aerie.merlin.protocol.types.Duration.SECOND;
import static gov.nasa.jpl.aerie.merlin.protocol.types.Duration.SECONDS;
import static org.junit.jupiter.api.Assertions.*;

import gov.nasa.jpl.aerie.constraints.model.DiscreteProfile;
Expand Down Expand Up @@ -414,7 +411,7 @@ void testCoexistencePartialAct() {
"GrowBanana",
Map.of(
"quantity", SerializedValue.of(1),
"growingDuration", SerializedValue.of(Duration.MINUTE.in(MICROSECOND))
"growingDuration", SerializedValue.of(Duration.MINUTE.in(MICROSECONDS))
),
null,
true
Expand Down Expand Up @@ -448,7 +445,7 @@ void testCoexistencePartialActWithParameter() {
"GrowBanana",
Map.of(
"quantity", SerializedValue.of(1),
"growingDuration", SerializedValue.of(Duration.MINUTE.times(2).in(MICROSECOND))
"growingDuration", SerializedValue.of(Duration.MINUTE.times(2).in(MICROSECONDS))
),
null,
true
Expand Down Expand Up @@ -476,7 +473,7 @@ void testCoexistencePartialActWithParameter() {
"GrowBanana",
Map.of(
"quantity", SerializedValue.of(2),
"growingDuration", SerializedValue.of(Duration.MINUTE.times(2).in(MICROSECOND))
"growingDuration", SerializedValue.of(Duration.MINUTE.times(2).in(MICROSECONDS))
),
null,
true
Expand Down Expand Up @@ -514,12 +511,12 @@ export default () => Goal.CoexistenceGoal({
final var growBananas = planByActivityType.get("GrowBanana");
assertEquals(3, growBananas.size());
final var planByTime = partitionByStartTime(results.updatedPlan());
assertEquals(2, planByTime.get(MINUTE.times(10)).size());
assertEquals(2, planByTime.get(MINUTES.times(10)).size());
var lookingFor = false;
final var expectedCreation = new SerializedActivity("GrowBanana",
Map.of("quantity", SerializedValue.of(1),
"growingDuration", SerializedValue.of(MINUTES.in(MICROSECOND))));
for(final var actAtTime10: planByTime.get(MINUTE.times(10))){
"growingDuration", SerializedValue.of(MINUTES.in(MICROSECONDS))));
for(final var actAtTime10: planByTime.get(MINUTES.times(10))){
if(actAtTime10.serializedActivity().equals(expectedCreation)){
lookingFor = true;
}
Expand All @@ -530,19 +527,19 @@ export default () => Goal.CoexistenceGoal({
@Test
void testRecurrenceWithActivityFinder() {
final var expectedMatch1 = new ActivityDirective(
Duration.of(0, Duration.SECONDS),
Duration.of(0, SECONDS),
"GrowBanana",
Map.of(
"quantity", SerializedValue.of(2),
"growingDuration", SerializedValue.of(Duration.of(1, Duration.SECONDS).in(Duration.MICROSECONDS))),
"growingDuration", SerializedValue.of(Duration.of(1, SECONDS).in(Duration.MICROSECONDS))),
null,
true);
final var expectedMatch2 = new ActivityDirective(
Duration.of(1, Duration.HOUR.times(24)),
"GrowBanana",
Map.of(
"quantity", SerializedValue.of(2),
"growingDuration", SerializedValue.of(Duration.of(2, Duration.SECONDS).in(Duration.MICROSECONDS))),
"growingDuration", SerializedValue.of(Duration.of(2, SECONDS).in(Duration.MICROSECONDS))),
null,
true);

Expand All @@ -556,7 +553,7 @@ void testRecurrenceWithActivityFinder() {
"GrowBanana",
Map.of(
"quantity", SerializedValue.of(3),
"growingDuration", SerializedValue.of(Duration.of(3, Duration.SECONDS).in(Duration.MICROSECONDS))),
"growingDuration", SerializedValue.of(Duration.of(3, SECONDS).in(Duration.MICROSECONDS))),
null,
true)
),
Expand Down Expand Up @@ -593,11 +590,11 @@ void testCardinalityGoalWithActivityFinder() {
final var results = runScheduler(
BANANANATION,
List.of(new ActivityDirective(
Duration.of(0, Duration.SECONDS),
Duration.of(0, SECONDS),
"GrowBanana",
Map.of(
"quantity", SerializedValue.of(2),
"growingDuration", SerializedValue.of(Duration.of(5, Duration.SECONDS).in(Duration.MICROSECONDS))),
"growingDuration", SerializedValue.of(Duration.of(5, SECONDS).in(Duration.MICROSECONDS))),
null,
true)),
List.of(new SchedulingGoal(new GoalId(0L),
Expand Down Expand Up @@ -689,7 +686,7 @@ void testSingleActivityPlanSimpleCoexistenceGoalWithWindowReference() {
"GrowBanana",
Map.of(
"quantity", SerializedValue.of(1),
"growingDuration", SerializedValue.of(Duration.MINUTE.in(MICROSECOND))
"growingDuration", SerializedValue.of(Duration.MINUTE.in(MICROSECONDS))
),
null,
true
Expand Down Expand Up @@ -726,7 +723,7 @@ export default () => Goal.CoexistenceGoal({
final var created = iterator.next();

assertEquals(SerializedValue.of(10), created.serializedActivity().getArguments().get("quantity"));
assertEquals(SerializedValue.of(Duration.of(2, Duration.MINUTES).in(MICROSECOND)), created.serializedActivity().getArguments().get("growingDuration"));
assertEquals(SerializedValue.of(Duration.of(2, Duration.MINUTES).in(MICROSECONDS)), created.serializedActivity().getArguments().get("growingDuration"));
assertEquals(Duration.of(7, Duration.MINUTES), created.startOffset());
}

Expand Down Expand Up @@ -1721,7 +1718,7 @@ void testExternalResource() {

final var myBooleanResource = new DiscreteProfile(
List.of(
new Segment<>(Interval.between(HOUR.times(2), HOUR.times(4)), SerializedValue.of(true))
new Segment<>(Interval.between(HOURS.times(2), HOURS.times(4)), SerializedValue.of(true))
)
).assignGaps(new DiscreteProfile(List.of(new Segment(Interval.FOREVER, SerializedValue.of(false)))));

Expand Down Expand Up @@ -1749,34 +1746,34 @@ export default (): Goal => {
assertEquals(1, results.updatedPlan().size());
final var planByActivityType = partitionByActivityType(results.updatedPlan());
final var peelBanana = planByActivityType.get("PeelBanana").iterator().next();
assertEquals(HOUR.times(2), peelBanana.startOffset());
assertEquals(HOURS.times(2), peelBanana.startOffset());
}

@Test
void testApplyWhen() {
final var growBananaDuration = Duration.of(1, Duration.SECONDS);
final var growBananaDuration = Duration.of(1, SECONDS);

final var results = runScheduler(
BANANANATION,
List.of(
new ActivityDirective(
Duration.of(1, Duration.SECONDS),
Duration.of(1, SECONDS),
"GrowBanana",
Map.of(
"quantity", SerializedValue.of(1),
"growingDuration", SerializedValue.of(growBananaDuration.in(Duration.MICROSECONDS))),
null,
true),
new ActivityDirective(
Duration.of(2, Duration.SECONDS),
Duration.of(2, SECONDS),
"GrowBanana",
Map.of(
"quantity", SerializedValue.of(1),
"growingDuration", SerializedValue.of(growBananaDuration.in(Duration.MICROSECONDS))),
null,
true),
new ActivityDirective(
Duration.of(3, Duration.SECONDS),
Duration.of(3, SECONDS),
"GrowBanana",
Map.of(
"quantity", SerializedValue.of(1),
Expand Down Expand Up @@ -1866,7 +1863,7 @@ void testGlobalSchedulingConditions_conditionSometimesTrue() {
BANANANATION,
List.of(
new ActivityDirective(
Duration.of(24, HOURS).minus(MICROSECOND),
Duration.of(24, HOURS).minus(MICROSECONDS),
"BiteBanana",
Map.of("biteSize", SerializedValue.of(1)),
null,
Expand Down Expand Up @@ -3201,7 +3198,7 @@ export default () => Goal.CoexistenceGoal({
final var daemonChecker = daemonCheckers.iterator().next();

assertEquals(Duration.of(5, MINUTES), zeroDuration.startOffset());
assertEquals(Duration.of(10, MINUTES).plus(Duration.of(1, SECOND)), daemonChecker.startOffset());
assertEquals(Duration.of(10, MINUTES).plus(Duration.of(1, SECONDS)), daemonChecker.startOffset());
}

/**
Expand Down Expand Up @@ -3294,7 +3291,7 @@ export default () => Goal.CoexistenceGoal({

final var peels = planByActivityType.get("PeelBanana");
assertEquals(1, peels.size());
assertEquals(peels.iterator().next().startOffset(), Duration.of(5, MINUTE).plus(Duration.of(2, activityDuration)));
assertEquals(peels.iterator().next().startOffset(), Duration.of(5, MINUTES).plus(Duration.of(2, activityDuration)));
}

@Test
Expand Down

0 comments on commit 6cc747e

Please sign in to comment.