Skip to content

Commit

Permalink
Merge pull request #16 from Cognifide/feature/Main-class-fix
Browse files Browse the repository at this point in the history
Feature/main class fix
  • Loading branch information
andrzejkrej authored Sep 22, 2016
2 parents 0996a6b + d799076 commit 47f43ef
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions src/main/java/com/cognifide/secureaem/cli/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.apache.commons.lang3.StringUtils;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -39,25 +40,29 @@ public static void main(String[] args) throws Exception {
}

private static List<TestLoader> createTestLoaders(CommandLine cmdLine) throws IOException, ClassNotFoundException {
try (BufferedReader reader = getBufferedReader(cmdLine)) {
List<TestLoader> testLoaders = new ArrayList<>();
String line;
while ((line = reader.readLine()) != null) {
String[] parameters = line.split(", ");
if (parameters.length == 2) {
Class clazz = Class.forName(parameters[0]);
testLoaders.add(new TestLoader(clazz, parameters[1]));
}
}
return testLoaders;
}
}

private static BufferedReader getBufferedReader(CommandLine cmdLine) throws FileNotFoundException {
BufferedReader reader;
if(cmdLine.hasOption("suite")){
if (cmdLine.hasOption("suite")) {
reader = new BufferedReader(new FileReader(cmdLine.getOptionValue("suite")));
}
else {
} else {
InputStream is = Main.class.getClass().getResourceAsStream(DEFAULT_TEST_SUITE_PATH);
reader = new BufferedReader(new InputStreamReader(is));
}

List<TestLoader> testLoaders = new ArrayList<>();
String line;
while ((line = reader.readLine()) != null) {
String[] parameters = line.split(", ");
if(parameters.length == 2) {
Class clazz = Class.forName(parameters[0]);
testLoaders.add(new TestLoader(clazz, parameters[1]));
}
}
return testLoaders;
return reader;
}

private static boolean doTest(TestLoader testLoader, CommandLine cmdLine) throws Exception {
Expand Down

0 comments on commit 47f43ef

Please sign in to comment.