source: simplerunner/src/test/java/geniusweb/simplerunner/SessionRunnerE2ETest.java@ 2

Last change on this file since 2 was 2, checked in by bart, 5 years ago

Added new parties : linear, hardliner, conceder, boulware

File size: 1.8 KB
Line 
1package geniusweb.simplerunner;
2
3import java.io.IOException;
4import java.nio.charset.StandardCharsets;
5import java.nio.file.Files;
6import java.nio.file.Paths;
7import java.util.Arrays;
8import java.util.Collection;
9
10import org.junit.Before;
11import org.junit.Test;
12import org.junit.runner.RunWith;
13import org.junit.runners.Parameterized;
14import org.junit.runners.Parameterized.Parameters;
15
16import com.fasterxml.jackson.databind.ObjectMapper;
17
18import geniusweb.protocol.session.SessionSettings;
19import tudelft.utilities.logging.ReportToLogger;
20import tudelft.utilities.logging.Reporter;
21
22/**
23 * E2E test doing a full real run of a session with real agents and protocol.
24 * NOTICE This will exercise a full system to errors here may point far outside
25 * this module.
26 */
27@RunWith(Parameterized.class)
28public class SessionRunnerE2ETest {
29 private final ObjectMapper jackson = new ObjectMapper();
30 private NegoRunner runner;
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 }
43
44 @Before
45 public void before() throws IOException {
46 String serialized = new String(Files.readAllBytes(Paths.get(filename)), StandardCharsets.UTF_8);
47 SessionSettings settings = jackson.readValue(serialized, SessionSettings.class);
48
49 runner = new NegoRunner(settings, new ClassPathConnectionFactory(), logger);
50
51 }
52
53 @Test
54 public void smokeTest() throws IOException {
55 }
56
57 @Test
58 public void runTest() throws IOException {
59 runner.run();
60 }
61
62 @Test
63 public void runTestMainFunction() throws IOException {
64 NegoRunner.main(new String[] { filename });
65 }
66}
Note: See TracBrowser for help on using the repository browser.