From 1d14187e28a6612c7ce89c095d989e3f0e70f34b Mon Sep 17 00:00:00 2001 From: fixminer Date: Fri, 31 Jan 2020 11:33:46 +0100 Subject: [PATCH] from propertieis --- FixPatternMiner.iml | 1 + .../akka/ediff/TestPredefinedCases.java | 34 ++++++++++++------- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/FixPatternMiner.iml b/FixPatternMiner.iml index b309440..9c4c7f3 100644 --- a/FixPatternMiner.iml +++ b/FixPatternMiner.iml @@ -6,6 +6,7 @@ + diff --git a/src/main/java/edu/lu/uni/serval/fixminer/akka/ediff/TestPredefinedCases.java b/src/main/java/edu/lu/uni/serval/fixminer/akka/ediff/TestPredefinedCases.java index 16dca0e..9c59aa6 100644 --- a/src/main/java/edu/lu/uni/serval/fixminer/akka/ediff/TestPredefinedCases.java +++ b/src/main/java/edu/lu/uni/serval/fixminer/akka/ediff/TestPredefinedCases.java @@ -12,24 +12,32 @@ import org.junit.Test; import redis.clients.jedis.JedisPool; import java.io.File; +import java.io.FileInputStream; import java.io.IOException; import java.time.Duration; import java.time.Instant; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Properties; public class TestPredefinedCases { + + @Test public void testIFCase1() throws IOException { - File revFile = new File("/Users/anilkoyuncu/projects/fixminer/fixminer_source/src/main/resource/testFiles/if_example_1.c"); - File prevFile =new File("/Users/anilkoyuncu/projects/fixminer/fixminer_source/src/main/resource/testFiles/prev_if_example_1.c"); + Properties appProps = new Properties(); + appProps.load(new FileInputStream("src/main/resource/app.properties")); + String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN"); + + File revFile = new File("src/main/resource/testFiles/if_example_1.c"); + File prevFile =new File("src/main/resource/testFiles/prev_if_example_1.c"); EDiffHunkParser parser = new EDiffHunkParser(); - String srcMLPath = "/usr/local/bin/srcml"; + List hierarchicalActionSets = parser.parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath); hierarchicalActionSets.size(); @@ -42,16 +50,18 @@ public class TestPredefinedCases { } @Test public void testForCase1() throws IOException { + Properties appProps = new Properties(); + appProps.load(new FileInputStream("src/main/resource/app.properties")); + String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN"); - - File revFile = new File("/Users/anilkoyuncu/projects/fixminer/fixminer_source/src/main/resource/testFiles/for_example_1.c"); - File prevFile =new File("/Users/anilkoyuncu/projects/fixminer/fixminer_source/src/main/resource/testFiles/prev_for_example_1.c"); + File revFile = new File("src/main/resource/testFiles/for_example_1.c"); + File prevFile =new File("src/main/resource/testFiles/prev_for_example_1.c"); EDiffHunkParser parser = new EDiffHunkParser(); - String srcMLPath = "/usr/local/bin/srcml"; + List hierarchicalActionSets = parser.parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath); hierarchicalActionSets.size(); @@ -70,17 +80,17 @@ public class TestPredefinedCases { } @Test public void testWhileCase1() throws IOException { + Properties appProps = new Properties(); + appProps.load(new FileInputStream("src/main/resource/app.properties")); + String srcMLPath = appProps.getProperty("srcMLPath","FORKJOIN"); - - File revFile = new File("/Users/anilkoyuncu/projects/fixminer/fixminer_source/src/main/resource/testFiles/while_example_1.c"); - File prevFile =new File("/Users/anilkoyuncu/projects/fixminer/fixminer_source/src/main/resource/testFiles/prev_while_example_1.c"); + File revFile = new File("src/main/resource/testFiles/while_example_1.c"); + File prevFile =new File("src/main/resource/testFiles/prev_while_example_1.c"); EDiffHunkParser parser = new EDiffHunkParser(); - String srcMLPath = "/usr/local/bin/srcml"; - List hierarchicalActionSets = parser.parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath); hierarchicalActionSets.size(); Assert.assertEquals(hierarchicalActionSets.size(),1);