Changeset 2 for simplerunner/src
- Timestamp:
- 08/28/19 11:35:52 (5 years ago)
- Location:
- simplerunner/src/test
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
simplerunner/src/test/java/geniusweb/simplerunner/SessionRunnerE2ETest.java
r1 r2 5 5 import java.nio.file.Files; 6 6 import java.nio.file.Paths; 7 import java.util.Arrays; 8 import java.util.Collection; 7 9 8 10 import org.junit.Before; 9 11 import org.junit.Test; 12 import org.junit.runner.RunWith; 13 import org.junit.runners.Parameterized; 14 import org.junit.runners.Parameterized.Parameters; 10 15 11 16 import com.fasterxml.jackson.databind.ObjectMapper; 12 17 13 18 import geniusweb.protocol.session.SessionSettings; 14 import geniusweb.simplerunner.ClassPathConnectionFactory;15 import geniusweb.simplerunner.NegoRunner;16 19 import tudelft.utilities.logging.ReportToLogger; 17 20 import tudelft.utilities.logging.Reporter; … … 22 25 * this module. 23 26 */ 27 @RunWith(Parameterized.class) 24 28 public class SessionRunnerE2ETest { 25 private static final String SESSION_SETTINGS = "src/test/resources/settings.json";26 29 private final ObjectMapper jackson = new ObjectMapper(); 27 30 private NegoRunner runner; 28 31 private Reporter logger = new ReportToLogger("test"); 32 private String filename; 33 34 @Parameters 35 public static Collection<Object[]> data() { 36 return Arrays.asList( 37 new Object[][] { { "src/test/resources/settings.json" }, { "src/test/resources/settings2.json" } }); 38 } 39 40 public SessionRunnerE2ETest(String file) { 41 this.filename = file; 42 } 29 43 30 44 @Before 31 45 public void before() throws IOException { 32 String serialized = new String( 33 Files.readAllBytes(Paths.get(SESSION_SETTINGS)), 34 StandardCharsets.UTF_8); 35 SessionSettings settings = jackson.readValue(serialized, 36 SessionSettings.class); 46 String serialized = new String(Files.readAllBytes(Paths.get(filename)), StandardCharsets.UTF_8); 47 SessionSettings settings = jackson.readValue(serialized, SessionSettings.class); 37 48 38 runner = new NegoRunner(settings, new ClassPathConnectionFactory(), 39 logger); 49 runner = new NegoRunner(settings, new ClassPathConnectionFactory(), logger); 40 50 41 51 } … … 52 62 @Test 53 63 public void runTestMainFunction() throws IOException { 54 NegoRunner.main(new String[] { SESSION_SETTINGS});64 NegoRunner.main(new String[] { filename }); 55 65 } 56 66 }
Note:
See TracChangeset
for help on using the changeset viewer.