Skip to content

Commit

Permalink
FIX refs #13 : keystore problem fix (cannot find keystore.jks)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathaël NOGUÈS committed Jul 21, 2016
1 parent 105a9d1 commit 6891e91
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 38 deletions.
16 changes: 14 additions & 2 deletions avek-gui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
<appName>#AVEK</appName>
<vendor>AXONIC</vendor>
<mainClass>fr.axonic.avek.gui.Main</mainClass>
<keyStoreAlias>myalias</keyStoreAlias>
<keyStorePassword>password</keyStorePassword>
<keyStoreAlias>AVEK</keyStoreAlias>
<keyStorePassword>AVEK.AXONIC.fr</keyStorePassword>
<allPermissions>true</allPermissions>
<skipSigningJarFilesJNLP185>true</skipSigningJarFilesJNLP185>
</configuration>
Expand All @@ -56,6 +56,18 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>8.5.0</version>
<configuration>
<certDomain>fr.axonic</certDomain>
<certOrgUnit>axonic</certOrgUnit>
<certOrg>AXONIC</certOrg>
<certState>PACA</certState>
<certCountry>FR</certCountry>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
File renamed without changes.
Binary file added avek-gui/src/main/deploy/keystore.jks
Binary file not shown.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ public static String toJson(Object o) {
}

public T fromJson(String s) {
return fromJson(s, tClass);
}

public static <TT> TT fromJson(String s, Class<TT> 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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
8 changes: 4 additions & 4 deletions avek-gui/src/main/resources/log4j.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<appender name="sout" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p %c{1}:%L - %m [%t]%n"/>
<param name="ConversionPattern" value="[%p] %d{HH:mm:ss,SSS} %c{1}:%L - %m [%t]%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="levelMax" value="INFO" />
Expand All @@ -16,7 +16,7 @@
<appender name="serr" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.err"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p %c{1}:%L - %m [%t]%n"/>
<param name="ConversionPattern" value="[%p] %d{HH:mm:ss,SSS} %c{1}:%L - %m [%t]%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="levelMax" value="FATAL" />
Expand All @@ -30,7 +30,7 @@
<!-- Keep one backup file -->
<param name="MaxBackupIndex" value="1"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %c{1}:%L - %m [%t]%n"/>
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss,SSS} [%-5p] %c{1}:%L - %m [%t]%n"/>
</layout>
</appender>

Expand All @@ -40,7 +40,7 @@
<!-- Keep one backup file -->
<param name="MaxBackupIndex" value="1"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p - %m%n"/>
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} [%-5p] - %m%n"/>
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="levelMax" value="INFO" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> ls = new ArrayList<>();
for(int i=(int)(100*Math.random()); i>0; i--) {
Expand All @@ -36,8 +36,10 @@ public class TestJsonifier {

test(ls, ArrayList.class);

Jsonifier<ARangedEnum> jsonifier = new Jsonifier<>(ARangedEnum.class);

ARangedEnum<ExampleState> 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);
Expand All @@ -49,7 +51,7 @@ public class TestJsonifier {
ms.addAVar("Cat2", new ANumber(49.3));

ARangedEnum<ExampleStateBool> 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);
Expand All @@ -60,7 +62,7 @@ public class TestJsonifier {
}

private <T> void test(T o, Class<T> tClass) {
T o2 = Jsonifier.fromJson(Jsonifier.toJson(o), tClass);
T o2 = new Jsonifier<>(tClass).fromJson(Jsonifier.toJson(o));
assertEquals(o, o2);
}
private <T> void test2(T o, Class<T> tClass) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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)) {
Expand All @@ -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());
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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());
}
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 6891e91

Please sign in to comment.