diff --git a/avek-gui/pom.xml b/avek-gui/pom.xml index 2eb8ace..958b470 100644 --- a/avek-gui/pom.xml +++ b/avek-gui/pom.xml @@ -33,8 +33,8 @@ #AVEK AXONIC fr.axonic.avek.gui.Main - myalias - password + AVEK + AVEK.AXONIC.fr true true @@ -56,6 +56,18 @@ + + com.zenjava + javafx-maven-plugin + 8.5.0 + + fr.axonic + axonic + AXONIC + PACA + FR + + diff --git a/avek-gui/keystore/csr.csr b/avek-gui/src/main/deploy/csr.csr similarity index 100% rename from avek-gui/keystore/csr.csr rename to avek-gui/src/main/deploy/csr.csr diff --git a/avek-gui/src/main/deploy/keystore.jks b/avek-gui/src/main/deploy/keystore.jks new file mode 100644 index 0000000..1c7b09a Binary files /dev/null and b/avek-gui/src/main/deploy/keystore.jks differ diff --git a/avek-gui/keystore/keystore.p12 b/avek-gui/src/main/deploy/keystore.p12 similarity index 100% rename from avek-gui/keystore/keystore.p12 rename to avek-gui/src/main/deploy/keystore.p12 diff --git a/avek-gui/src/main/java/fr/axonic/avek/gui/model/json/Jsonifier.java b/avek-gui/src/main/java/fr/axonic/avek/gui/model/json/Jsonifier.java index ce5c99c..0e6c15a 100644 --- a/avek-gui/src/main/java/fr/axonic/avek/gui/model/json/Jsonifier.java +++ b/avek-gui/src/main/java/fr/axonic/avek/gui/model/json/Jsonifier.java @@ -23,11 +23,7 @@ public static String toJson(Object o) { } public T fromJson(String s) { - return fromJson(s, tClass); - } - - public static TT fromJson(String s, Class c) { - logger.info("Creating new "+c.getName()+" from Json"); - return new GsonBuilder().create().fromJson(s, c); + logger.info("Creating new "+tClass.getName()+" from Json"); + return new GsonBuilder().create().fromJson(s, tClass); } } diff --git a/avek-gui/src/main/java/fr/axonic/avek/gui/view/MainController.java b/avek-gui/src/main/java/fr/axonic/avek/gui/view/MainController.java index c7aaf5f..0fa7344 100644 --- a/avek-gui/src/main/java/fr/axonic/avek/gui/view/MainController.java +++ b/avek-gui/src/main/java/fr/axonic/avek/gui/view/MainController.java @@ -55,7 +55,7 @@ protected void initialize() throws Exception { String monitoredSystemJson = getFileContent("files/subjectFile.json"); String results = getFileContent("files/resultEnum1.json"); - ExperimentationResults expr = Jsonifier.fromJson(results, ExperimentationResults.class); + ExperimentationResults expr = new Jsonifier<>(ExperimentationResults.class).fromJson(results); paneParameters.addExpParameter(new ANumber("Frequency", 42.0)); paneParameters.addExpParameter(new ABoolean("Bool?", true)); diff --git a/avek-gui/src/main/resources/log4j.xml b/avek-gui/src/main/resources/log4j.xml index 2fb614b..1c1ec6b 100644 --- a/avek-gui/src/main/resources/log4j.xml +++ b/avek-gui/src/main/resources/log4j.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + @@ -30,7 +30,7 @@ - + @@ -40,7 +40,7 @@ - + diff --git a/avek-gui/src/test/java/fr/axonic/avek/gui/view/model/json/TestJsonifier.java b/avek-gui/src/test/java/fr/axonic/avek/gui/view/model/json/TestJsonifier.java index 0702abd..49d8bef 100644 --- a/avek-gui/src/test/java/fr/axonic/avek/gui/view/model/json/TestJsonifier.java +++ b/avek-gui/src/test/java/fr/axonic/avek/gui/view/model/json/TestJsonifier.java @@ -20,14 +20,14 @@ public class TestJsonifier { - @Test public void primitiveTest() { + @Test public void testPrimitives() { test("Totoo", String.class); test(42, Integer.class); test(49.3, Double.class); test(98765432123456789L, Long.class); } - @Test public void objectTest() { + @Test public void testObjects() { // Array with unknown element number ArrayList ls = new ArrayList<>(); for(int i=(int)(100*Math.random()); i>0; i--) { @@ -36,8 +36,10 @@ public class TestJsonifier { test(ls, ArrayList.class); + Jsonifier jsonifier = new Jsonifier<>(ARangedEnum.class); + ARangedEnum arees = new ARangedEnum<>(ExampleState.MEDIUM); - ARangedEnum o2 = Jsonifier.fromJson(Jsonifier.toJson(arees), ARangedEnum.class); + ARangedEnum o2 = jsonifier.fromJson(Jsonifier.toJson(arees)); assertEquals(arees.getValue().toString(), o2.getValue().toString()); assertEquals(arees.getRange(), o2.getRange()); test2(arees, ARangedEnum.class); @@ -49,7 +51,7 @@ public class TestJsonifier { ms.addAVar("Cat2", new ANumber(49.3)); ARangedEnum areesb = new ARangedEnum<>(ExampleStateBool.FALSE); - o2 = Jsonifier.fromJson(Jsonifier.toJson(areesb), ARangedEnum.class); + o2 = jsonifier.fromJson(Jsonifier.toJson(areesb)); assertEquals(areesb.getValue().toString(), o2.getValue().toString()); assertEquals(areesb.getRange(), o2.getRange()); ms.addAVar("Cat2", areesb); @@ -60,7 +62,7 @@ public class TestJsonifier { } private void test(T o, Class tClass) { - T o2 = Jsonifier.fromJson(Jsonifier.toJson(o), tClass); + T o2 = new Jsonifier<>(tClass).fromJson(Jsonifier.toJson(o)); assertEquals(o, o2); } private void test2(T o, Class tClass) { diff --git a/avek-gui/src/test/java/fr/axonic/avek/gui/view/model/structure/TestUploadedFile.java b/avek-gui/src/test/java/fr/axonic/avek/gui/view/model/structure/TestUploadedFile.java index 22e9ba4..923d713 100644 --- a/avek-gui/src/test/java/fr/axonic/avek/gui/view/model/structure/TestUploadedFile.java +++ b/avek-gui/src/test/java/fr/axonic/avek/gui/view/model/structure/TestUploadedFile.java @@ -43,7 +43,7 @@ public void start(Stage stage) throws Exception { @Before public void before() throws IOException { - File f = new File("./temp/yolo.txt"); // 31 bytes + File f = new File("./temp/test.txt"); // 31 bytes f.createNewFile(); PrintWriter writer = new PrintWriter(f, "UTF-8"); @@ -69,10 +69,10 @@ public void before() throws IOException { } @Test - public void uploadedFileTest() throws FileNotFoundException, FileAlreadyExistsException, InterruptedException { - UploadedFile uf = new UploadedFile(new File("./temp/yolo.txt")); + public void testUploadedFile() throws IOException { + UploadedFile uf = new UploadedFile(new File("./temp/test.txt")); - assertEquals(new File("./temp/yolo.txt"), uf.getOriginal()); + assertEquals(new File("./temp/test.txt"), uf.getOriginal()); assertEquals(31, uf.getSize()); if(!waitingForUpload(uf)) { @@ -88,13 +88,13 @@ public void uploadedFileTest() throws FileNotFoundException, FileAlreadyExistsEx assertEquals(1, fileList.size()); File f = fileList.get(0); - assertEquals("yolo.txt", f.getName()); + assertEquals("test.txt", f.getName()); assertEquals(31, f.length()); assertTrue(f.isFile()); } @Test - public void uploadedFolderTest() throws FileNotFoundException, FileAlreadyExistsException, InterruptedException { + public void testUploadedFolder() throws IOException { UploadedFile uf = new UploadedFile(new File("./temp/toto/")); assertEquals(new File("./temp/toto"), uf.getOriginal()); @@ -141,9 +141,9 @@ public void uploadedFolderTest() throws FileNotFoundException, FileAlreadyExists } @Test - public void alreadyUploadedTest() throws FileNotFoundException, InterruptedException { - UploadedFile uf1 = new UploadedFile(new File("./temp/yolo.txt")); - UploadedFile uf2 = new UploadedFile(new File("./temp/yolo.txt")); + public void testAlreadyUploaded() throws FileNotFoundException { + UploadedFile uf1 = new UploadedFile(new File("./temp/test.txt")); + UploadedFile uf2 = new UploadedFile(new File("./temp/test.txt")); try { if(!waitingForUpload(uf1)) { uf1.removeListener(); @@ -174,7 +174,7 @@ public void alreadyUploadedTest() throws FileNotFoundException, InterruptedExcep assertEquals(1, fileList.size()); File f = fileList.get(0); - assertEquals("yolo.txt", f.getName()); + assertEquals("test.txt", f.getName()); assertEquals(31, f.length()); assertTrue(f.isFile()); } @@ -189,9 +189,9 @@ private boolean waitingForUpload(UploadedFile uf1) throws FileAlreadyExistsExcep }); uf1.doUpload(); - long timeStamp = Calendar.getInstance().getTimeInMillis(); + long timeStamp = Calendar.getInstance().getTimeInMillis()+30_000; while(!pass) { - if(timeStamp+30_000 < Calendar.getInstance().getTimeInMillis()) + if(timeStamp < Calendar.getInstance().getTimeInMillis()) return false; try { Thread.sleep(1); @@ -205,16 +205,18 @@ private boolean waitingForUpload(UploadedFile uf1) throws FileAlreadyExistsExcep } - @After public void after() throws IOException { - File f = new File("./temp/yolo.txt"); - delete(f); - f = new File("./temp/toto"); - delete(f); - for(File ff : UploadedFile.uploadedFolder.listFiles()) - delete(ff); + @After public void after() { + try { + File f = new File("./temp/test.txt"); + delete(f); + f = new File("./temp/toto"); + delete(f); + for(File ff : UploadedFile.uploadedFolder.listFiles()) + delete(ff); + } catch (FileNotFoundException ignored) {} } - private static void delete(File f) throws IOException { + private static void delete(File f) throws FileNotFoundException { if (f.isDirectory()) { for (File c : f.listFiles()) delete(c);