This commit is contained in:
fixminer
2020-04-06 13:49:51 +02:00
parent cdb2bc5c70
commit 9dcdb6aafc
12 changed files with 78 additions and 68 deletions
-24
View File
@@ -1,24 +0,0 @@
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CI with Maven
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Maven
run: mvn -B package --file pom.xml
+2
View File
@@ -6,6 +6,8 @@
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> <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/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resource" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resource/testFiles" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" /> <excludeFolder url="file://$MODULE_DIR$/target" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
@@ -1,4 +1,4 @@
package edu.lu.uni.serval.fixminer.akka; package edu.lu.uni.serval.fixminer.ediff;
/** /**
* Created by anilkoyuncu on 18/09/2018. * Created by anilkoyuncu on 18/09/2018.
@@ -1,6 +1,5 @@
package edu.lu.uni.serval.fixminer.ediff; package edu.lu.uni.serval.fixminer.ediff;
import edu.lu.uni.serval.fixminer.akka.BaseMessage;
import redis.clients.jedis.JedisPool; import redis.clients.jedis.JedisPool;
import java.util.List; import java.util.List;
@@ -41,7 +41,7 @@ public class EDiffParser extends Parser {
* @param revFile * @param revFile
* @return * @return
*/ */
protected List<HierarchicalActionSet> parseChangedSourceCodeWithGumTree2(File prevFile, File revFile,String srcMLPath,boolean isJava) { public List<HierarchicalActionSet> parseChangedSourceCodeWithGumTree2(File prevFile, File revFile,String srcMLPath,boolean isJava) {
List<HierarchicalActionSet> actionSets = new ArrayList<>(); List<HierarchicalActionSet> actionSets = new ArrayList<>();
// GumTree results // GumTree results
// boolean isJava =false; // boolean isJava =false;
+1 -1
View File
@@ -15,7 +15,7 @@ inputPath = /Users/anil.koyuncu/projects/test/fixminer-data/patches
#redisPath = /Users/anil.koyuncu/projects/fixminer/fixminer-core/python/data/redis #redisPath = /Users/anil.koyuncu/projects/fixminer/fixminer-core/python/data/redis
redisPath = /Users/anil.koyuncu/projects/test/fixminer-core/python/data/redis redisPath = /Users/anil.koyuncu/projects/test/fixminer-core/python/data/redis
#srcMLPath= /Users/anil.koyuncu/Downloads/srcML.0.9.5/bin/srcml #srcMLPath= /Users/anil.koyuncu/Downloads/srcML.0.9.5/bin/srcml
srcMLPath= /Users/anil.koyuncu/projects/test/srcML/bin/srcml srcMLPath= /usr/local/bin/srcml
#srcMLPath= /usr/local/bin/srcml #srcMLPath= /usr/local/bin/srcml
actionType = ALL actionType = ALL
@@ -0,0 +1,47 @@
package edu.lu.uni.serval.FixPatternMiner;
import edu.lu.uni.serval.fixminer.ediff.EDiffHunkParser;
import edu.lu.uni.serval.fixminer.ediff.HierarchicalActionSet;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.List;
import java.util.Properties;
public class BaseTest {
public List<HierarchicalActionSet> getHierarchicalActionSets(String s) throws IOException {
Properties appProps = new Properties();
appProps.load(new FileInputStream("src/main/resource/app.properties"));
String srcMLPath = appProps.getProperty("srcMLPath", "FORKJOIN");
// String root = appProps.getProperty("inputPath");
String root = "src/main/resource/testFiles";
root = root + "/codeflaws/";
String filename = s;
try{
File revFile = new File(root + "revFiles/" + filename);
File prevFile = new File(root + "prevFiles/prev_" + filename);
EDiffHunkParser parser = new EDiffHunkParser();
List<HierarchicalActionSet> hierarchicalActionSets = parser.parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath,false);
return hierarchicalActionSets;
}catch (NullPointerException n){
// String cmd = "cp /Users/anil.koyuncu/projects/test/fixminer-data/patches/codeflaws/"+n.getMessage().split(root)[1] + " /Users/anil.koyuncu/projects/test/fixminerC/"+n.getMessage();
// CallShell cs = new CallShell();
// try {
// cs.runShell(cmd);
// } catch (Exception e) {
// e.printStackTrace();
// }
return null;
}
}
}
@@ -1,11 +1,14 @@
package edu.lu.uni.serval.fixminer.ediff; package edu.lu.uni.serval.FixPatternMiner;
import com.github.gumtreediff.tree.ITree; import com.github.gumtreediff.tree.ITree;
import edu.lu.uni.serval.fixminer.ediff.EDiffHunkParser;
import edu.lu.uni.serval.fixminer.ediff.HierarchicalActionSet;
import edu.lu.uni.serval.utils.ClusterToPattern; import edu.lu.uni.serval.utils.ClusterToPattern;
import edu.lu.uni.serval.utils.EDiffHelper; import edu.lu.uni.serval.utils.EDiffHelper;
import edu.lu.uni.serval.utils.PoolBuilder; import edu.lu.uni.serval.utils.PoolBuilder;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.javatuples.Pair; import org.javatuples.Pair;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import redis.clients.jedis.JedisPool; import redis.clients.jedis.JedisPool;
@@ -14,8 +17,8 @@ import java.io.IOException;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;
import java.util.*; import java.util.*;
@Ignore
public class HunkParserTest { public class HunkParserTest extends BaseTest{
@Test @Test
public void testSimple() throws IOException { public void testSimple() throws IOException {
@@ -1,5 +1,7 @@
package edu.lu.uni.serval.fixminer.ediff; package edu.lu.uni.serval.FixPatternMiner;
import edu.lu.uni.serval.fixminer.ediff.EDiffHunkParser;
import edu.lu.uni.serval.fixminer.ediff.HierarchicalActionSet;
import edu.lu.uni.serval.utils.CallShell; import edu.lu.uni.serval.utils.CallShell;
import edu.lu.uni.serval.utils.EDiffHelper; import edu.lu.uni.serval.utils.EDiffHelper;
import org.junit.Assert; import org.junit.Assert;
@@ -11,7 +13,7 @@ import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
@Ignore
public class TestInputCases { public class TestInputCases {
@@ -1,7 +1,10 @@
package edu.lu.uni.serval.fixminer.ediff; package edu.lu.uni.serval.FixPatternMiner;
import edu.lu.uni.serval.fixminer.ediff.EDiffHunkParser;
import edu.lu.uni.serval.fixminer.ediff.HierarchicalActionSet;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import java.io.File; import java.io.File;
@@ -15,7 +18,7 @@ import java.util.Properties;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Ignore
public class TestIntroClass { public class TestIntroClass {
@@ -1,7 +1,10 @@
package edu.lu.uni.serval.fixminer.ediff; package edu.lu.uni.serval.FixPatternMiner;
import edu.lu.uni.serval.fixminer.ediff.EDiffHunkParser;
import edu.lu.uni.serval.fixminer.ediff.HierarchicalActionSet;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import java.io.File; import java.io.File;
@@ -9,7 +12,7 @@ import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
@Ignore
public class TestPredefinedCases { public class TestPredefinedCases {
@@ -1,9 +1,12 @@
package edu.lu.uni.serval.fixminer.ediff; package edu.lu.uni.serval.FixPatternMiner;
import com.github.gumtreediff.tree.ITree; import com.github.gumtreediff.tree.ITree;
import edu.lu.uni.serval.fixminer.ediff.EDiffHunkParser;
import edu.lu.uni.serval.fixminer.ediff.HierarchicalActionSet;
import edu.lu.uni.serval.utils.CallShell; import edu.lu.uni.serval.utils.CallShell;
import edu.lu.uni.serval.utils.EDiffHelper; import edu.lu.uni.serval.utils.EDiffHelper;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import java.io.File; import java.io.File;
@@ -11,8 +14,8 @@ import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Properties; import java.util.Properties;
@Ignore
public class TestRealCases { public class TestRealCases extends BaseTest {
@@ -864,35 +867,7 @@ public class TestRealCases {
"------------------INS literal:number@@3 @TO@ expr@@3 @AT@ 352 @LENGTH@ 1\n"); "------------------INS literal:number@@3 @TO@ expr@@3 @AT@ 352 @LENGTH@ 1\n");
} }
public List<HierarchicalActionSet> getHierarchicalActionSets(String s) throws IOException {
Properties appProps = new Properties();
appProps.load(new FileInputStream("src/main/resource/app.properties"));
String srcMLPath = appProps.getProperty("srcMLPath", "FORKJOIN");
// String root = appProps.getProperty("inputPath");
String root = "src/main/resource/testFiles";
root = root + "/codeflaws/";
String filename = s;
try{
File revFile = new File(root + "revFiles/" + filename);
File prevFile = new File(root + "prevFiles/prev_" + filename);
EDiffHunkParser parser = new EDiffHunkParser();
List<HierarchicalActionSet> hierarchicalActionSets = parser.parseChangedSourceCodeWithGumTree2(prevFile, revFile, srcMLPath,false);
return hierarchicalActionSets;
}catch (NullPointerException n){
String cmd = "cp /Users/anil.koyuncu/projects/test/fixminer-data/patches/codeflaws/"+n.getMessage().split(root)[1] + " /Users/anil.koyuncu/projects/test/fixminerC/"+n.getMessage();
CallShell cs = new CallShell();
try {
cs.runShell(cmd);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
} }