source: java2python/jackson-t/src/test/java/tudelft/utilities/j2p/ActionsUseTest.java@ 1589

Last change on this file since 1589 was 1575, checked in by wouter, 4 weeks ago

#97 more fixed getZip() calls

File size: 1.6 KB
Line 
1package tudelft.utilities.j2p;
2
3import static org.junit.Assert.assertEquals;
4
5import java.io.File;
6import java.io.FileNotFoundException;
7import java.io.IOException;
8import java.nio.file.Paths;
9import java.util.Arrays;
10
11import org.junit.Before;
12import org.junit.Test;
13
14import tudelft.utilities.j2p.t.TranslationException;
15import tudelft.utilities.logging.Reporter;
16import tudelft.utilities.logging.SavingReporter;
17import tudelft.utilities.pyrunner.PythonError;
18import tudelft.utilities.pyrunner.PythonVenv;
19
20/**
21 * A more complex package involving multiple files.
22 */
23public class ActionsUseTest {
24
25 PyProgram program;
26
27 @Before
28 public void before() throws TranslationException {
29 program = PyProgram.fromDirectories(
30 Arrays.asList(Paths.get("src/test/javaactions")));
31 }
32
33 @Test
34 public void test() throws IOException, ClassNotFoundException {
35 System.out.println(program);
36 }
37
38 @Test
39 public void runFromZip() throws FileNotFoundException, IOException,
40 InterruptedException, PythonError {
41 File zipfile = program.getZip("test","1");
42 System.out.println("zip file at " + zipfile);
43
44 Reporter reporter = new SavingReporter("test");
45 PythonVenv venv = new PythonVenv(zipfile, reporter);
46 String res = venv.call(
47 Arrays.asList("-m", "testcode.actions.ActionsUse"), 10000);
48 System.out.println(res);
49 assertEquals("serializeAcceptTest\n"
50 + "{\"Accept\":{\"actor\":\"party1\",\"bid\":\"issuevalues\"}}\n"
51 + "deserializeAcceptTest\n" + "Accept[party1,issuevalues]\n"
52 + "AlltestsOK\n", res.replace(" ", ""));
53 // as in Java but true->True and pyson inserts some extra whitespace
54 }
55
56}
Note: See TracBrowser for help on using the repository browser.