Skip to content

Commit 98ff7c2

Browse files
committed
Update test
1 parent 8a7b3a0 commit 98ff7c2

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

db-tests/src/test/java/gov/nasa/jpl/aerie/database/PlanCollaborationTests.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -826,10 +826,14 @@ void restoresChangedActivities() throws SQLException {
826826
*/
827827
@Test
828828
void restoresPlanBounds() throws SQLException {
829+
// Create a plan with an activity
829830
final var planId = merlinHelper.insertPlan(missionModelId, merlinHelper.user.name());
831+
final var activity = merlinHelper.getActivity(planId, merlinHelper.insertActivity(planId, "10:00:00"));
830832

831833
// Update plan bounds
832-
merlinHelper.updatePlanDuration(planId, "28:00:00");
834+
merlinHelper.updatePlanBounds(planId, "2026-01-01T00:00:00", "28:00:00");
835+
// Verify the activity has had its start offset updated
836+
assertNotEquals(activity.startOffset(), activity.refresh(merlinHelper).startOffset());
833837

834838
// Get a handle on the revision
835839
final var oldRevision = merlinHelper.getPlanRevision(planId);
@@ -851,8 +855,10 @@ void restoresPlanBounds() throws SQLException {
851855
// The plan's revision should have been updated
852856
assertTrue(merlinHelper.getPlanRevision(planId) > oldRevision);
853857

854-
// The added activity should be gone
855-
assertTrue(merlinHelper.getActivities(planId).isEmpty());
858+
// The added activity should be gone, and the original activity should be restored to its initial state
859+
final var planActivities = merlinHelper.getActivities(planId);
860+
assertEquals(1, planActivities.size());
861+
Activity.assertActivityEquals(activity, planActivities.getFirst());
856862

857863
// A new snapshot should have been created
858864
final var newSnapshotId = getLatestSnapshot(planId);
@@ -862,11 +868,11 @@ void restoresPlanBounds() throws SQLException {
862868
final var snapshot = getSnapshotMetadata(newSnapshotId);
863869
assertEquals("Plan Bound Adjustment", snapshot.snapshot_name);
864870
assertEquals("Automatic snapshot made before adjusting plan bounds from "
865-
+ "[2020-01-01 00:00:00+00 - 2020-01-02 04:00:00+00] to "
871+
+ "[2026-01-01 00:00:00+00 - 2026-01-02 04:00:00+00] to "
866872
+ "[2020-01-01 00:00:00+00 - 2020-01-01 00:00:00+00]", snapshot.description);
867873
assertEquals(planId, snapshot.plan_id);
868874
assertEquals(missionModelId, snapshot.model_id);
869-
assertEquals("2020-01-01 00:00:00+00", snapshot.planStartTime);
875+
assertEquals("2026-01-01 00:00:00+00", snapshot.planStartTime);
870876
assertEquals("28:00:00", snapshot.planDuration);
871877
}
872878
}

0 commit comments

Comments
 (0)