Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/main/java/com/imsweb/staging/Staging.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package com.imsweb.staging;

import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Calendar;
Expand Down Expand Up @@ -58,14 +59,23 @@ private Staging(StagingDataProvider provider) {
}

/**
* Create an instance of the Staging object with a pre-constructed provider
* Create an instance of the Staging object based on a provider
* @param provider StagingDataProvider
* @return a Staging instance
*/
public static Staging getInstance(StagingDataProvider provider) {
return new Staging(provider);
}

/**
* Create an instance of the Staging object based on an InputStream
* @param is InputStream pointing to algoruthm zip file
* @return a Staging instance
*/
public static Staging getInstance(InputStream is) throws IOException {
return new Staging(new ExternalStagingFileDataProvider(is));
}

/**
* Create an instance of the Staging object based on a Path representing an algorithm zip file
* @param algorithmPath path to an algorithm zip file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ExternalStagingFileDataProviderTest extends FileDataProviderTest {
@BeforeAll
static void setup() throws IOException {
try (InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("external_algorithm.zip")) {
_STAGING = Staging.getInstance(new ExternalStagingFileDataProvider(is));
_STAGING = Staging.getInstance(is);
}
}

Expand Down