Normalized formatting.

This commit is contained in:
Achim D. Brucker 2016-11-07 23:34:20 +00:00
parent b242e287f8
commit eeaaefdc22
20 changed files with 176 additions and 176 deletions

View File

@ -28,10 +28,10 @@ public class Test01 {
String entryClass = "Test01";
@Before
public void initTest() throws IllegalArgumentException, CancelException, IOException{
TestSuite.initTestSG(entryClass);
public void initTest() throws IllegalArgumentException, CancelException, IOException {
TestSuite.initTestSG(entryClass);
}
@Test
public void testBad() throws IllegalArgumentException, CancelException, IOException {
int result = SuperGraphUtil.analyzeAndSaveSuperGraph(TestSuite.superGraph, entryClass, "bad");
@ -52,5 +52,5 @@ public class Test01 {
assertEquals(-1, result);
return;
}
}

View File

@ -25,12 +25,12 @@ import eu.aniketos.dasca.dataflow.util.SuperGraphUtil;
public class Test02 {
String entryClass = "Test02";
@Before
public void initTest() throws IllegalArgumentException, CancelException, IOException{
TestSuite.initTestSG(entryClass);
public void initTest() throws IllegalArgumentException, CancelException, IOException {
TestSuite.initTestSG(entryClass);
}
@Test
public void testBad() throws IllegalArgumentException, CancelException, IOException {
int result = SuperGraphUtil.analyzeAndSaveSuperGraph(TestSuite.superGraph, entryClass, "bad");

View File

@ -27,10 +27,10 @@ public class Test03 {
String entryClass = "Test03";
@Before
public void initTest() throws IllegalArgumentException, CancelException, IOException{
TestSuite.initTestSG(entryClass);
public void initTest() throws IllegalArgumentException, CancelException, IOException {
TestSuite.initTestSG(entryClass);
}
@Test
public void testBad() throws IllegalArgumentException, CancelException, IOException {
int result = SuperGraphUtil.analyzeAndSaveSuperGraph(TestSuite.superGraph, entryClass, "bad");

View File

@ -27,10 +27,10 @@ public class Test04 {
String entryClass = "Test04";
@Before
public void initTest() throws IllegalArgumentException, CancelException, IOException{
TestSuite.initTestSG(entryClass);
public void initTest() throws IllegalArgumentException, CancelException, IOException {
TestSuite.initTestSG(entryClass);
}
@Test
public void testBad() throws IllegalArgumentException, CancelException, IOException {
int result = SuperGraphUtil.analyzeAndSaveSuperGraph(TestSuite.superGraph, entryClass, "bad");

View File

@ -27,10 +27,10 @@ public class Test05 {
String entryClass = "Test05";
@Before
public void initTest() throws IllegalArgumentException, CancelException, IOException{
TestSuite.initTestSG(entryClass);
public void initTest() throws IllegalArgumentException, CancelException, IOException {
TestSuite.initTestSG(entryClass);
}
@Test
public void testBad() throws IllegalArgumentException, CancelException, IOException {
int result = SuperGraphUtil.analyzeAndSaveSuperGraph(TestSuite.superGraph, entryClass, "bad");

View File

@ -27,10 +27,10 @@ public class Test06 {
String entryClass = "Test06";
@Before
public void initTest() throws IllegalArgumentException, CancelException, IOException{
TestSuite.initTestSG(entryClass);
public void initTest() throws IllegalArgumentException, CancelException, IOException {
TestSuite.initTestSG(entryClass);
}
@Test
public void testBad() {
int result = SuperGraphUtil.analyzeAndSaveSuperGraph(TestSuite.superGraph, entryClass, "bad");

View File

@ -25,14 +25,14 @@ import eu.aniketos.dasca.dataflow.util.SuperGraphUtil;
public class Test07 {
String entryClass = "Test07";
@Before
public void initTest() throws IllegalArgumentException, CancelException, IOException{
TestSuite.initTestSG(entryClass);
public void initTest() throws IllegalArgumentException, CancelException, IOException {
TestSuite.initTestSG(entryClass);
}
@Test
public void testBad() throws IllegalArgumentException, CancelException, IOException{
public void testBad() throws IllegalArgumentException, CancelException, IOException {
int result = SuperGraphUtil.analyzeAndSaveSuperGraph(TestSuite.superGraph, entryClass, "bad");
assertEquals(1, result);
return;

View File

@ -26,10 +26,10 @@ public class Test08 {
String entryClass = "Test08";
@Before
public void initTest() throws IllegalArgumentException, CancelException, IOException{
TestSuite.initTestSG(entryClass);
public void initTest() throws IllegalArgumentException, CancelException, IOException {
TestSuite.initTestSG(entryClass);
}
@Test
public void testBad() throws IllegalArgumentException, CancelException, IOException {
int result = SuperGraphUtil.analyzeAndSaveSuperGraph(TestSuite.superGraph, entryClass, "bad");

View File

@ -27,10 +27,10 @@ public class Test09 {
String entryClass = "Test09";
@Before
public void initTest() throws IllegalArgumentException, CancelException, IOException{
TestSuite.initTestSG(entryClass);
public void initTest() throws IllegalArgumentException, CancelException, IOException {
TestSuite.initTestSG(entryClass);
}
@Test
public void testBad() throws IllegalArgumentException, CancelException, IOException {
int result = SuperGraphUtil.analyzeAndSaveSuperGraph(TestSuite.superGraph, entryClass, "bad");

View File

@ -27,10 +27,10 @@ public class Test10 {
String entryClass = "Test10";
@Before
public void initTest() throws IllegalArgumentException, CancelException, IOException{
TestSuite.initTestSG(entryClass);
public void initTest() throws IllegalArgumentException, CancelException, IOException {
TestSuite.initTestSG(entryClass);
}
@Test
public void testBad() throws IllegalArgumentException, CancelException, IOException {
int result = SuperGraphUtil.analyzeAndSaveSuperGraph(TestSuite.superGraph, entryClass, "bad");

View File

@ -27,10 +27,10 @@ public class Test11 {
String entryClass = "Test11";
@Before
public void initTest() throws IllegalArgumentException, CancelException, IOException{
TestSuite.initTestSG(entryClass);
public void initTest() throws IllegalArgumentException, CancelException, IOException {
TestSuite.initTestSG(entryClass);
}
@Test
public void testBad() throws IllegalArgumentException, CancelException, IOException {
int result = SuperGraphUtil.analyzeAndSaveSuperGraph(TestSuite.superGraph, entryClass, "bad");

View File

@ -27,10 +27,10 @@ public class Test12 {
String entryClass = "Test12";
@Before
public void initTest() throws IllegalArgumentException, CancelException, IOException{
TestSuite.initTestSG(entryClass);
public void initTest() throws IllegalArgumentException, CancelException, IOException {
TestSuite.initTestSG(entryClass);
}
@Test
public void testBad() throws IllegalArgumentException, CancelException, IOException {
int result = SuperGraphUtil.analyzeAndSaveSuperGraph(TestSuite.superGraph, entryClass, "bad");

View File

@ -27,10 +27,10 @@ public class Test13 {
String entryClass = "Test13";
@Before
public void initTest() throws IllegalArgumentException, CancelException, IOException{
TestSuite.initTestSG(entryClass);
public void initTest() throws IllegalArgumentException, CancelException, IOException {
TestSuite.initTestSG(entryClass);
}
@Test
public void testBad() throws IllegalArgumentException, CancelException, IOException {
int result = SuperGraphUtil.analyzeAndSaveSuperGraph(TestSuite.superGraph, entryClass, "bad");

View File

@ -27,10 +27,10 @@ public class Test14 {
String entryClass = "Test14";
@Before
public void initTest() throws IllegalArgumentException, CancelException, IOException{
TestSuite.initTestSG(entryClass);
public void initTest() throws IllegalArgumentException, CancelException, IOException {
TestSuite.initTestSG(entryClass);
}
@Test
public void testBad() throws IllegalArgumentException, CancelException, IOException {
int result = SuperGraphUtil.analyzeAndSaveSuperGraph(TestSuite.superGraph, entryClass, "bad");

View File

@ -27,10 +27,10 @@ public class Test15 {
String entryClass = "Test15";
@Before
public void initTest() throws IllegalArgumentException, CancelException, IOException{
TestSuite.initTestSG(entryClass);
public void initTest() throws IllegalArgumentException, CancelException, IOException {
TestSuite.initTestSG(entryClass);
}
@Test
public void testBad() throws IllegalArgumentException, CancelException, IOException {
int result = SuperGraphUtil.analyzeAndSaveSuperGraph(TestSuite.superGraph, entryClass, "bad");

View File

@ -27,10 +27,10 @@ public class Test16 {
String entryClass = "Test16";
@Before
public void initTest() throws IllegalArgumentException, CancelException, IOException{
TestSuite.initTestSG(entryClass);
public void initTest() throws IllegalArgumentException, CancelException, IOException {
TestSuite.initTestSG(entryClass);
}
@Test
public void testBad() throws IllegalArgumentException, CancelException, IOException {
int result = SuperGraphUtil.analyzeAndSaveSuperGraph(TestSuite.superGraph, entryClass, "bad");

View File

@ -27,10 +27,10 @@ public class Test17 {
String entryClass = "Test17";
@Before
public void initTest() throws IllegalArgumentException, CancelException, IOException{
TestSuite.initTestSG(entryClass);
public void initTest() throws IllegalArgumentException, CancelException, IOException {
TestSuite.initTestSG(entryClass);
}
@Test
public void testBad() throws IllegalArgumentException, CancelException, IOException {
int result = SuperGraphUtil.analyzeAndSaveSuperGraph(TestSuite.superGraph, entryClass, "bad");

View File

@ -27,10 +27,10 @@ public class Test18 {
String entryClass = "Test18";
@Before
public void initTest() throws IllegalArgumentException, CancelException, IOException{
TestSuite.initTestSG(entryClass);
public void initTest() throws IllegalArgumentException, CancelException, IOException {
TestSuite.initTestSG(entryClass);
}
@Test
public void testBad() throws IllegalArgumentException, CancelException, IOException {
int result = SuperGraphUtil.analyzeAndSaveSuperGraph(TestSuite.superGraph, entryClass, "bad");

View File

@ -27,10 +27,10 @@ public class Test19 {
String entryClass = "Test19";
@Before
public void initTest() throws IllegalArgumentException, CancelException, IOException{
TestSuite.initTestSG(entryClass);
public void initTest() throws IllegalArgumentException, CancelException, IOException {
TestSuite.initTestSG(entryClass);
}
@Test
public void testBad() throws IllegalArgumentException, CancelException, IOException {
int result = SuperGraphUtil.analyzeAndSaveSuperGraph(TestSuite.superGraph, entryClass, "bad");

View File

@ -34,128 +34,128 @@ import com.ibm.wala.properties.WalaProperties;
import com.ibm.wala.util.CancelException;
@RunWith(Suite.class)
@SuiteClasses({
Test01.class,
Test02.class,
Test03.class,
Test04.class,
Test05.class,
Test06.class,
Test07.class,
Test08.class,
Test09.class,
Test10.class,
Test11.class,
Test12.class,
Test13.class,
Test14.class,
Test15.class,
Test16.class,
Test17.class,
Test18.class,
Test19.class
})
@SuiteClasses({
Test01.class,
Test02.class,
Test03.class,
Test04.class,
Test05.class,
Test06.class,
Test07.class,
Test08.class,
Test09.class,
Test10.class,
Test11.class,
Test12.class,
Test13.class,
Test14.class,
Test15.class,
Test16.class,
Test17.class,
Test18.class,
Test19.class
})
public class TestSuite {
private static Logger log = AnalysisUtil.getLogger(TestSuite.class);
protected static ICFGSupergraph superGraph = null;
protected static String testDir = "../eu.aniketos.dasca.dataflow.test.data/src/main/java/eu/aniketos/dasca/dataflow/test/data/";
public class TestSuite {
private static Logger log = AnalysisUtil.getLogger(TestSuite.class);
protected static ICFGSupergraph superGraph = null;
protected static String testDir = "../eu.aniketos.dasca.dataflow.test.data/src/main/java/eu/aniketos/dasca/dataflow/test/data/";
protected static List<String> sources = null;
protected static List<String> libs = null;
protected static List<String> sources = null;
protected static List<String> libs = null;
protected static String [] customEntryPoints = {
"Leu/aniketos/dasca/dataflow/test/data/Test01"
,"Leu/aniketos/dasca/dataflow/test/data/Test02"
,"Leu/aniketos/dasca/dataflow/test/data/Test03"
,"Leu/aniketos/dasca/dataflow/test/data/Test04"
,"Leu/aniketos/dasca/dataflow/test/data/Test05"
,"Leu/aniketos/dasca/dataflow/test/data/Test06"
,"Leu/aniketos/dasca/dataflow/test/data/Test07"
,"Leu/aniketos/dasca/dataflow/test/data/Test08"
,"Leu/aniketos/dasca/dataflow/test/data/Test09"
,"Leu/aniketos/dasca/dataflow/test/data/Test10"
,"Leu/aniketos/dasca/dataflow/test/data/Test11"
,"Leu/aniketos/dasca/dataflow/test/data/Test12"
,"Leu/aniketos/dasca/dataflow/test/data/Test13"
,"Leu/aniketos/dasca/dataflow/test/data/Test14"
,"Leu/aniketos/dasca/dataflow/test/data/Test15"
,"Leu/aniketos/dasca/dataflow/test/data/Test16"
,"Leu/aniketos/dasca/dataflow/test/data/Test17"
,"Leu/aniketos/dasca/dataflow/test/data/Test18"
,"Leu/aniketos/dasca/dataflow/test/data/Test19"
};
public static void logConfiguration() {
log.info("Test Configuration:");
log.info("===================");
log.info(" Sources:");
for (String element : sources) {
log.info(" "+element);
}
log.info(" Libs:");
for (String element : libs) {
log.info(" "+element);
}
log.info(" J2SE directory: " + AnalysisUtil.getPropertyString(WalaProperties.J2SE_DIR));
log.info(" Analysis depth: " + AnalysisUtil.getPropertyInteger(AnalysisUtil.CONFIG_ANALYSIS_DEPTH));
log.info(" Main config file: " + AnalysisUtil.getPropertyString("MAIN_CONFIG"));
log.info(" Print subgraphs: " + AnalysisUtil.getPropertyBoolean(AnalysisUtil.CONFIG_BOOLEAN_PRINT_SUBGRAPHS));
log.info(" Dot path: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_DOT_PATH));
log.info(" Remove empty nodes: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_DOT_REMOVE_EMPTY_NODES));
log.info(" Analysis project: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_ANALYSIS_PROJECT));
log.info(" Entry class: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_ENTRY_CLASS));
log.info(" Entry method: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_ENTRY_METHOD));
log.info(" Sanitizer: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_SANITIZER));
log.info(" Bad sources: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_BAD_SRC));
log.info(" Exclusion file: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_EXCLUSION_FILE));
"Leu/aniketos/dasca/dataflow/test/data/Test01"
,"Leu/aniketos/dasca/dataflow/test/data/Test02"
,"Leu/aniketos/dasca/dataflow/test/data/Test03"
,"Leu/aniketos/dasca/dataflow/test/data/Test04"
,"Leu/aniketos/dasca/dataflow/test/data/Test05"
,"Leu/aniketos/dasca/dataflow/test/data/Test06"
,"Leu/aniketos/dasca/dataflow/test/data/Test07"
,"Leu/aniketos/dasca/dataflow/test/data/Test08"
,"Leu/aniketos/dasca/dataflow/test/data/Test09"
,"Leu/aniketos/dasca/dataflow/test/data/Test10"
,"Leu/aniketos/dasca/dataflow/test/data/Test11"
,"Leu/aniketos/dasca/dataflow/test/data/Test12"
,"Leu/aniketos/dasca/dataflow/test/data/Test13"
,"Leu/aniketos/dasca/dataflow/test/data/Test14"
,"Leu/aniketos/dasca/dataflow/test/data/Test15"
,"Leu/aniketos/dasca/dataflow/test/data/Test16"
,"Leu/aniketos/dasca/dataflow/test/data/Test17"
,"Leu/aniketos/dasca/dataflow/test/data/Test18"
,"Leu/aniketos/dasca/dataflow/test/data/Test19"
};
}
public static void initTestSG(String test, boolean force)
throws IllegalArgumentException, CancelException, IOException{
if ((null != superGraph) && !force) return;
List<String> entryPoints = new ArrayList<String>();
if (null != test) {
log.info("Generating Global SG:");
entryPoints.add("Leu/aniketos/dasca/dataflow/test/data/"+test);
}else{
log.info("Generating Test Specific SG ("+ test +"):");
entryPoints.addAll(Arrays.asList(customEntryPoints));
}
for (String element : entryPoints) {
log.info(" "+element);
}
JavaSourceAnalysisEngine engine = PlugInUtil.createECJJavaEngine(sources, libs,
entryPoints.stream().toArray(String[]::new));
CallGraph cg = engine.buildDefaultCallGraph();
AnalysisCache ac = new AnalysisCache();
superGraph = ICFGSupergraph.make(cg, ac);
public static void logConfiguration() {
log.info("Test Configuration:");
log.info("===================");
log.info(" Sources:");
for (String element : sources) {
log.info(" "+element);
}
log.info(" Libs:");
for (String element : libs) {
log.info(" "+element);
}
log.info(" J2SE directory: " + AnalysisUtil.getPropertyString(WalaProperties.J2SE_DIR));
log.info(" Analysis depth: " + AnalysisUtil.getPropertyInteger(AnalysisUtil.CONFIG_ANALYSIS_DEPTH));
log.info(" Main config file: " + AnalysisUtil.getPropertyString("MAIN_CONFIG"));
log.info(" Print subgraphs: " + AnalysisUtil.getPropertyBoolean(AnalysisUtil.CONFIG_BOOLEAN_PRINT_SUBGRAPHS));
log.info(" Dot path: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_DOT_PATH));
log.info(" Remove empty nodes: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_DOT_REMOVE_EMPTY_NODES));
log.info(" Analysis project: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_ANALYSIS_PROJECT));
log.info(" Entry class: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_ENTRY_CLASS));
log.info(" Entry method: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_ENTRY_METHOD));
log.info(" Sanitizer: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_SANITIZER));
log.info(" Bad sources: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_BAD_SRC));
log.info(" Exclusion file: " + AnalysisUtil.getPropertyString(AnalysisUtil.CONFIG_EXCLUSION_FILE));
}
public static void initTestSG(String test, boolean force)
throws IllegalArgumentException, CancelException, IOException {
if ((null != superGraph) && !force) return;
List<String> entryPoints = new ArrayList<String>();
if (null != test) {
log.info("Generating Global SG:");
entryPoints.add("Leu/aniketos/dasca/dataflow/test/data/"+test);
} else {
log.info("Generating Test Specific SG ("+ test +"):");
entryPoints.addAll(Arrays.asList(customEntryPoints));
}
for (String element : entryPoints) {
log.info(" "+element);
}
JavaSourceAnalysisEngine engine = PlugInUtil.createECJJavaEngine(sources, libs,
entryPoints.stream().toArray(String[]::new));
CallGraph cg = engine.buildDefaultCallGraph();
AnalysisCache ac = new AnalysisCache();
superGraph = ICFGSupergraph.make(cg, ac);
log.info("CG size: "+cg.getNumberOfNodes());
log.info("SG size: "+superGraph.getNumberOfNodes());
logConfiguration();
logConfiguration();
}
}
public static void initTestSG(String test)
throws IllegalArgumentException, CancelException, IOException{
initTestSG(test, false);
}
public static void initTestSG()
throws IllegalArgumentException, CancelException, IOException{
initTestSG(null);
}
@BeforeClass
public static void setUp() throws IllegalArgumentException, CancelException, IOException {
if (null != superGraph) return;
sources = Arrays.asList(testDir);
libs = Arrays.asList(WalaProperties.getJ2SEJarFiles());
logConfiguration();
initTestSG();
}
public static void initTestSG(String test)
throws IllegalArgumentException, CancelException, IOException {
initTestSG(test, false);
}
public static void initTestSG()
throws IllegalArgumentException, CancelException, IOException {
initTestSG(null);
}
@BeforeClass
public static void setUp() throws IllegalArgumentException, CancelException, IOException {
if (null != superGraph) return;
sources = Arrays.asList(testDir);
libs = Arrays.asList(WalaProperties.getJ2SEJarFiles());
logConfiguration();
initTestSG();
}
}