Skip to content

Commit

Permalink
[core] Reset SOP list in test
Browse files Browse the repository at this point in the history
- Add SOPList#reset
- fixes overloading of transfer options
  • Loading branch information
Enet4 committed Jun 19, 2023
1 parent 65212ff commit bfe8765
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
12 changes: 10 additions & 2 deletions dicoogle/src/main/java/pt/ua/dicoogle/server/SOPList.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,19 @@ public static synchronized SOPList getInstance() {
* Creates a new list
*/
private SOPList() {
table = new Hashtable<>();
this.reset();
}

/** Reset the SOP list to an empty slate.
*
* This is not recommended unless you know what you're doing.
*/
public final void reset() {
this.table = new Hashtable<>();

// Hardcoded (pre-#498) SOPs
for (String sop : SOP) {
table.put(sop, new TransfersStorage());
this.table.put(sop, new TransfersStorage());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ private static void assertSameContent(Collection<?> o1, Collection<?> o2) {

@Test
public void testMigrate() throws IOException {
// clean up SOP list from past tests
SOPList.getInstance().reset();

Path newconf = Files.createTempFile("conf", ".xml");

// load legacy server settings
Expand Down

0 comments on commit bfe8765

Please sign in to comment.