Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove unnecessary assertDoesNotThrow calls
Browse files Browse the repository at this point in the history
pranav-super committed Oct 15, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent b060da3 commit d4b08b6
Showing 1 changed file with 943 additions and 1,003 deletions.
1,946 changes: 943 additions & 1,003 deletions db-tests/src/test/java/gov/nasa/jpl/aerie/database/ExternalEventTests.java
Original file line number Diff line number Diff line change
@@ -356,7 +356,7 @@ void derivationGroupComp() throws SQLException {
record DGCompExternalSource(String key, String derivationGroup, String includedEvents){}

// upload all source data
assertDoesNotThrow(() -> upload_source(dg));
upload_source(dg);
try(final var statement = connection.createStatement()) {

// check that derivation_group_comp has 1 entry, with 4 sources and 7 events
@@ -552,47 +552,45 @@ void testForwardOverlap() throws SQLException {
ExternalEvent bE = new ExternalEvent(b.key() + "_event", st, b.key(), dg, b.start_time(), duration, mt);

// verify the ranges are as expected
assertDoesNotThrow(() -> {
// insert generic external event type, source type, and derivation group
insertStandardTypes();
// insert generic external event type, source type, and derivation group
insertStandardTypes();

// insert sources
insertExternalSource(a);
insertExternalSource(b);
// insert sources
insertExternalSource(a);
insertExternalSource(b);

// insert events
insertExternalEvent(aE);
insertExternalEvent(bE);

var results = getDerivedEvents("ORDER BY source_key");

// both ranges should only have a single element and be fully present
final List<DerivedEvent> expectedResults = List.of(
new DerivedEvent(
"A_event",
"Test",
"A",
"Test Default",
"2024-01-01 01:10:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 01:00:00+00\",\"2024-01-01 02:00:00+00\")}",
"2024-01-01 00:00:00+00"
),
new DerivedEvent(
"B_event",
"Test",
"B",
"Test Default",
"2024-01-01 00:00:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 01:00:00+00\")}",
"2024-01-02 00:00:00+00"
)
);
assertTrue(results.containsAll(expectedResults));
});
// insert events
insertExternalEvent(aE);
insertExternalEvent(bE);

var results = getDerivedEvents("ORDER BY source_key");

// both ranges should only have a single element and be fully present
final List<DerivedEvent> expectedResults = List.of(
new DerivedEvent(
"A_event",
"Test",
"A",
"Test Default",
"2024-01-01 01:10:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 01:00:00+00\",\"2024-01-01 02:00:00+00\")}",
"2024-01-01 00:00:00+00"
),
new DerivedEvent(
"B_event",
"Test",
"B",
"Test Default",
"2024-01-01 00:00:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 01:00:00+00\")}",
"2024-01-02 00:00:00+00"
)
);
assertTrue(results.containsAll(expectedResults));
}
}

@@ -642,47 +640,45 @@ void testBackwardOverlap() throws SQLException {
ExternalEvent bE = new ExternalEvent(b.key() + "_event", st, b.key(), dg, b.start_time(), duration, mt);

// verify the ranges are as expected
assertDoesNotThrow(() -> {
// insert generic external event type, source type, and derivation group
insertStandardTypes();
// insert generic external event type, source type, and derivation group
insertStandardTypes();

// insert sources
insertExternalSource(a);
insertExternalSource(b);
// insert sources
insertExternalSource(a);
insertExternalSource(b);

// insert events
insertExternalEvent(aE);
insertExternalEvent(bE);

var results = getDerivedEvents("ORDER BY source_key");

// both ranges should only have a single element and be fully present
final List<DerivedEvent> expectedResults = List.of(
new DerivedEvent(
"A_event",
"Test",
"A",
"Test Default",
"2024-01-01 00:00:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 00:30:00+00\")}",
"2024-01-01 00:00:00+00"
),
new DerivedEvent(
"B_event",
"Test",
"B",
"Test Default",
"2024-01-01 00:30:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 00:30:00+00\",\"2024-01-01 01:00:00+00\")}",
"2024-01-02 00:00:00+00"
)
);
assertTrue(results.containsAll(expectedResults));
});
// insert events
insertExternalEvent(aE);
insertExternalEvent(bE);

var results = getDerivedEvents("ORDER BY source_key");

// both ranges should only have a single element and be fully present
final List<DerivedEvent> expectedResults = List.of(
new DerivedEvent(
"A_event",
"Test",
"A",
"Test Default",
"2024-01-01 00:00:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 00:30:00+00\")}",
"2024-01-01 00:00:00+00"
),
new DerivedEvent(
"B_event",
"Test",
"B",
"Test Default",
"2024-01-01 00:30:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 00:30:00+00\",\"2024-01-01 01:00:00+00\")}",
"2024-01-02 00:00:00+00"
)
);
assertTrue(results.containsAll(expectedResults));
}
}

@@ -744,59 +740,57 @@ void testBackground() throws SQLException {
ExternalEvent cE = new ExternalEvent(c.key() + "_event", st, c.key(), dg, c.start_time(), duration, mt);

// verify the ranges are as expected
assertDoesNotThrow(() -> {
// insert generic external event type, source type, and derivation group
insertStandardTypes();
// insert generic external event type, source type, and derivation group
insertStandardTypes();

// insert sources
insertExternalSource(a);
insertExternalSource(b);
insertExternalSource(c);
// insert sources
insertExternalSource(a);
insertExternalSource(b);
insertExternalSource(c);

// insert events
insertExternalEvent(aE);
insertExternalEvent(bE);
insertExternalEvent(cE);

var results = getDerivedEvents("ORDER BY source_key");

// both ranges should only have a single element and be fully present
final List<DerivedEvent> expectedResults = List.of(
new DerivedEvent(
"A_event",
"Test",
"A",
"Test Default",
"2024-01-01 01:10:00+00",
"00:00:00.000001",
"{}", "{[\"2024-01-01 01:00:00+00\",\"2024-01-01 01:30:00+00\"),[\"2024-01-01 02:00:00+00\",\"2024-01-01 03:00:00+00\")}",
"2024-01-01 00:00:00+00"
),
new DerivedEvent(
"B_event",
"Test",
"B",
"Test Default",
"2024-01-01 00:00:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 01:00:00+00\")}",
"2024-01-02 00:00:00+00"
),
new DerivedEvent(
"C_event",
"Test",
"C",
"Test Default",
"2024-01-01 01:30:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 01:30:00+00\",\"2024-01-01 02:00:00+00\")}",
"2024-01-03 00:00:00+00"
)
);
assertTrue(results.containsAll(expectedResults));
});
// insert events
insertExternalEvent(aE);
insertExternalEvent(bE);
insertExternalEvent(cE);

var results = getDerivedEvents("ORDER BY source_key");

// both ranges should only have a single element and be fully present
final List<DerivedEvent> expectedResults = List.of(
new DerivedEvent(
"A_event",
"Test",
"A",
"Test Default",
"2024-01-01 01:10:00+00",
"00:00:00.000001",
"{}", "{[\"2024-01-01 01:00:00+00\",\"2024-01-01 01:30:00+00\"),[\"2024-01-01 02:00:00+00\",\"2024-01-01 03:00:00+00\")}",
"2024-01-01 00:00:00+00"
),
new DerivedEvent(
"B_event",
"Test",
"B",
"Test Default",
"2024-01-01 00:00:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 01:00:00+00\")}",
"2024-01-02 00:00:00+00"
),
new DerivedEvent(
"C_event",
"Test",
"C",
"Test Default",
"2024-01-01 01:30:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 01:30:00+00\",\"2024-01-01 02:00:00+00\")}",
"2024-01-03 00:00:00+00"
)
);
assertTrue(results.containsAll(expectedResults));
}
}

@@ -912,106 +906,104 @@ void testAmalgamation() throws SQLException {
ExternalEvent gE = new ExternalEvent(g.key() + "_event", st, g.key(), dg, g.start_time(), duration, mt);

// verify the ranges are as expected
assertDoesNotThrow(() -> {
// insert generic external event type, source type, and derivation group
insertStandardTypes();
// insert generic external event type, source type, and derivation group
insertStandardTypes();

// insert sources
insertExternalSource(a);
insertExternalSource(b);
insertExternalSource(c);
insertExternalSource(d);
insertExternalSource(e);
insertExternalSource(f);
insertExternalSource(g);
// insert sources
insertExternalSource(a);
insertExternalSource(b);
insertExternalSource(c);
insertExternalSource(d);
insertExternalSource(e);
insertExternalSource(f);
insertExternalSource(g);

// insert events
insertExternalEvent(aE);
insertExternalEvent(bE);
insertExternalEvent(cE);
insertExternalEvent(dE);
insertExternalEvent(eE);
insertExternalEvent(fE);
insertExternalEvent(gE);

var results = getDerivedEvents("ORDER BY source_key");

// both ranges should only have a single element and be fully present
final List<DerivedEvent> expectedResults = List.of(
new DerivedEvent(
"A_event",
"Test",
"A",
"Test Default",
"2024-01-01 00:09:10+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 00:09:00+00\",\"2024-01-01 00:11:00+00\"),[\"2024-01-01 00:12:00+00\",\"2024-01-01 00:13:00+00\")}",
"2024-01-01 00:00:00+00"
),
new DerivedEvent(
"B_event",
"Test",
"B",
"Test Default",
"2024-01-01 00:00:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 00:02:00+00\")}",
"2024-01-02 00:00:00+00"
),
new DerivedEvent(
"C_event",
"Test",
"C",
"Test Default",
"2024-01-01 00:21:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 00:20:00+00\",\"2024-01-01 00:23:00+00\")}",
"2024-01-03 00:00:00+00"
),
new DerivedEvent(
"D_event",
"Test",
"D",
"Test Default",
"2024-01-01 00:02:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 00:02:00+00\",\"2024-01-01 00:04:00+00\"),[\"2024-01-01 00:07:00+00\",\"2024-01-01 00:09:00+00\")}",
"2024-01-04 00:00:00+00"
),
new DerivedEvent(
"E_event",
"Test", "E",
"Test Default", "2024-01-01 00:13:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 00:13:00+00\",\"2024-01-01 00:20:00+00\")}",
"2024-01-05 00:00:00+00"
),
new DerivedEvent(
"F_event",
"Test", "F",
"Test Default", "2024-01-01 00:04:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 00:04:00+00\",\"2024-01-01 00:07:00+00\")}",
"2024-01-06 00:00:00+00"
),
new DerivedEvent(
"G_event",
"Test", "G",
"Test Default", "2024-01-01 00:11:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 00:11:00+00\",\"2024-01-01 00:12:00+00\")}",
"2024-01-07 00:00:00+00"
)
);
assertTrue(results.containsAll(expectedResults));
});
// insert events
insertExternalEvent(aE);
insertExternalEvent(bE);
insertExternalEvent(cE);
insertExternalEvent(dE);
insertExternalEvent(eE);
insertExternalEvent(fE);
insertExternalEvent(gE);

var results = getDerivedEvents("ORDER BY source_key");

// both ranges should only have a single element and be fully present
final List<DerivedEvent> expectedResults = List.of(
new DerivedEvent(
"A_event",
"Test",
"A",
"Test Default",
"2024-01-01 00:09:10+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 00:09:00+00\",\"2024-01-01 00:11:00+00\"),[\"2024-01-01 00:12:00+00\",\"2024-01-01 00:13:00+00\")}",
"2024-01-01 00:00:00+00"
),
new DerivedEvent(
"B_event",
"Test",
"B",
"Test Default",
"2024-01-01 00:00:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 00:02:00+00\")}",
"2024-01-02 00:00:00+00"
),
new DerivedEvent(
"C_event",
"Test",
"C",
"Test Default",
"2024-01-01 00:21:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 00:20:00+00\",\"2024-01-01 00:23:00+00\")}",
"2024-01-03 00:00:00+00"
),
new DerivedEvent(
"D_event",
"Test",
"D",
"Test Default",
"2024-01-01 00:02:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 00:02:00+00\",\"2024-01-01 00:04:00+00\"),[\"2024-01-01 00:07:00+00\",\"2024-01-01 00:09:00+00\")}",
"2024-01-04 00:00:00+00"
),
new DerivedEvent(
"E_event",
"Test", "E",
"Test Default", "2024-01-01 00:13:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 00:13:00+00\",\"2024-01-01 00:20:00+00\")}",
"2024-01-05 00:00:00+00"
),
new DerivedEvent(
"F_event",
"Test", "F",
"Test Default", "2024-01-01 00:04:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 00:04:00+00\",\"2024-01-01 00:07:00+00\")}",
"2024-01-06 00:00:00+00"
),
new DerivedEvent(
"G_event",
"Test", "G",
"Test Default", "2024-01-01 00:11:00+00",
"00:00:00.000001",
"{}",
"{[\"2024-01-01 00:11:00+00\",\"2024-01-01 00:12:00+00\")}",
"2024-01-07 00:00:00+00"
)
);
assertTrue(results.containsAll(expectedResults));
}
}
}
@@ -1044,51 +1036,47 @@ void rule1_solitary() throws SQLException {
try(final var statement = connection.createStatement()) {

// insert the event(s) (and their source(s))
assertDoesNotThrow(() -> {
ExternalSource eS = new ExternalSource(
"A",
st,
dg,
"2024-01-01T00:00:00Z",
"2024-01-01T00:00:00Z",
"2024-01-01T01:00:00Z",
ca,
mt
);
ExternalSource eS = new ExternalSource(
"A",
st,
dg,
"2024-01-01T00:00:00Z",
"2024-01-01T00:00:00Z",
"2024-01-01T01:00:00Z",
ca,
mt
);

ExternalEvent e = createEvent("A.1", "2024-01-01T00:00:00Z", "01:00:00", eS);
ExternalEvent e = createEvent("A.1", "2024-01-01T00:00:00Z", "01:00:00", eS);


// insert generic external event type, source type, and derivation group
insertStandardTypes();
// insert generic external event type, source type, and derivation group
insertStandardTypes();

// insert sources
insertExternalSource(eS);
// insert sources
insertExternalSource(eS);

// insert events
insertExternalEvent(e);
});
// insert events
insertExternalEvent(e);

// ensure the result has the right size and keys
assertDoesNotThrow(() -> {
final var results = getDerivedEvents("");

// both ranges should only have a single element and be fully present
final List<DerivedEvent> expectedResults = List.of(
new DerivedEvent(
"A.1",
"Test",
"A",
"Test Default",
"2024-01-01 00:00:00+00",
"01:00:00",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 01:00:00+00\")}",
"2024-01-01 00:00:00+00"
)
);
assertTrue(results.containsAll(expectedResults));
});
final var results = getDerivedEvents("");

// both ranges should only have a single element and be fully present
final List<DerivedEvent> expectedResults = List.of(
new DerivedEvent(
"A.1",
"Test",
"A",
"Test Default",
"2024-01-01 00:00:00+00",
"01:00:00",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 01:00:00+00\")}",
"2024-01-01 00:00:00+00"
)
);
assertTrue(results.containsAll(expectedResults));
}
}

@@ -1105,99 +1093,95 @@ void rule1_bookended() throws SQLException {
try(final var statement = connection.createStatement()) {

// insert the event(s) (and their source(s))
assertDoesNotThrow(() -> {
ExternalSource A = new ExternalSource(
"A",
st,
dg,
"2024-01-01T00:00:00Z",
"2024-01-01T00:30:00Z",
"2024-01-01T02:00:00Z",
ca,
mt
);
ExternalSource B = new ExternalSource(
"B",
st,
dg,
"2024-01-02T00:00:00Z",
"2024-01-01T00:00:00Z",
"2024-01-01T01:00:00Z",
ca,
mt
);
ExternalSource C = new ExternalSource(
"C",
st,
dg,
"2024-01-03T00:00:00Z",
"2024-01-01T01:30:00Z",
"2024-01-01T03:00:00Z",
ca,
mt
);
ExternalSource A = new ExternalSource(
"A",
st,
dg,
"2024-01-01T00:00:00Z",
"2024-01-01T00:30:00Z",
"2024-01-01T02:00:00Z",
ca,
mt
);
ExternalSource B = new ExternalSource(
"B",
st,
dg,
"2024-01-02T00:00:00Z",
"2024-01-01T00:00:00Z",
"2024-01-01T01:00:00Z",
ca,
mt
);
ExternalSource C = new ExternalSource(
"C",
st,
dg,
"2024-01-03T00:00:00Z",
"2024-01-01T01:30:00Z",
"2024-01-01T03:00:00Z",
ca,
mt
);

ExternalEvent e = createEvent("a", "2024-01-01T01:10:00Z", "00:10:00", A);
ExternalEvent before = createEvent("b", "2024-01-01T00:00:00Z", "00:30:00", B);
ExternalEvent after = createEvent("c", "2024-01-01T01:30:00Z", "01:00:00", C);
ExternalEvent e = createEvent("a", "2024-01-01T01:10:00Z", "00:10:00", A);
ExternalEvent before = createEvent("b", "2024-01-01T00:00:00Z", "00:30:00", B);
ExternalEvent after = createEvent("c", "2024-01-01T01:30:00Z", "01:00:00", C);


// insert generic external event type, source type, and derivation group
insertStandardTypes();
// insert generic external event type, source type, and derivation group
insertStandardTypes();

// insert sources
insertExternalSource(A);
insertExternalSource(B);
insertExternalSource(C);
// insert sources
insertExternalSource(A);
insertExternalSource(B);
insertExternalSource(C);

// insert events
insertExternalEvent(e);
insertExternalEvent(before);
insertExternalEvent(after);
});
// insert events
insertExternalEvent(e);
insertExternalEvent(before);
insertExternalEvent(after);

// verify the expected keys are included
assertDoesNotThrow(() -> {
final var results = getDerivedEvents("ORDER BY source_key");

// both ranges should only have a single element and be fully present
final List<DerivedEvent> expectedResults = List.of(
new DerivedEvent(
"a",
"Test",
"A",
"Test Default",
"2024-01-01 01:10:00+00",
"00:10:00",
"{}",
"{[\"2024-01-01 01:00:00+00\",\"2024-01-01 01:30:00+00\")}",
"2024-01-01 00:00:00+00"
),
new DerivedEvent(
"b",
"Test",
"B",
"Test Default",
"2024-01-01 00:00:00+00",
"00:30:00",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 01:00:00+00\")}",
"2024-01-02 00:00:00+00"
),
new DerivedEvent(
"c",
"Test",
"C",
"Test Default",
"2024-01-01 01:30:00+00",
"01:00:00",
"{}",
"{[\"2024-01-01 01:30:00+00\",\"2024-01-01 03:00:00+00\")}",
"2024-01-03 00:00:00+00"
)
);
assertTrue(results.containsAll(expectedResults));
});
final var results = getDerivedEvents("ORDER BY source_key");

// both ranges should only have a single element and be fully present
final List<DerivedEvent> expectedResults = List.of(
new DerivedEvent(
"a",
"Test",
"A",
"Test Default",
"2024-01-01 01:10:00+00",
"00:10:00",
"{}",
"{[\"2024-01-01 01:00:00+00\",\"2024-01-01 01:30:00+00\")}",
"2024-01-01 00:00:00+00"
),
new DerivedEvent(
"b",
"Test",
"B",
"Test Default",
"2024-01-01 00:00:00+00",
"00:30:00",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 01:00:00+00\")}",
"2024-01-02 00:00:00+00"
),
new DerivedEvent(
"c",
"Test",
"C",
"Test Default",
"2024-01-01 01:30:00+00",
"01:00:00",
"{}",
"{[\"2024-01-01 01:30:00+00\",\"2024-01-01 03:00:00+00\")}",
"2024-01-03 00:00:00+00"
)
);
assertTrue(results.containsAll(expectedResults));
}
}

@@ -1215,88 +1199,84 @@ void rule2() throws SQLException {
try(final var statement = connection.createStatement()) {

// insert the event(s) (and their source(s))
assertDoesNotThrow(() -> {
ExternalSource A = new ExternalSource(
"A",
st,
dg,
"2024-01-01T00:00:00Z",
"2024-01-01T00:00:00Z",
"2024-01-01T01:00:00Z",
ca,
mt
);
ExternalSource B = new ExternalSource(
"B",
st,
dg,
"2024-01-02T00:00:00Z",
"2024-01-01T00:30:00Z",
"2024-01-01T01:30:00Z",
ca,
mt
);
ExternalSource A = new ExternalSource(
"A",
st,
dg,
"2024-01-01T00:00:00Z",
"2024-01-01T00:00:00Z",
"2024-01-01T01:00:00Z",
ca,
mt
);
ExternalSource B = new ExternalSource(
"B",
st,
dg,
"2024-01-02T00:00:00Z",
"2024-01-01T00:30:00Z",
"2024-01-01T01:30:00Z",
ca,
mt
);

ExternalEvent e = createEvent("a", "2024-01-01T00:25:00Z", "00:10:00", A); // spills into B
ExternalEvent b1 = createEvent("b1", "2024-01-01T00:30:00Z", "00:10:00", B);
ExternalEvent b2 = createEvent("b2", "2024-01-01T00:45:00Z", "00:10:00", B);
ExternalEvent e = createEvent("a", "2024-01-01T00:25:00Z", "00:10:00", A); // spills into B
ExternalEvent b1 = createEvent("b1", "2024-01-01T00:30:00Z", "00:10:00", B);
ExternalEvent b2 = createEvent("b2", "2024-01-01T00:45:00Z", "00:10:00", B);


// insert generic external event type, source type, and derivation group
insertStandardTypes();
// insert generic external event type, source type, and derivation group
insertStandardTypes();

// insert sources
insertExternalSource(A);
insertExternalSource(B);
// insert sources
insertExternalSource(A);
insertExternalSource(B);

// insert events
insertExternalEvent(e);
insertExternalEvent(b1);
insertExternalEvent(b2);
});
// insert events
insertExternalEvent(e);
insertExternalEvent(b1);
insertExternalEvent(b2);

// verify the expected keys
assertDoesNotThrow(() -> {
final var results = getDerivedEvents("ORDER BY source_key");

// both ranges should only have a single element and be fully present
final List<DerivedEvent> expectedResults = List.of(
new DerivedEvent(
"a",
"Test",
"A",
"Test Default",
"2024-01-01 00:25:00+00",
"00:10:00",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 00:30:00+00\")}",
"2024-01-01 00:00:00+00"
),
new DerivedEvent(
"b1",
"Test",
"B",
"Test Default",
"2024-01-01 00:30:00+00",
"00:10:00",
"{}",
"{[\"2024-01-01 00:30:00+00\",\"2024-01-01 01:30:00+00\")}",
"2024-01-02 00:00:00+00"
),
new DerivedEvent(
"b2",
"Test",
"B",
"Test Default",
"2024-01-01 00:45:00+00",
"00:10:00",
"{}",
"{[\"2024-01-01 00:30:00+00\",\"2024-01-01 01:30:00+00\")}",
"2024-01-02 00:00:00+00"
)
);
assertTrue(results.containsAll(expectedResults));
});
final var results = getDerivedEvents("ORDER BY source_key");

// both ranges should only have a single element and be fully present
final List<DerivedEvent> expectedResults = List.of(
new DerivedEvent(
"a",
"Test",
"A",
"Test Default",
"2024-01-01 00:25:00+00",
"00:10:00",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 00:30:00+00\")}",
"2024-01-01 00:00:00+00"
),
new DerivedEvent(
"b1",
"Test",
"B",
"Test Default",
"2024-01-01 00:30:00+00",
"00:10:00",
"{}",
"{[\"2024-01-01 00:30:00+00\",\"2024-01-01 01:30:00+00\")}",
"2024-01-02 00:00:00+00"
),
new DerivedEvent(
"b2",
"Test",
"B",
"Test Default",
"2024-01-01 00:45:00+00",
"00:10:00",
"{}",
"{[\"2024-01-01 00:30:00+00\",\"2024-01-01 01:30:00+00\")}",
"2024-01-02 00:00:00+00"
)
);
assertTrue(results.containsAll(expectedResults));
}
}

@@ -1314,7 +1294,6 @@ void rule3_basic() throws SQLException {
try(final var statement = connection.createStatement()) {

// insert the event(s) (and their source(s))
assertDoesNotThrow(() -> {
ExternalSource A = new ExternalSource(
"A",
st,
@@ -1364,39 +1343,36 @@ void rule3_basic() throws SQLException {
insertExternalEvent(e2);
insertExternalEvent(b1);
insertExternalEvent(b2);
});

// verify the expected keys
assertDoesNotThrow(() -> {
final var results = getDerivedEvents("ORDER BY source_key");

// both ranges should only have a single element and be fully present
final List<DerivedEvent> expectedResults = List.of(
new DerivedEvent(
"b1",
"Test",
"B",
"Test Default",
"2024-01-01 00:00:00+00",
"00:10:00",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 01:00:00+00\")}",
"2024-01-02 00:00:00+00"
),
new DerivedEvent(
"b2",
"Test",
"B",
"Test Default",
"2024-01-01 00:30:00+00",
"00:20:00",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 01:00:00+00\")}",
"2024-01-02 00:00:00+00"
)
);
assertTrue(results.containsAll(expectedResults));
});
final var results = getDerivedEvents("ORDER BY source_key");

// both ranges should only have a single element and be fully present
final List<DerivedEvent> expectedResults = List.of(
new DerivedEvent(
"b1",
"Test",
"B",
"Test Default",
"2024-01-01 00:00:00+00",
"00:10:00",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 01:00:00+00\")}",
"2024-01-02 00:00:00+00"
),
new DerivedEvent(
"b2",
"Test",
"B",
"Test Default",
"2024-01-01 00:30:00+00",
"00:20:00",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 01:00:00+00\")}",
"2024-01-02 00:00:00+00"
)
);
assertTrue(results.containsAll(expectedResults));
}
}

@@ -1413,168 +1389,158 @@ void rule3_empty() throws SQLException {
try(final var statement = connection.createStatement()) {

// insert the event(s) (and their source(s))
assertDoesNotThrow(() -> {
ExternalSource A = new ExternalSource(
"A",
st,
dg,
"2024-01-01T00:00:00Z",
"2024-01-01T00:30:00Z",
"2024-01-01T01:30:00Z",
ca,
mt
);
ExternalSource B = new ExternalSource(
"B",
st,
dg,
"2024-01-02T00:00:00Z",
"2024-01-01T00:00:00Z",
"2024-01-01T01:00:00Z",
ca,
mt
);
ExternalSource A = new ExternalSource(
"A",
st,
dg,
"2024-01-01T00:00:00Z",
"2024-01-01T00:30:00Z",
"2024-01-01T01:30:00Z",
ca,
mt
);
ExternalSource B = new ExternalSource(
"B",
st,
dg,
"2024-01-02T00:00:00Z",
"2024-01-01T00:00:00Z",
"2024-01-01T01:00:00Z",
ca,
mt
);

ExternalEvent e1 = createEvent(
"a1",
"2024-01-01T00:40:00Z",
"00:10:00",
A
); // negated by empty space
ExternalEvent e2 = createEvent(
"a2",
"2024-01-01T00:55:00Z",
"00:35:00",
A
); // negated by empty space
ExternalEvent e1 = createEvent(
"a1",
"2024-01-01T00:40:00Z",
"00:10:00",
A
); // negated by empty space
ExternalEvent e2 = createEvent(
"a2",
"2024-01-01T00:55:00Z",
"00:35:00",
A
); // negated by empty space


// insert generic external event type, source type, and derivation group
insertStandardTypes();
// insert generic external event type, source type, and derivation group
insertStandardTypes();

// insert sources
insertExternalSource(A);
// insert sources
insertExternalSource(A);

// insert events
insertExternalEvent(e1);
insertExternalEvent(e2);
// insert events
insertExternalEvent(e1);
insertExternalEvent(e2);

// insert B as a source
insertExternalSource(B);
});
// insert B as a source
insertExternalSource(B);

// verify expected keys (none)
assertDoesNotThrow(() -> {
final var results = getDerivedEvents("ORDER BY source_key");
// verify expected keys (none)
final var results = getDerivedEvents("ORDER BY source_key");

assertEquals(0, results.size());
});
assertEquals(0, results.size());
}
}

////////////////////////// RULE 4 //////////////////////////
/**
* Tests rule 4, where we require that later sources with events bearing the same key as an event in an earlier
* source replace said events. To test this, while not conflating with any other cases tested above, we use
* completely sparse sources, just to purely illustrate rule 4 and that it works.
*
* A: ++++aaa+++++
* B: +++++aaaaa+
* C: +++++aaaa+++++
* (one A, of specific duration)
*/
@Test
void rule4() throws SQLException {
try (final var statement = connection.createStatement()) {

// insert the event(s) (and their source(s))
assertDoesNotThrow(() -> {
ExternalSource A = new ExternalSource(
"A",
st,
dg,
"2024-01-01T00:00:00Z",
"2024-01-01T01:30:00Z",
"2024-01-01T02:30:00Z",
ca,
mt
);
ExternalSource B = new ExternalSource(
"B",
st,
dg,
"2024-01-02T00:00:00Z",
"2024-01-01T03:00:00Z",
"2024-01-01T04:00:00Z",
ca,
mt
);
ExternalSource C = new ExternalSource(
"C",
st,
dg,
"2024-01-03T00:00:00Z",
"2024-01-01T00:00:00Z",
"2024-01-01T01:00:00Z",
ca,
mt
);
////////////////////////// RULE 4 //////////////////////////
/**
* Tests rule 4, where we require that later sources with events bearing the same key as an event in an earlier
* source replace said events. To test this, while not conflating with any other cases tested above, we use
* completely sparse sources, just to purely illustrate rule 4 and that it works.
*
* A: ++++aaa+++++
* B: +++++aaaaa+
* C: +++++aaaa+++++
* (one A, of specific duration)
*/
@Test
void rule4() throws SQLException {
try (final var statement = connection.createStatement()) {

ExternalEvent e1 = createEvent(
"a",
"2024-01-01T01:50:00Z",
"00:10:00",
A
); // negated by empty space
ExternalEvent e2 = createEvent(
"a",
"2024-01-01T03:40:00Z",
"00:15:00",
B
); // negated by empty space
ExternalEvent e3 = createEvent(
"a",
"2024-01-01T00:30:00Z",
"00:20:00",
C
); // negated by empty space
// insert the event(s) (and their source(s))
ExternalSource A = new ExternalSource(
"A",
st,
dg,
"2024-01-01T00:00:00Z",
"2024-01-01T01:30:00Z",
"2024-01-01T02:30:00Z",
ca,
mt
);
ExternalSource B = new ExternalSource(
"B",
st,
dg,
"2024-01-02T00:00:00Z",
"2024-01-01T03:00:00Z",
"2024-01-01T04:00:00Z",
ca,
mt
);
ExternalSource C = new ExternalSource(
"C",
st,
dg,
"2024-01-03T00:00:00Z",
"2024-01-01T00:00:00Z",
"2024-01-01T01:00:00Z",
ca,
mt
);

// insert generic external event type, source type, and derivation group
insertStandardTypes();
ExternalEvent e1 = createEvent(
"a",
"2024-01-01T01:50:00Z",
"00:10:00",
A
); // negated by empty space
ExternalEvent e2 = createEvent(
"a",
"2024-01-01T03:40:00Z",
"00:15:00",
B
); // negated by empty space
ExternalEvent e3 = createEvent(
"a",
"2024-01-01T00:30:00Z",
"00:20:00",
C
); // negated by empty space

// insert sources
insertExternalSource(A);
insertExternalSource(B);
insertExternalSource(C);
// insert generic external event type, source type, and derivation group
insertStandardTypes();

// insert events
insertExternalEvent(e1);
insertExternalEvent(e2);
insertExternalEvent(e3);
});
// insert sources
insertExternalSource(A);
insertExternalSource(B);
insertExternalSource(C);

// insert events
insertExternalEvent(e1);
insertExternalEvent(e2);
insertExternalEvent(e3);

// verify expected keys
assertDoesNotThrow(() -> {
final var results = getDerivedEvents("ORDER BY source_key");

// both ranges should only have a single element and be fully present
final List<DerivedEvent> expectedResults = List.of(
new DerivedEvent(
"a",
"Test",
"C",
"Test Default",
"2024-01-01 00:30:00+00",
"00:20:00",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 01:00:00+00\")}",
"2024-01-03 00:00:00+00"
)
);
System.out.println("RESULTS" + results.toString());
System.out.println("EXPECTED RESULTS" + expectedResults.toString());
assertTrue(results.containsAll(expectedResults));
});
final var results = getDerivedEvents("ORDER BY source_key");

// both ranges should only have a single element and be fully present
final List<DerivedEvent> expectedResults = List.of(
new DerivedEvent(
"a",
"Test",
"C",
"Test Default",
"2024-01-01 00:30:00+00",
"00:20:00",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 01:00:00+00\")}",
"2024-01-03 00:00:00+00"
)
);
assertTrue(results.containsAll(expectedResults));
}
}
}
@@ -1599,7 +1565,7 @@ class ConstraintTests {
* demonstrate this with sparse sources. In this test, we don't even require events to demonstrate this behavior.
*/
@Test
void sameValid_at() {
void sameValid_at() throws SQLException {
// construct the sources
ExternalSource a = new ExternalSource(
"A",
@@ -1621,13 +1587,11 @@ void sameValid_at() {
mt);

// create types and first source
assertDoesNotThrow(() -> {
insertExternalSourceType(st);
insertExternalSourceType(st);

insertDerivationGroup(dg, st);
insertDerivationGroup(dg, st);

insertExternalSource(a);
});
insertExternalSource(a);

// second source should fail
assertThrowsExactly(PSQLException.class, () -> insertExternalSource(b));
@@ -1657,61 +1621,57 @@ void nEventsAtSameTime() throws SQLException {
ExternalEvent e2 = createEvent("b", "2024-01-01T00:00:00Z", "00:05:00", A);
ExternalEvent e3 = createEvent("c", "2024-01-01T00:00:00Z", "00:15:00", A);

assertDoesNotThrow(() -> {
// insert generic external event type, source type, and derivation group
insertStandardTypes();
// insert generic external event type, source type, and derivation group
insertStandardTypes();

// insert sources
insertExternalSource(A);
// insert sources
insertExternalSource(A);

// insert events
insertExternalEvent(e1);
insertExternalEvent(e2);
insertExternalEvent(e3);
});
// insert events
insertExternalEvent(e1);
insertExternalEvent(e2);
insertExternalEvent(e3);

// all 3 keys should be present!
assertDoesNotThrow(() -> {
var results = getDerivedEvents("ORDER BY start_time, event_key ASC");
var results = getDerivedEvents("ORDER BY start_time, event_key ASC");

// both ranges should only have a single element and be fully present
final List<DerivedEvent> expectedResults = List.of(
new DerivedEvent(
"a",
"Test",
"A",
"Test Default",
"2024-01-01 00:00:00+00",
"00:10:00",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 01:30:00+00\")}",
"2024-01-01 00:00:00+00"
),
new DerivedEvent(
"b",
"Test",
"A",
"Test Default",
"2024-01-01 00:00:00+00",
"00:05:00",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 01:30:00+00\")}",
"2024-01-01 00:00:00+00"
),
new DerivedEvent(
"c",
"Test",
"A",
"Test Default",
"2024-01-01 00:00:00+00",
"00:15:00",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 01:30:00+00\")}",
"2024-01-01 00:00:00+00"
)
);
assertTrue(results.containsAll(expectedResults));
});
// both ranges should only have a single element and be fully present
final List<DerivedEvent> expectedResults = List.of(
new DerivedEvent(
"a",
"Test",
"A",
"Test Default",
"2024-01-01 00:00:00+00",
"00:10:00",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 01:30:00+00\")}",
"2024-01-01 00:00:00+00"
),
new DerivedEvent(
"b",
"Test",
"A",
"Test Default",
"2024-01-01 00:00:00+00",
"00:05:00",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 01:30:00+00\")}",
"2024-01-01 00:00:00+00"
),
new DerivedEvent(
"c",
"Test",
"A",
"Test Default",
"2024-01-01 00:00:00+00",
"00:15:00",
"{}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 01:30:00+00\")}",
"2024-01-01 00:00:00+00"
)
);
assertTrue(results.containsAll(expectedResults));
}
}

@@ -1720,7 +1680,7 @@ void nEventsAtSameTime() throws SQLException {
* to demonstrate that this behavior causes an error, despite being as simple as a primary key collision.
*/
@Test
void noDuplicateEventsInSameSource() {
void noDuplicateEventsInSameSource() throws SQLException {
// construct the sources and events
ExternalSource A = new ExternalSource(
"A",
@@ -1736,16 +1696,14 @@ void noDuplicateEventsInSameSource() {
ExternalEvent e2 = createEvent("a", "2024-01-01T00:55:00Z", "00:15:00", A); // illegal!

// uploading is fine for the first event, naturally
assertDoesNotThrow(() -> {
// insert generic external event type, source type, and derivation group
insertStandardTypes();
// insert generic external event type, source type, and derivation group
insertStandardTypes();

// insert sources
insertExternalSource(A);
// insert sources
insertExternalSource(A);

// insert events
insertExternalEvent(e1);
});
// insert events
insertExternalEvent(e1);

// but fails on collision!
assertThrowsExactly(PSQLException.class, () -> insertExternalEvent(e2));
@@ -1755,7 +1713,7 @@ void noDuplicateEventsInSameSource() {
* For a given source, the end time must not be less than or equal to the start time. It must be greater than.
*/
@Test
void endTimeGEstartTime() {
void endTimeGEstartTime() throws SQLException {
// construct the sources
ExternalSource failing = new ExternalSource(
"A",
@@ -1789,13 +1747,11 @@ void endTimeGEstartTime() {
);

// add source type and derivation group
assertDoesNotThrow(() -> {
// create the source type
insertExternalSourceType(failing.source_type_name());
// create the source type
insertExternalSourceType(failing.source_type_name());

// create the derivation_group
insertDerivationGroup(failing.derivation_group_name(), failing.source_type_name());
});
// create the derivation_group
insertDerivationGroup(failing.derivation_group_name(), failing.source_type_name());

// if start time > end time, error
assertThrowsExactly(PSQLException.class, () -> insertExternalSource(failing));
@@ -1819,7 +1775,7 @@ void endTimeGEstartTime() {
* After2 : 4444
*/
@Test
void externalEventSourceBounds() {
void externalEventSourceBounds() throws SQLException {
// create sources and events
ExternalSource A = new ExternalSource(
"A",
@@ -1838,16 +1794,14 @@ void externalEventSourceBounds() {
ExternalEvent completelyAfter = createEvent("completelyAfter", "2024-01-01T02:10:00Z", "00:15:00", A); // illegal!

// assert the legal event is okay (in the center of the source)
assertDoesNotThrow(() -> {
// insert generic external event type, source type, and derivation group
insertStandardTypes();
// insert generic external event type, source type, and derivation group
insertStandardTypes();

// insert sources
insertExternalSource(A);
// insert sources
insertExternalSource(A);

// insert events
insertExternalEvent(legal);
});
// insert events
insertExternalEvent(legal);

// assert out of bounds failures
assertThrowsExactly(PSQLException.class, () -> insertExternalEvent(completelyBefore));
@@ -1864,7 +1818,7 @@ void externalEventSourceBounds() {
* therefore different source types).
*/
@Test
void duplicateSource() {
void duplicateSource() throws SQLException {
ExternalSource failing = new ExternalSource(
"Derivation_Test_00.json",
st,
@@ -1887,28 +1841,24 @@ void duplicateSource() {
); // same name, diff dg

// upload general data
assertDoesNotThrow(() -> upload_source(dg));
upload_source(dg);

// upload a conflicting source (same name in a given dg)
assertThrowsExactly(PSQLException.class, () -> insertExternalSource(failing));

// upload a non-conflicting source (same name in a different dg)
assertDoesNotThrow(() -> {
insertDerivationGroup(dg + "_2", st);
insertExternalSource(succeeding);
});
insertDerivationGroup(dg + "_2", st);
insertExternalSource(succeeding);
}

/**
* No two derivation groups, even across different source types, can have the same name.
*/
@Test
void duplicatedDG() {
assertDoesNotThrow(() -> {
// create a derivation group of the Test type
upload_source(dg);
insertExternalSourceType("New Name");
});
void duplicatedDG() throws SQLException {
// create a derivation group of the Test type
upload_source(dg);
insertExternalSourceType("New Name");

assertThrowsExactly(PSQLException.class, () -> {
// use the same name as before (Test Default) with a different source type (New Name) - fails
@@ -1937,16 +1887,14 @@ void deleteDGwithRemainingSource() throws SQLException {
);

// insert the source and all relevant groups and types
assertDoesNotThrow(() -> {
// create a source type
insertExternalSourceType(st);
// create a source type
insertExternalSourceType(st);

// create a Derivation Group
insertDerivationGroup(dg, st);
// create a Derivation Group
insertDerivationGroup(dg, st);

// create a source
insertExternalSource(src);
});
// create a source
insertExternalSource(src);

// delete the DG (expect error)
assertThrowsExactly(PSQLException.class,
@@ -1980,16 +1928,14 @@ void deleteSourceTypeWithRemainingSource() throws SQLException {
);

// add types
assertDoesNotThrow(() -> {
// create a source type
insertExternalSourceType(st);
// create a source type
insertExternalSourceType(st);

// create a Derivation Group
insertDerivationGroup(dg, st);
// create a Derivation Group
insertDerivationGroup(dg, st);

// create a source
insertExternalSource(src);
});
// create a source
insertExternalSource(src);

// delete the source type (expect error)
assertThrowsExactly(PSQLException.class, () -> statement.executeUpdate(
@@ -2023,16 +1969,14 @@ void deleteEventTypeWithRemainingEvent() throws SQLException {
ExternalEvent evt = createEvent("A_1", "2024-01-01T00:00:00Z", "00:05:0", src);

// insert the event and her types
assertDoesNotThrow(() -> {
// insert generic external event type, source type, and derivation group
insertStandardTypes();
// insert generic external event type, source type, and derivation group
insertStandardTypes();

// insert sources
insertExternalSource(src);
// insert sources
insertExternalSource(src);

// insert events
insertExternalEvent(evt);
});
// insert events
insertExternalEvent(evt);

// delete the event type (expect error)
assertThrowsExactly(PSQLException.class,
@@ -2063,292 +2007,288 @@ void superDerivedEvents() throws SQLException {
String dg2 = dg + "_2";

// upload the data once for the first derivation group
assertDoesNotThrow(() -> upload_source(dg));
upload_source(dg);

// repeat (explicitly, for ease of implementation) with the second derivation group
assertDoesNotThrow(() -> {
// insert derivation groups
insertDerivationGroup(dg2, st);

// insert external sources
ExternalSource Test_00 = new ExternalSource("Derivation_Test_00_1.json", st, dg2, "2024-01-18 00:00:00+00", "2024-01-05 00:00:00+00", "2024-01-11 00:00:00+00", "2024-08-21 22:36:12.858009+00", "{}");
ExternalSource Test_01 = new ExternalSource("Derivation_Test_01_1.json", st, dg2, "2024-01-19 00:00:00+00", "2024-01-01 00:00:00+00", "2024-01-07 00:00:00+00", "2024-08-21 22:36:19.381275+00", "{}");
ExternalSource Test_02 = new ExternalSource("Derivation_Test_02_1.json", st, dg2, "2024-01-20 00:00:00+00", "2024-01-03 00:00:00+00", "2024-01-10 00:00:00+00", "2024-08-21 22:36:23.340941+00", "{}");
ExternalSource Test_03 = new ExternalSource("Derivation_Test_03_1.json", st, dg2, "2024-01-21 00:00:00+00", "2024-01-01 12:00:00+00", "2024-01-02 12:00:00+00", "2024-08-21 22:36:28.365244+00", "{}");
insertExternalSource(Test_00);
insertExternalSource(Test_01);
insertExternalSource(Test_02);
insertExternalSource(Test_03);

// insert external events
ExternalEvent e02 = new ExternalEvent("2", "DerivationD", "Derivation_Test_00_1.json", dg2, "2024-01-05 23:00:00+00", "01:10:00", "{\"notes\": \"subsumed by test 01, even though end lies outside of 01, also replaced by test 01 by key\", \"rules\": [3, 4], \"should_present\": false}");
ExternalEvent e07 = new ExternalEvent("7", "DerivationC", "Derivation_Test_00_1.json", dg2, "2024-01-09 23:00:00+00", "02:00:00", "{\"notes\": \"subsumed by test 02, even though end lies outside of 02, because start time during 01\", \"rules\": [3], \"should_present\": false}");
ExternalEvent e08 = new ExternalEvent("8", "DerivationB", "Derivation_Test_00_1.json", dg2, "2024-01-10 11:00:00+00", "01:05:00", "{\"notes\": \"after everything, subsumed by nothing despite being from oldest file\", \"rules\": [1], \"should_present\": true}");
ExternalEvent e01 = new ExternalEvent("1", "DerivationA", "Derivation_Test_01_1.json", dg2, "2024-01-01 00:00:00+00", "02:10:00", "{\"notes\": \"before everything, subsumed by nothing\", \"rule\": [1], \"should_present\": true}");
ExternalEvent e02_2 = new ExternalEvent("2", "DerivationA", "Derivation_Test_01_1.json", dg2, "2024-01-01 12:00:00+00", "02:10:00", "{\"notes\": \"overwritten by key in later file, even with type change\", \"rules\": [4], \"should_present\": false}");
ExternalEvent e03 = new ExternalEvent("3", "DerivationB", "Derivation_Test_01_1.json", dg2, "2024-01-02 23:00:00+00", "03:00:00", "{\"notes\": \"starts before next file though occurs during next file, still included\", \"rules\": [2], \"should_present\": true}");
ExternalEvent e04 = new ExternalEvent("4", "DerivationB", "Derivation_Test_01_1.json", dg2, "2024-01-05 21:00:00+00", "03:00:00", "{\"notes\": \"start subsumed by 02, not included in final result\", \"rules\": [3], \"should_present\": false}");
ExternalEvent e05 = new ExternalEvent("5", "DerivationC", "Derivation_Test_02_1.json", dg2, "2024-01-05 23:00:00+00", "01:10:00", "{\"notes\": \"not subsumed, optionally change this event to have key 6 and ensure this test fails\", \"rules\": [1], \"should_present\": true}");
ExternalEvent e06 = new ExternalEvent("6", "DerivationC", "Derivation_Test_02_1.json", dg2, "2024-01-06 12:00:00+00", "02:00:00", "{\"notes\": \"not subsumed\", \"rules\": [1], \"should_present\": true}");
ExternalEvent e02_3 = new ExternalEvent("2", "DerivationB", "Derivation_Test_02_1.json", dg2, "2024-01-09 11:00:00+00", "01:05:00", "{\"notes\": \"replaces 2 in test 01, despite different event type\", \"rules\": [4], \"should_present\": true}");
ExternalEvent e09 = new ExternalEvent("9", "DerivationC", "Derivation_Test_03_1.json", dg2, "2024-01-02 00:00:00+00", "01:00:00", "{\"notes\": \"not subsumed\", \"rules\": [1], \"should_present\": true}");
insertExternalEvent(e02);
insertExternalEvent(e07);
insertExternalEvent(e08);
insertExternalEvent(e01);
insertExternalEvent(e02_2);
insertExternalEvent(e03);
insertExternalEvent(e04);
insertExternalEvent(e05);
insertExternalEvent(e06);
insertExternalEvent(e02_3);
insertExternalEvent(e09);
});
// insert derivation groups
insertDerivationGroup(dg2, st);

// insert external sources
ExternalSource Test_00 = new ExternalSource("Derivation_Test_00_1.json", st, dg2, "2024-01-18 00:00:00+00", "2024-01-05 00:00:00+00", "2024-01-11 00:00:00+00", "2024-08-21 22:36:12.858009+00", "{}");
ExternalSource Test_01 = new ExternalSource("Derivation_Test_01_1.json", st, dg2, "2024-01-19 00:00:00+00", "2024-01-01 00:00:00+00", "2024-01-07 00:00:00+00", "2024-08-21 22:36:19.381275+00", "{}");
ExternalSource Test_02 = new ExternalSource("Derivation_Test_02_1.json", st, dg2, "2024-01-20 00:00:00+00", "2024-01-03 00:00:00+00", "2024-01-10 00:00:00+00", "2024-08-21 22:36:23.340941+00", "{}");
ExternalSource Test_03 = new ExternalSource("Derivation_Test_03_1.json", st, dg2, "2024-01-21 00:00:00+00", "2024-01-01 12:00:00+00", "2024-01-02 12:00:00+00", "2024-08-21 22:36:28.365244+00", "{}");
insertExternalSource(Test_00);
insertExternalSource(Test_01);
insertExternalSource(Test_02);
insertExternalSource(Test_03);

// insert external events
ExternalEvent e02 = new ExternalEvent("2", "DerivationD", "Derivation_Test_00_1.json", dg2, "2024-01-05 23:00:00+00", "01:10:00", "{\"notes\": \"subsumed by test 01, even though end lies outside of 01, also replaced by test 01 by key\", \"rules\": [3, 4], \"should_present\": false}");
ExternalEvent e07 = new ExternalEvent("7", "DerivationC", "Derivation_Test_00_1.json", dg2, "2024-01-09 23:00:00+00", "02:00:00", "{\"notes\": \"subsumed by test 02, even though end lies outside of 02, because start time during 01\", \"rules\": [3], \"should_present\": false}");
ExternalEvent e08 = new ExternalEvent("8", "DerivationB", "Derivation_Test_00_1.json", dg2, "2024-01-10 11:00:00+00", "01:05:00", "{\"notes\": \"after everything, subsumed by nothing despite being from oldest file\", \"rules\": [1], \"should_present\": true}");
ExternalEvent e01 = new ExternalEvent("1", "DerivationA", "Derivation_Test_01_1.json", dg2, "2024-01-01 00:00:00+00", "02:10:00", "{\"notes\": \"before everything, subsumed by nothing\", \"rule\": [1], \"should_present\": true}");
ExternalEvent e02_2 = new ExternalEvent("2", "DerivationA", "Derivation_Test_01_1.json", dg2, "2024-01-01 12:00:00+00", "02:10:00", "{\"notes\": \"overwritten by key in later file, even with type change\", \"rules\": [4], \"should_present\": false}");
ExternalEvent e03 = new ExternalEvent("3", "DerivationB", "Derivation_Test_01_1.json", dg2, "2024-01-02 23:00:00+00", "03:00:00", "{\"notes\": \"starts before next file though occurs during next file, still included\", \"rules\": [2], \"should_present\": true}");
ExternalEvent e04 = new ExternalEvent("4", "DerivationB", "Derivation_Test_01_1.json", dg2, "2024-01-05 21:00:00+00", "03:00:00", "{\"notes\": \"start subsumed by 02, not included in final result\", \"rules\": [3], \"should_present\": false}");
ExternalEvent e05 = new ExternalEvent("5", "DerivationC", "Derivation_Test_02_1.json", dg2, "2024-01-05 23:00:00+00", "01:10:00", "{\"notes\": \"not subsumed, optionally change this event to have key 6 and ensure this test fails\", \"rules\": [1], \"should_present\": true}");
ExternalEvent e06 = new ExternalEvent("6", "DerivationC", "Derivation_Test_02_1.json", dg2, "2024-01-06 12:00:00+00", "02:00:00", "{\"notes\": \"not subsumed\", \"rules\": [1], \"should_present\": true}");
ExternalEvent e02_3 = new ExternalEvent("2", "DerivationB", "Derivation_Test_02_1.json", dg2, "2024-01-09 11:00:00+00", "01:05:00", "{\"notes\": \"replaces 2 in test 01, despite different event type\", \"rules\": [4], \"should_present\": true}");
ExternalEvent e09 = new ExternalEvent("9", "DerivationC", "Derivation_Test_03_1.json", dg2, "2024-01-02 00:00:00+00", "01:00:00", "{\"notes\": \"not subsumed\", \"rules\": [1], \"should_present\": true}");
insertExternalEvent(e02);
insertExternalEvent(e07);
insertExternalEvent(e08);
insertExternalEvent(e01);
insertExternalEvent(e02_2);
insertExternalEvent(e03);
insertExternalEvent(e04);
insertExternalEvent(e05);
insertExternalEvent(e06);
insertExternalEvent(e02_3);
insertExternalEvent(e09);

// check that derived events in our prewritten case has the correct keys
assertDoesNotThrow(() -> {
// verify everything is present
var results = getDerivedEvents("ORDER BY source_key");

// both ranges should only have a single element and be fully present
List<DerivedEvent> expectedResults = List.of(
new DerivedEvent(
"8",
"DerivationB",
"Derivation_Test_00_1.json",
"Test Default_2",
"2024-01-10 11:00:00+00",
"01:05:00", "{\"notes\": \"after everything, subsumed by nothing despite being from oldest file\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-10 00:00:00+00\",\"2024-01-11 00:00:00+00\")}",
"2024-01-18 00:00:00+00"
),
new DerivedEvent(
"8",
"DerivationB",
"Derivation_Test_00.json",
"Test Default",
"2024-01-10 11:00:00+00",
"01:05:00", "{\"notes\": \"after everything, subsumed by nothing despite being from oldest file\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-10 00:00:00+00\",\"2024-01-11 00:00:00+00\")}",
"2024-01-18 00:00:00+00"
),
new DerivedEvent(
"3",
"DerivationB",
"Derivation_Test_01_1.json",
"Test Default_2",
"2024-01-02 23:00:00+00",
"03:00:00", "{\"notes\": \"starts before next file though occurs during next file, still included\", \"rules\": [2], \"should_present\": true}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 12:00:00+00\"),[\"2024-01-02 12:00:00+00\",\"2024-01-03 00:00:00+00\")}",
"2024-01-19 00:00:00+00"
),
new DerivedEvent(
"1",
"DerivationA",
"Derivation_Test_01_1.json",
"Test Default_2",
"2024-01-01 00:00:00+00",
"02:10:00", "{\"rule\": [1], \"notes\": \"before everything, subsumed by nothing\", \"should_present\": true}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 12:00:00+00\"),[\"2024-01-02 12:00:00+00\",\"2024-01-03 00:00:00+00\")}",
"2024-01-19 00:00:00+00"
),
new DerivedEvent(
"1",
"DerivationA",
"Derivation_Test_01.json",
"Test Default",
"2024-01-01 00:00:00+00", "02:10:00",
"{\"notes\": \"before everything, subsumed by nothing\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 12:00:00+00\"),[\"2024-01-02 12:00:00+00\",\"2024-01-03 00:00:00+00\")}",
"2024-01-19 00:00:00+00"
),
new DerivedEvent(
"3",
"DerivationB",
"Derivation_Test_01.json",
"Test Default",
"2024-01-02 23:00:00+00",
"03:00:00",
"{\"notes\": \"starts before next file though occurs during next file, still included\", \"rules\": [2], \"should_present\": true}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 12:00:00+00\"),[\"2024-01-02 12:00:00+00\",\"2024-01-03 00:00:00+00\")}",
"2024-01-19 00:00:00+00"
),
new DerivedEvent(
"5",
"DerivationC",
"Derivation_Test_02_1.json",
"Test Default_2",
"2024-01-05 23:00:00+00",
"01:10:00",
"{\"notes\": \"not subsumed, optionally change this event to have key 6 and ensure this test fails\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-03 00:00:00+00\",\"2024-01-10 00:00:00+00\")}",
"2024-01-20 00:00:00+00"
),
new DerivedEvent(
"6",
"DerivationC",
"Derivation_Test_02_1.json",
"Test Default_2",
"2024-01-06 12:00:00+00",
"02:00:00",
"{\"notes\": \"not subsumed\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-03 00:00:00+00\",\"2024-01-10 00:00:00+00\")}",
"2024-01-20 00:00:00+00"
),
new DerivedEvent(
"2",
"DerivationB",
"Derivation_Test_02_1.json",
"Test Default_2",
"2024-01-09 11:00:00+00",
"01:05:00",
"{\"notes\": \"replaces 2 in test 01, despite different event type\", \"rules\": [4], \"should_present\": true}",
"{[\"2024-01-03 00:00:00+00\",\"2024-01-10 00:00:00+00\")}",
"2024-01-20 00:00:00+00"
),
new DerivedEvent(
"5",
"DerivationC",
"Derivation_Test_02.json",
"Test Default",
"2024-01-05 23:00:00+00",
"01:10:00",
"{\"notes\": \"not subsumed, optionally change this event to have key 6 and ensure this test fails\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-03 00:00:00+00\",\"2024-01-10 00:00:00+00\")}",
"2024-01-20 00:00:00+00"
),
new DerivedEvent(
"6",
"DerivationC",
"Derivation_Test_02.json",
"Test Default",
"2024-01-06 12:00:00+00",
"02:00:00",
"{\"notes\": \"not subsumed\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-03 00:00:00+00\",\"2024-01-10 00:00:00+00\")}",
"2024-01-20 00:00:00+00"
),
new DerivedEvent(
"2",
"DerivationB",
"Derivation_Test_02.json",
"Test Default",
"2024-01-09 11:00:00+00",
"01:05:00",
"{\"notes\": \"replaces 2 in test 01, despite different event type\", \"rules\": [4], \"should_present\": true}",
"{[\"2024-01-03 00:00:00+00\",\"2024-01-10 00:00:00+00\")}",
"2024-01-20 00:00:00+00"
),
new DerivedEvent(
"9",
"DerivationC",
"Derivation_Test_03_1.json",
"Test Default_2",
"2024-01-02 00:00:00+00",
"01:00:00",
"{\"notes\": \"not subsumed\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-01 12:00:00+00\",\"2024-01-02 12:00:00+00\")}",
"2024-01-21 00:00:00+00"
),
new DerivedEvent(
"9",
"DerivationC",
"Derivation_Test_03.json",
"Test Default",
"2024-01-02 00:00:00+00",
"01:00:00",
"{\"notes\": \"not subsumed\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-01 12:00:00+00\",\"2024-01-02 12:00:00+00\")}",
"2024-01-21 00:00:00+00"
)
);
assertTrue(results.containsAll(expectedResults));

// verify for a given dg expected keys are correct, no overlap inside dg
results = getDerivedEvents("WHERE derivation_group_name = '%s' ORDER BY start_time;".formatted(dg2));

// both ranges should only have a single element and be fully present
expectedResults = List.of(
new DerivedEvent(
"1",
"DerivationA",
"Derivation_Test_01_1.json",
"Test Default_2",
"2024-01-01 00:00:00+00",
"02:10:00",
"{\"rule\": [1], \"notes\": \"before everything, subsumed by nothing\", \"should_present\": true}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 12:00:00+00\"),[\"2024-01-02 12:00:00+00\",\"2024-01-03 00:00:00+00\")}",
"2024-01-19 00:00:00+00"
),
new DerivedEvent(
"9",
"DerivationC",
"Derivation_Test_03_1.json",
"Test Default_2",
"2024-01-02 00:00:00+00",
"01:00:00",
"{\"notes\": \"not subsumed\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-01 12:00:00+00\",\"2024-01-02 12:00:00+00\")}",
"2024-01-21 00:00:00+00"
),
new DerivedEvent(
"3",
"DerivationB",
"Derivation_Test_01_1.json",
"Test Default_2",
"2024-01-02 23:00:00+00",
"03:00:00",
"{\"notes\": \"starts before next file though occurs during next file, still included\", \"rules\": [2], \"should_present\": true}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 12:00:00+00\"),[\"2024-01-02 12:00:00+00\",\"2024-01-03 00:00:00+00\")}",
"2024-01-19 00:00:00+00"
),
new DerivedEvent(
"5",
"DerivationC",
"Derivation_Test_02_1.json",
"Test Default_2",
"2024-01-05 23:00:00+00",
"01:10:00",
"{\"notes\": \"not subsumed, optionally change this event to have key 6 and ensure this test fails\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-03 00:00:00+00\",\"2024-01-10 00:00:00+00\")}",
"2024-01-20 00:00:00+00"
),
new DerivedEvent(
"6",
"DerivationC",
"Derivation_Test_02_1.json",
"Test Default_2",
"2024-01-06 12:00:00+00",
"02:00:00",
"{\"notes\": \"not subsumed\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-03 00:00:00+00\",\"2024-01-10 00:00:00+00\")}",
"2024-01-20 00:00:00+00"
),
new DerivedEvent(
"2",
"DerivationB",
"Derivation_Test_02_1.json",
"Test Default_2",
"2024-01-09 11:00:00+00",
"01:05:00",
"{\"notes\": \"replaces 2 in test 01, despite different event type\", \"rules\": [4], \"should_present\": true}",
"{[\"2024-01-03 00:00:00+00\",\"2024-01-10 00:00:00+00\")}",
"2024-01-20 00:00:00+00"
),
new DerivedEvent(
"8",
"DerivationB",
"Derivation_Test_00_1.json",
"Test Default_2",
"2024-01-10 11:00:00+00",
"01:05:00",
"{\"notes\": \"after everything, subsumed by nothing despite being from oldest file\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-10 00:00:00+00\",\"2024-01-11 00:00:00+00\")}",
"2024-01-18 00:00:00+00"
)
);
assertTrue(results.containsAll(expectedResults));
});
// verify everything is present
var results = getDerivedEvents("ORDER BY source_key");

// both ranges should only have a single element and be fully present
List<DerivedEvent> expectedResults = List.of(
new DerivedEvent(
"8",
"DerivationB",
"Derivation_Test_00_1.json",
"Test Default_2",
"2024-01-10 11:00:00+00",
"01:05:00", "{\"notes\": \"after everything, subsumed by nothing despite being from oldest file\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-10 00:00:00+00\",\"2024-01-11 00:00:00+00\")}",
"2024-01-18 00:00:00+00"
),
new DerivedEvent(
"8",
"DerivationB",
"Derivation_Test_00.json",
"Test Default",
"2024-01-10 11:00:00+00",
"01:05:00", "{\"notes\": \"after everything, subsumed by nothing despite being from oldest file\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-10 00:00:00+00\",\"2024-01-11 00:00:00+00\")}",
"2024-01-18 00:00:00+00"
),
new DerivedEvent(
"3",
"DerivationB",
"Derivation_Test_01_1.json",
"Test Default_2",
"2024-01-02 23:00:00+00",
"03:00:00", "{\"notes\": \"starts before next file though occurs during next file, still included\", \"rules\": [2], \"should_present\": true}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 12:00:00+00\"),[\"2024-01-02 12:00:00+00\",\"2024-01-03 00:00:00+00\")}",
"2024-01-19 00:00:00+00"
),
new DerivedEvent(
"1",
"DerivationA",
"Derivation_Test_01_1.json",
"Test Default_2",
"2024-01-01 00:00:00+00",
"02:10:00", "{\"rule\": [1], \"notes\": \"before everything, subsumed by nothing\", \"should_present\": true}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 12:00:00+00\"),[\"2024-01-02 12:00:00+00\",\"2024-01-03 00:00:00+00\")}",
"2024-01-19 00:00:00+00"
),
new DerivedEvent(
"1",
"DerivationA",
"Derivation_Test_01.json",
"Test Default",
"2024-01-01 00:00:00+00", "02:10:00",
"{\"notes\": \"before everything, subsumed by nothing\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 12:00:00+00\"),[\"2024-01-02 12:00:00+00\",\"2024-01-03 00:00:00+00\")}",
"2024-01-19 00:00:00+00"
),
new DerivedEvent(
"3",
"DerivationB",
"Derivation_Test_01.json",
"Test Default",
"2024-01-02 23:00:00+00",
"03:00:00",
"{\"notes\": \"starts before next file though occurs during next file, still included\", \"rules\": [2], \"should_present\": true}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 12:00:00+00\"),[\"2024-01-02 12:00:00+00\",\"2024-01-03 00:00:00+00\")}",
"2024-01-19 00:00:00+00"
),
new DerivedEvent(
"5",
"DerivationC",
"Derivation_Test_02_1.json",
"Test Default_2",
"2024-01-05 23:00:00+00",
"01:10:00",
"{\"notes\": \"not subsumed, optionally change this event to have key 6 and ensure this test fails\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-03 00:00:00+00\",\"2024-01-10 00:00:00+00\")}",
"2024-01-20 00:00:00+00"
),
new DerivedEvent(
"6",
"DerivationC",
"Derivation_Test_02_1.json",
"Test Default_2",
"2024-01-06 12:00:00+00",
"02:00:00",
"{\"notes\": \"not subsumed\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-03 00:00:00+00\",\"2024-01-10 00:00:00+00\")}",
"2024-01-20 00:00:00+00"
),
new DerivedEvent(
"2",
"DerivationB",
"Derivation_Test_02_1.json",
"Test Default_2",
"2024-01-09 11:00:00+00",
"01:05:00",
"{\"notes\": \"replaces 2 in test 01, despite different event type\", \"rules\": [4], \"should_present\": true}",
"{[\"2024-01-03 00:00:00+00\",\"2024-01-10 00:00:00+00\")}",
"2024-01-20 00:00:00+00"
),
new DerivedEvent(
"5",
"DerivationC",
"Derivation_Test_02.json",
"Test Default",
"2024-01-05 23:00:00+00",
"01:10:00",
"{\"notes\": \"not subsumed, optionally change this event to have key 6 and ensure this test fails\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-03 00:00:00+00\",\"2024-01-10 00:00:00+00\")}",
"2024-01-20 00:00:00+00"
),
new DerivedEvent(
"6",
"DerivationC",
"Derivation_Test_02.json",
"Test Default",
"2024-01-06 12:00:00+00",
"02:00:00",
"{\"notes\": \"not subsumed\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-03 00:00:00+00\",\"2024-01-10 00:00:00+00\")}",
"2024-01-20 00:00:00+00"
),
new DerivedEvent(
"2",
"DerivationB",
"Derivation_Test_02.json",
"Test Default",
"2024-01-09 11:00:00+00",
"01:05:00",
"{\"notes\": \"replaces 2 in test 01, despite different event type\", \"rules\": [4], \"should_present\": true}",
"{[\"2024-01-03 00:00:00+00\",\"2024-01-10 00:00:00+00\")}",
"2024-01-20 00:00:00+00"
),
new DerivedEvent(
"9",
"DerivationC",
"Derivation_Test_03_1.json",
"Test Default_2",
"2024-01-02 00:00:00+00",
"01:00:00",
"{\"notes\": \"not subsumed\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-01 12:00:00+00\",\"2024-01-02 12:00:00+00\")}",
"2024-01-21 00:00:00+00"
),
new DerivedEvent(
"9",
"DerivationC",
"Derivation_Test_03.json",
"Test Default",
"2024-01-02 00:00:00+00",
"01:00:00",
"{\"notes\": \"not subsumed\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-01 12:00:00+00\",\"2024-01-02 12:00:00+00\")}",
"2024-01-21 00:00:00+00"
)
);
assertTrue(results.containsAll(expectedResults));

// verify for a given dg expected keys are correct, no overlap inside dg
results = getDerivedEvents("WHERE derivation_group_name = '%s' ORDER BY start_time;".formatted(dg2));

// both ranges should only have a single element and be fully present
expectedResults = List.of(
new DerivedEvent(
"1",
"DerivationA",
"Derivation_Test_01_1.json",
"Test Default_2",
"2024-01-01 00:00:00+00",
"02:10:00",
"{\"rule\": [1], \"notes\": \"before everything, subsumed by nothing\", \"should_present\": true}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 12:00:00+00\"),[\"2024-01-02 12:00:00+00\",\"2024-01-03 00:00:00+00\")}",
"2024-01-19 00:00:00+00"
),
new DerivedEvent(
"9",
"DerivationC",
"Derivation_Test_03_1.json",
"Test Default_2",
"2024-01-02 00:00:00+00",
"01:00:00",
"{\"notes\": \"not subsumed\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-01 12:00:00+00\",\"2024-01-02 12:00:00+00\")}",
"2024-01-21 00:00:00+00"
),
new DerivedEvent(
"3",
"DerivationB",
"Derivation_Test_01_1.json",
"Test Default_2",
"2024-01-02 23:00:00+00",
"03:00:00",
"{\"notes\": \"starts before next file though occurs during next file, still included\", \"rules\": [2], \"should_present\": true}",
"{[\"2024-01-01 00:00:00+00\",\"2024-01-01 12:00:00+00\"),[\"2024-01-02 12:00:00+00\",\"2024-01-03 00:00:00+00\")}",
"2024-01-19 00:00:00+00"
),
new DerivedEvent(
"5",
"DerivationC",
"Derivation_Test_02_1.json",
"Test Default_2",
"2024-01-05 23:00:00+00",
"01:10:00",
"{\"notes\": \"not subsumed, optionally change this event to have key 6 and ensure this test fails\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-03 00:00:00+00\",\"2024-01-10 00:00:00+00\")}",
"2024-01-20 00:00:00+00"
),
new DerivedEvent(
"6",
"DerivationC",
"Derivation_Test_02_1.json",
"Test Default_2",
"2024-01-06 12:00:00+00",
"02:00:00",
"{\"notes\": \"not subsumed\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-03 00:00:00+00\",\"2024-01-10 00:00:00+00\")}",
"2024-01-20 00:00:00+00"
),
new DerivedEvent(
"2",
"DerivationB",
"Derivation_Test_02_1.json",
"Test Default_2",
"2024-01-09 11:00:00+00",
"01:05:00",
"{\"notes\": \"replaces 2 in test 01, despite different event type\", \"rules\": [4], \"should_present\": true}",
"{[\"2024-01-03 00:00:00+00\",\"2024-01-10 00:00:00+00\")}",
"2024-01-20 00:00:00+00"
),
new DerivedEvent(
"8",
"DerivationB",
"Derivation_Test_00_1.json",
"Test Default_2",
"2024-01-10 11:00:00+00",
"01:05:00",
"{\"notes\": \"after everything, subsumed by nothing despite being from oldest file\", \"rules\": [1], \"should_present\": true}",
"{[\"2024-01-10 00:00:00+00\",\"2024-01-11 00:00:00+00\")}",
"2024-01-18 00:00:00+00"
)
);
assertTrue(results.containsAll(expectedResults));
}
}

0 comments on commit d4b08b6

Please sign in to comment.