from propertieis

This commit is contained in:
fixminer
2020-01-31 11:33:46 +01:00
parent 4a04e4d909
commit 1d14187e28
2 changed files with 23 additions and 12 deletions
+1
View File
@@ -6,6 +6,7 @@
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resource" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
@@ -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<HierarchicalActionSet> 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<HierarchicalActionSet> 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<HierarchicalActionSet> hierarchicalActionSets = parser.parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath);
hierarchicalActionSets.size();
Assert.assertEquals(hierarchicalActionSets.size(),1);