Skip to content

Commit c55d70f

Browse files
authored
Merge pull request #1833 from NASA-AMMOS/feat/change-plan-bounds
Allow Plan Bounds to be Changed
2 parents 258629a + 98ff7c2 commit c55d70f

20 files changed

Lines changed: 3309 additions & 826 deletions

File tree

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

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package gov.nasa.jpl.aerie.database;
22

3-
import gov.nasa.jpl.aerie.database.PlanCollaborationTests.Activity;
43
import org.junit.jupiter.api.AfterAll;
54
import org.junit.jupiter.api.AfterEach;
65
import org.junit.jupiter.api.BeforeAll;
@@ -50,39 +49,6 @@ void afterAll() throws SQLException, IOException, InterruptedException {
5049
}
5150

5251
//region Helper Methods
53-
private Activity getActivity(final int planId, final int activityId) throws SQLException {
54-
try (final var statement = connection.createStatement()) {
55-
final var res = statement.executeQuery(
56-
// language=sql
57-
"""
58-
SELECT *
59-
FROM merlin.activity_directive
60-
WHERE id = %d
61-
AND plan_id = %d;
62-
""".formatted(activityId, planId));
63-
64-
res.next();
65-
66-
return new Activity(
67-
res.getInt("id"),
68-
res.getInt("plan_id"),
69-
res.getString("name"),
70-
res.getInt("source_scheduling_goal_id"),
71-
res.getInt("source_scheduling_goal_invocation_id"),
72-
res.getString("created_at"),
73-
res.getString("created_by"),
74-
res.getString("last_modified_at"),
75-
res.getString("last_modified_by"),
76-
res.getString("start_offset"),
77-
res.getString("type"),
78-
res.getString("arguments"),
79-
res.getString("last_modified_arguments_at"),
80-
res.getString("metadata"),
81-
res.getString("anchor_id"),
82-
res.getBoolean("anchored_to_start")
83-
);
84-
}
85-
}
8652
private void updateActivityStartOffset(int planId, int activityDirectiveId, String newOffset) throws SQLException {
8753
try (final var statement = connection.createStatement()) {
8854
final var updatedRows = statement.executeQuery(
@@ -171,7 +137,7 @@ void changelogRevisionHasCorrectValues() throws SQLException {
171137
""".formatted(planId, activityId));
172138

173139
res.next();
174-
final var current = getActivity(planId, activityId);
140+
final var current = merlinHelper.getActivity(planId, activityId);
175141

176142
assertEquals(current.activityId(), res.getInt("activity_directive_id"));
177143
assertEquals(current.planId(), res.getInt("plan_id"));
@@ -239,7 +205,7 @@ void revertNonExistentRevisionThrowsError() throws SQLException {
239205
void shouldRevertActDirToChangelogEntry() throws SQLException {
240206
final var activityId = merlinHelper.insertActivity(planId);
241207

242-
final var actDirBefore = getActivity(planId, activityId);
208+
final var actDirBefore = merlinHelper.getActivity(planId, activityId);
243209

244210
try (final var statement = connection.createStatement()) {
245211
statement.executeQuery(
@@ -254,10 +220,10 @@ void shouldRevertActDirToChangelogEntry() throws SQLException {
254220
RETURNING *;
255221
""".formatted(planId, activityId));
256222
}
257-
final var actDirMid = getActivity(planId, activityId);
223+
final var actDirMid = merlinHelper.getActivity(planId, activityId);
258224

259225
revertActivityDirectiveToChangelog(planId, activityId, 0);
260-
final var actDirAfter = getActivity(planId, activityId);
226+
final var actDirAfter = merlinHelper.getActivity(planId, activityId);
261227

262228
assertNotEquals(actDirBefore.name(), actDirMid.name());
263229
assertNotEquals(actDirBefore.startOffset(), actDirMid.startOffset());

0 commit comments

Comments
 (0)