defects4j worked
This commit is contained in:
@@ -93,7 +93,7 @@ public class AkkaTreeLoader {
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
public static void main(String portInner,String serverWait,String dbDir,String chunkName,String port){
|
||||
public static void main(String portInner,String serverWait,String dbDir,String chunkName,String port, String dumpsName){
|
||||
|
||||
// String inputPath;
|
||||
//// String outputPath;
|
||||
@@ -134,7 +134,7 @@ public class AkkaTreeLoader {
|
||||
// numOfWorkers = "1";
|
||||
//
|
||||
// }
|
||||
String parameters = String.format("\nportInner %s \nserverWait %s \nchunkName %s \ndbDir %s",portInner,serverWait,chunkName,dbDir);
|
||||
String parameters = String.format("\nportInner %s \nserverWait %s \nchunkName %s \ndbDir %s \ndumpsName %s",portInner,serverWait,chunkName,dbDir,dumpsName);
|
||||
log.info(parameters);
|
||||
|
||||
// if (option.equals("CALC")) {
|
||||
@@ -142,7 +142,7 @@ public class AkkaTreeLoader {
|
||||
// log.info("Calculate pairs done");
|
||||
// }else {
|
||||
String cmd = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
|
||||
String cmd1 = String.format(cmd, dbDir,"dumps.rdb",Integer.valueOf(port));
|
||||
String cmd1 = String.format(cmd, dbDir,dumpsName,Integer.valueOf(port));
|
||||
loadRedis(cmd1,serverWait);
|
||||
|
||||
String cmdInner = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
|
||||
|
||||
@@ -30,7 +30,7 @@ import static edu.lu.uni.serval.FixPatternParser.cluster.TreeLoaderClusterL1.poo
|
||||
public class CalculatePairs {
|
||||
private static Logger log = LoggerFactory.getLogger(CalculatePairs.class);
|
||||
// public static void main(String[] args) {
|
||||
public static void main(String inputPath,String portInner,String serverWait,String dbDir,String chunkName,String numOfWorkers,String port,String outputPath){
|
||||
public static void main(String serverWait,String dbDir,String chunkName,String port,String outputPath,String pjName){
|
||||
|
||||
// String inputPath;
|
||||
// String port;
|
||||
@@ -62,12 +62,12 @@ public class CalculatePairs {
|
||||
//
|
||||
//
|
||||
// }
|
||||
String parameters = String.format("\nInput path %s \nportInner %s \nserverWait %s \nchunkName %s \ndbDir %s",inputPath,portInner,serverWait,chunkName,dbDir);
|
||||
String parameters = String.format("\nport %s \nserverWait %s \nchunkName %s \ndbDir %s",port,serverWait,chunkName,dbDir);
|
||||
log.info(parameters);
|
||||
|
||||
|
||||
String cmd = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
|
||||
cmd = String.format(cmd, dbDir,"dumps.rdb",Integer.valueOf(port));
|
||||
cmd = String.format(cmd, dbDir,chunkName,Integer.valueOf(port));
|
||||
loadRedis(cmd,serverWait);
|
||||
|
||||
FileHelper.createDirectory(outputPath);
|
||||
@@ -99,7 +99,7 @@ public class CalculatePairs {
|
||||
String line = null;
|
||||
try {
|
||||
|
||||
FileChannel rwChannel = new RandomAccessFile(outputPath + "/" +"textfile.txt", "rw").getChannel();
|
||||
FileChannel rwChannel = new RandomAccessFile(outputPath + "/" +pjName +".txt", "rw").getChannel();
|
||||
ByteBuffer wrBuf = rwChannel.map(FileChannel.MapMode.READ_WRITE, 0, Integer.MAX_VALUE);
|
||||
int fileCounter = 0;
|
||||
|
||||
@@ -116,7 +116,7 @@ public class CalculatePairs {
|
||||
}else{
|
||||
log.info("Next pair dump");
|
||||
fileCounter++;
|
||||
rwChannel = new RandomAccessFile(outputPath+"/" +"textfile"+String.valueOf(fileCounter)+".txt", "rw").getChannel();
|
||||
rwChannel = new RandomAccessFile(outputPath+"/" +pjName+String.valueOf(fileCounter)+".txt", "rw").getChannel();
|
||||
wrBuf = rwChannel.map(FileChannel.MapMode.READ_WRITE, 0, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@ public class Compare {
|
||||
|
||||
Map<String, String> resultMap;
|
||||
Jedis jedis = null;
|
||||
ITree oldTree = null;
|
||||
ITree newTree = null;
|
||||
|
||||
try {
|
||||
jedis = innerPool.getResource();
|
||||
@@ -40,9 +42,9 @@ public class Compare {
|
||||
String firstValue = resultMap.get("0");
|
||||
String secondValue = resultMap.get("1");
|
||||
|
||||
ITree oldTree = getSimpliedTree(firstValue,outerPool);
|
||||
oldTree = getSimpliedTree(firstValue,outerPool);
|
||||
|
||||
ITree newTree = getSimpliedTree(secondValue,outerPool);
|
||||
newTree = getSimpliedTree(secondValue,outerPool);
|
||||
|
||||
Matcher m = Matchers.getInstance().getMatcher(oldTree, newTree);
|
||||
m.match();
|
||||
@@ -67,7 +69,7 @@ public class Compare {
|
||||
if (((Double) chawatheSimilarity1).equals(1.0) || ((Double) diceSimilarity1).equals(1.0)
|
||||
|| ((Double) jaccardSimilarity1).equals(1.0) || actions.size() == 0) {
|
||||
String matchKey = "match_" + (String.valueOf(i)) + "_" + String.valueOf(j);
|
||||
log.info(matchKey);
|
||||
// log.info(matchKey);
|
||||
|
||||
jedis.select(1);
|
||||
jedis.set(matchKey, result);
|
||||
@@ -81,7 +83,8 @@ public class Compare {
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString() + " {}", (name));
|
||||
|
||||
log.error(e.toString() + " {}", name);
|
||||
|
||||
|
||||
}finally {
|
||||
|
||||
@@ -21,7 +21,7 @@ public class ImportPairs2DB {
|
||||
private static Logger log = LoggerFactory.getLogger(ImportPairs2DB.class);
|
||||
// public static void main(String[] args) {
|
||||
|
||||
public static void main(String inputPath,String portInner,String serverWait,String dbDir,String chunkName,String numOfWorkers){
|
||||
public static void main(String csvInputPath,String portInner,String serverWait,String dbDir,String numOfWorkers){
|
||||
|
||||
// String inputPath;
|
||||
// String portInner;
|
||||
@@ -44,11 +44,11 @@ public class ImportPairs2DB {
|
||||
// dbDir = "/Users/anilkoyuncu/bugStudy/dataset/redis";
|
||||
// numOfWorkers = "1";
|
||||
// }
|
||||
String parameters = String.format("\nInput path %s \nportInner %s \nserverWait %s \nchunkName %s \nnumOfWorks %s \ndbDir %s",inputPath,portInner,serverWait,chunkName,numOfWorkers,dbDir);
|
||||
String parameters = String.format("\nInput path %s \nportInner %s \nserverWait %s \nnumOfWorks %s \ndbDir %s",csvInputPath,portInner,serverWait,numOfWorkers,dbDir);
|
||||
log.info(parameters);
|
||||
|
||||
|
||||
File folder = new File(inputPath);
|
||||
File folder = new File(csvInputPath);
|
||||
File[] subFolders = folder.listFiles();
|
||||
Stream<File> stream = Arrays.stream(subFolders);
|
||||
List<File> pjs = stream
|
||||
@@ -63,7 +63,7 @@ public class ImportPairs2DB {
|
||||
log.info(cmd);
|
||||
loadRedisWait(cmd);
|
||||
|
||||
cmd = "bash "+dbDir + "redisImportSingle.sh" +" %s %s";
|
||||
cmd = "bash "+dbDir + "/redisImportSingle.sh" +" %s %s";
|
||||
|
||||
cmd = String.format(cmd, pj.getPath(), portInt);
|
||||
log.info(cmd);
|
||||
|
||||
@@ -26,7 +26,7 @@ public class StoreFile {
|
||||
private static Logger log = LoggerFactory.getLogger(StoreFile.class);
|
||||
|
||||
// public static void main(String[] args) {
|
||||
public static void main(String inputPath,String portInner,String serverWait,String dbDir,String chunkName,String numOfWorkers){
|
||||
public static void main(String inputPath,String portInner,String serverWait,String dbDir,String chunkName){
|
||||
// String inputPath;
|
||||
// String portInner;
|
||||
// String serverWait;
|
||||
@@ -48,7 +48,7 @@ public class StoreFile {
|
||||
// dbDir = "/Users/anilkoyuncu/bugStudy/dataset/redis";
|
||||
// numOfWorkers = "1";
|
||||
// }
|
||||
String parameters = String.format("\nInput path %s \nportInner %s \nserverWait %s \nchunkName %s \nnumOfWorks %s \ndbDir %s",inputPath,portInner,serverWait,chunkName,numOfWorkers,dbDir);
|
||||
String parameters = String.format("\nInput path %s \nportInner %s \nserverWait %s \nchunkName %s \ndbDir %s",inputPath,portInner,serverWait,chunkName,dbDir);
|
||||
log.info(parameters);
|
||||
|
||||
String cmd = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
|
||||
@@ -84,6 +84,11 @@ public class StoreFile {
|
||||
.forEach(m -> storeCore(portInner, m.split(",")[1],m.split(",")[0]));
|
||||
|
||||
log.info(parameters);
|
||||
|
||||
String stopServer = "bash "+dbDir + "/" + "stopServer.sh" +" %s";
|
||||
String stopServer2 = String.format(stopServer,Integer.valueOf(portInner));
|
||||
loadRedis(stopServer2,serverWait);
|
||||
|
||||
}
|
||||
|
||||
public static void storeCore(String portInner,String path,String key){
|
||||
|
||||
@@ -38,7 +38,7 @@ public class TreeLoaderClusterL1 {
|
||||
private static Logger log = LoggerFactory.getLogger(TreeLoaderClusterL1.class);
|
||||
|
||||
// public static void main(String[] args){
|
||||
public static void main(String portInner,String serverWait,String port,String inputPath){
|
||||
public static void main(String portInner,String serverWait,String port,String inputPath,String level1DB,String level1Path){
|
||||
|
||||
// String inputPath;
|
||||
// String outputPath;
|
||||
@@ -67,13 +67,13 @@ public class TreeLoaderClusterL1 {
|
||||
log.info(parameters);
|
||||
|
||||
String cmd = "bash "+inputPath + "/" + "startServer.sh" +" %s %s %s";
|
||||
cmd = String.format(cmd, inputPath,"level1.rdb",Integer.valueOf(port));
|
||||
cmd = String.format(cmd, inputPath,level1DB,Integer.valueOf(port));
|
||||
loadRedis(cmd,serverWait);
|
||||
|
||||
JedisPool outerPool = new JedisPool(poolConfig, "127.0.0.1",Integer.valueOf(port),20000000);
|
||||
|
||||
|
||||
String level1Path = inputPath + "/level1";
|
||||
// String level1Path = inputPath + "/level1";
|
||||
File chunks = new File(level1Path);
|
||||
File[] listFiles = chunks.listFiles();
|
||||
Stream<File> stream = Arrays.stream(listFiles);
|
||||
@@ -81,8 +81,8 @@ public class TreeLoaderClusterL1 {
|
||||
.filter(x -> x.getName().endsWith(".rdb"))
|
||||
.collect(Collectors.toList());
|
||||
for (File db : dbs) {
|
||||
String cmdInner = "bash "+level1Path + "/" + "startServer.sh" +" %s %s %s";
|
||||
cmdInner = String.format(cmdInner, level1Path,db.getName(),Integer.valueOf(portInner));
|
||||
String cmdInner = "bash "+inputPath + "/" + "startServer.sh" +" %s %s %s";
|
||||
cmdInner = String.format(cmdInner, inputPath,db.getName(),Integer.valueOf(portInner));
|
||||
loadRedis(cmdInner,serverWait);
|
||||
JedisPool innerPool = new JedisPool(poolConfig, "127.0.0.1",Integer.valueOf(portInner),20000000);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public class CommitPatchParser extends Parser{
|
||||
@Override
|
||||
public void parseFixPatterns(File prevFile, File revFile, File diffEntryFile) {
|
||||
}
|
||||
|
||||
|
||||
protected DiffEntryHunk matchHunk(int startLine, int endLine, int startLine2, int endLine2, String actionStr, List<DiffEntryHunk> hunks) {
|
||||
for (DiffEntryHunk hunk : hunks) {
|
||||
int bugStartLine = hunk.getBugLineStartNum();
|
||||
|
||||
+4
-3
@@ -49,10 +49,11 @@ public class FixedViolationHunkParser extends FixedViolationParser {
|
||||
|
||||
|
||||
FileOutputStream f = null;
|
||||
|
||||
try {
|
||||
String pj = diffentryFile.getParent().split("GumTreeInputBug13April")[1];
|
||||
String root = diffentryFile.getParent().split("GumTreeInputBug13April")[0];
|
||||
String hunkTreeFileName = root+"GumTreeOutput13April/" +pj.replace("DiffEntries","ActionSetDumps/") + diffentryFile.getName() + "_" + String.valueOf(hunkSet);
|
||||
String pj = diffentryFile.getParent().split("Defects4J")[1];
|
||||
String root = diffentryFile.getParent().split("Defects4J")[0];
|
||||
String hunkTreeFileName = root+"GumTreeOutputDefects4J/" +pj.replace("DiffEntries","ActionSetDumps/") + diffentryFile.getName() + "_" + String.valueOf(hunkSet);
|
||||
f = new FileOutputStream(new File(hunkTreeFileName));
|
||||
ObjectOutputStream o = new ObjectOutputStream(f);
|
||||
o.writeObject(actionSet);
|
||||
|
||||
+28
-23
@@ -88,7 +88,7 @@ public class MultiThreadTreeLoaderCluster {
|
||||
cmd = String.format(cmd, dbDir,"dumps.rdb",Integer.valueOf("6399"));
|
||||
edu.lu.uni.serval.FixPatternParser.cluster.AkkaTreeLoader.loadRedis(cmd,"10000");
|
||||
|
||||
calculatePairsOfClusters(inputPath, outputPath);
|
||||
// calculatePairsOfClusters(inputPath, outputPath);
|
||||
// mainCompare(inputPath,port,pairsCSVPath,importScript);
|
||||
// calculatePairs(inputPath, outputPath);
|
||||
// processMessages(inputPath,outputPath);
|
||||
@@ -119,15 +119,25 @@ public class MultiThreadTreeLoaderCluster {
|
||||
log.info("Load done");
|
||||
}
|
||||
|
||||
public static void mainCompare(String inputPath,String port,String pairsCSVPath,String importScript) {
|
||||
public static void mainCompare(String port,String pairsCSVPath,String importScript,String dbDir,String chunkName,String dumpName,String portInner) {
|
||||
|
||||
String cmd;
|
||||
cmd = "bash " + importScript +" %s %s";
|
||||
String cmd1 = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
|
||||
cmd1 = String.format(cmd1, dbDir,chunkName,Integer.valueOf(portInner));
|
||||
edu.lu.uni.serval.FixPatternParser.cluster.AkkaTreeLoader.loadRedis(cmd1,"1000");
|
||||
|
||||
|
||||
JedisPool jedisPool = new JedisPool(poolConfig, "127.0.0.1",Integer.valueOf(port),20000000);
|
||||
String cmd2 = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
|
||||
cmd2 = String.format(cmd2, dbDir,dumpName,Integer.valueOf(port));
|
||||
edu.lu.uni.serval.FixPatternParser.cluster.AkkaTreeLoader.loadRedis(cmd2,"10000");
|
||||
|
||||
JedisPool outerPool = new JedisPool(poolConfig, "127.0.0.1",Integer.valueOf("6399"),20000000);
|
||||
|
||||
String cmd3;
|
||||
cmd3 = "bash " + importScript +" %s %s";
|
||||
|
||||
|
||||
JedisPool jedisPool = new JedisPool(poolConfig, "127.0.0.1",Integer.valueOf(portInner),20000000);
|
||||
|
||||
JedisPool outerPool = new JedisPool(poolConfig, "127.0.0.1",Integer.valueOf(port),20000000);
|
||||
|
||||
|
||||
File folder = new File(pairsCSVPath);
|
||||
@@ -139,7 +149,7 @@ public class MultiThreadTreeLoaderCluster {
|
||||
|
||||
for (File f:folders){
|
||||
|
||||
if(f.getName().startsWith("cluster0")) {
|
||||
// if(f.getName().startsWith("cluster0")) {
|
||||
|
||||
|
||||
try (Jedis jedis = jedisPool.getResource()) {
|
||||
@@ -153,7 +163,7 @@ public class MultiThreadTreeLoaderCluster {
|
||||
int size = scan.getResult().size();
|
||||
|
||||
if (size == 0) {
|
||||
String comd = String.format(cmd,f.getPath(),port);
|
||||
String comd = String.format(cmd3,f.getPath(),portInner);
|
||||
loadRedis(comd);
|
||||
|
||||
scan = jedis.scan("0", sc);
|
||||
@@ -169,13 +179,13 @@ public class MultiThreadTreeLoaderCluster {
|
||||
//76
|
||||
|
||||
scan.getResult().parallelStream()
|
||||
.forEach(m -> coreCompare(m, inputPath, jedisPool, clusterName,outerPool));
|
||||
.forEach(m -> coreCompare(m, jedisPool, clusterName,outerPool));
|
||||
|
||||
|
||||
jedis.save();
|
||||
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
@@ -224,23 +234,18 @@ public class MultiThreadTreeLoaderCluster {
|
||||
Jedis inner = null;
|
||||
String[] split2 = firstValue.split("/");
|
||||
String cluster = split2[1];
|
||||
|
||||
File folder = new File("/Users/anilkoyuncu/bugStudy/code/python/cluster/"+cluster);
|
||||
File[] listOfFiles = folder.listFiles();
|
||||
Stream<File> stream = Arrays.stream(listOfFiles);
|
||||
List<File> folders = stream
|
||||
.filter(x -> !x.getName().startsWith(".") && x.getName().startsWith(split2[2]))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
String[] split1 = folders.get(0).getName().split(".txt_");
|
||||
String s = split1[0];
|
||||
String[] splitPJ = split1[1].split("_");
|
||||
String fullFileName = split2[2];
|
||||
String[] split = fullFileName.split(".txt_");
|
||||
String pureFileName = split[0];
|
||||
String[] splitPJ = split[1].split("_");
|
||||
String project = splitPJ[1];
|
||||
String actionSetPosition = splitPJ[0];
|
||||
|
||||
|
||||
|
||||
try {
|
||||
inner = outerPool.getResource();
|
||||
String filename = project + "/ActionSetDumps/" + split2[2];
|
||||
String filename = project + "/ActionSetDumps/" + pureFileName + ".txt_" + actionSetPosition;
|
||||
String si= inner.get(filename);
|
||||
HierarchicalActionSet actionSet = (HierarchicalActionSet) fromString(si);
|
||||
|
||||
@@ -400,7 +405,7 @@ public class MultiThreadTreeLoaderCluster {
|
||||
|
||||
|
||||
|
||||
private static void coreCompare(String name , String inputPath, JedisPool jedisPool,String clusterName,JedisPool outerPool) {
|
||||
private static void coreCompare(String name , JedisPool jedisPool,String clusterName,JedisPool outerPool) {
|
||||
|
||||
|
||||
try (Jedis jedis = jedisPool.getResource()) {
|
||||
|
||||
+43
-15
@@ -99,7 +99,7 @@ public class MultiThreadTreeLoaderCluster3 {
|
||||
cmd = String.format(cmd, dbDir,"dumps.rdb",Integer.valueOf("6399"));
|
||||
edu.lu.uni.serval.FixPatternParser.cluster.AkkaTreeLoader.loadRedis(cmd,"1000");
|
||||
|
||||
mainCompare(inputPath,port,pairsCSVPath,importScript);
|
||||
// mainCompare(inputPath,port,pairsCSVPath,importScript);
|
||||
// calculatePairs(inputPath, outputPath);
|
||||
// processMessages(inputPath,outputPath);
|
||||
// evaluateResults(inputPath,outputPath);
|
||||
@@ -160,13 +160,27 @@ public class MultiThreadTreeLoaderCluster3 {
|
||||
log.info("Load done");
|
||||
}
|
||||
|
||||
public static void mainCompare(String inputPath,String port,String pairsCSVPath,String importScript) {
|
||||
// public static void mainCompare(String inputPath,String port,String pairsCSVPath,String importScript) {
|
||||
public static void mainCompare(String port,String pairsCSVPath,String importScript,String dbDir,String chunkName,String dumpName,String portInner) {
|
||||
|
||||
String cmd;
|
||||
cmd = "bash " + importScript +" %s %s";
|
||||
String cmd1 = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
|
||||
cmd1 = String.format(cmd1, dbDir,chunkName,Integer.valueOf(portInner));
|
||||
edu.lu.uni.serval.FixPatternParser.cluster.AkkaTreeLoader.loadRedis(cmd1,"1000");
|
||||
|
||||
|
||||
String cmd2 = "bash "+dbDir + "/" + "startServer.sh" +" %s %s %s";
|
||||
cmd2 = String.format(cmd2, dbDir,dumpName,Integer.valueOf(port));
|
||||
edu.lu.uni.serval.FixPatternParser.cluster.AkkaTreeLoader.loadRedis(cmd2,"10000");
|
||||
|
||||
|
||||
String cmd3;
|
||||
cmd3 = "bash " + importScript +" %s %s";
|
||||
|
||||
|
||||
JedisPool jedisPool = new JedisPool(poolConfig, "127.0.0.1",Integer.valueOf(portInner),20000000);
|
||||
|
||||
JedisPool outerPool = new JedisPool(poolConfig, "127.0.0.1",Integer.valueOf(port),20000000);
|
||||
|
||||
JedisPool jedisPool = new JedisPool(poolConfig, "127.0.0.1",Integer.valueOf(port),20000000);
|
||||
JedisPool outerPool = new JedisPool(poolConfig, "127.0.0.1",Integer.valueOf("6399"),20000000);
|
||||
|
||||
|
||||
File folder = new File(pairsCSVPath);
|
||||
@@ -192,7 +206,7 @@ public class MultiThreadTreeLoaderCluster3 {
|
||||
int size = scan.getResult().size();
|
||||
|
||||
if (size == 0) {
|
||||
String comd = String.format(cmd, f.getPath(), port);
|
||||
String comd = String.format(cmd3, f.getPath(), portInner);
|
||||
edu.lu.uni.serval.FixPatternParser.violations.MultiThreadTreeLoaderCluster.
|
||||
loadRedis(comd);
|
||||
|
||||
@@ -207,7 +221,7 @@ public class MultiThreadTreeLoaderCluster3 {
|
||||
|
||||
|
||||
scan.getResult().parallelStream()
|
||||
.forEach(m -> coreCompare(m, inputPath, jedisPool, clusterName, outerPool));
|
||||
.forEach(m -> coreCompare(m, jedisPool, clusterName, outerPool));
|
||||
|
||||
|
||||
jedis.save();
|
||||
@@ -241,9 +255,9 @@ public class MultiThreadTreeLoaderCluster3 {
|
||||
String actionSetPosition = splitPJ[0];
|
||||
|
||||
Integer asp = Integer.valueOf(actionSetPosition);
|
||||
if (asp > 1){
|
||||
return null;
|
||||
}
|
||||
// if (asp > 1){
|
||||
// return null;
|
||||
// }
|
||||
|
||||
|
||||
ITree tree = null;
|
||||
@@ -464,6 +478,20 @@ public class MultiThreadTreeLoaderCluster3 {
|
||||
oldTokens.add(hours.trim());
|
||||
}
|
||||
}
|
||||
}else if(label.startsWith("MOV") && upd == false){
|
||||
String timeRegex = "@@(.*)@TO@(.*)";
|
||||
Pattern pattern = Pattern.compile(timeRegex, Pattern.DOTALL);
|
||||
java.util.regex.Matcher matcher = pattern.matcher(split[1]);
|
||||
|
||||
if (matcher.matches()) {
|
||||
String hours = matcher.group(1);
|
||||
if (hours.startsWith("MethodName:")){
|
||||
String methodName = hours.split(":")[1];
|
||||
oldTokens.add(methodName);
|
||||
}else {
|
||||
oldTokens.add(hours.trim());
|
||||
}
|
||||
}
|
||||
}
|
||||
boolean alreadyAddParentMethodName = false;
|
||||
for (String s : m) {
|
||||
@@ -536,13 +564,13 @@ public class MultiThreadTreeLoaderCluster3 {
|
||||
}
|
||||
}
|
||||
|
||||
// if (oldTokens.size() == 0 || oldTokens.size() > 3) {// && (oldTree.getType() != 41 && oldTree.getType() != 21 && oldTree.getType() !=17 && oldTree.getType()!=60 && oldTree.getType() != 46)){
|
||||
// log.info("dur bakalim nereye!???");
|
||||
// }
|
||||
if (oldTokens.size() == 0 ) {// && (oldTree.getType() != 41 && oldTree.getType() != 21 && oldTree.getType() !=17 && oldTree.getType()!=60 && oldTree.getType() != 46)){
|
||||
log.info("dur bakalim nereye!???");
|
||||
}
|
||||
return oldTokens;
|
||||
}
|
||||
|
||||
private static void coreCompare(String name , String inputPath, JedisPool jedisPool,String clusterName,JedisPool outerPool) {
|
||||
private static void coreCompare(String name , JedisPool jedisPool,String clusterName,JedisPool outerPool) {
|
||||
|
||||
|
||||
try (Jedis jedis = jedisPool.getResource()) {
|
||||
|
||||
@@ -1,54 +1,45 @@
|
||||
package edu.lu.uni.serval.FixPatternParser.violations;
|
||||
|
||||
import static java.lang.System.err;
|
||||
import akka.actor.ActorRef;
|
||||
import akka.actor.ActorSystem;
|
||||
import edu.lu.uni.serval.MultipleThreadsParser.MessageFile;
|
||||
import edu.lu.uni.serval.MultipleThreadsParser.ParseFixPatternActor;
|
||||
import edu.lu.uni.serval.MultipleThreadsParser.WorkMessage;
|
||||
import edu.lu.uni.serval.config.Configuration;
|
||||
import edu.lu.uni.serval.utils.FileHelper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import akka.actor.ActorRef;
|
||||
import akka.actor.ActorSystem;
|
||||
import edu.lu.uni.serval.FixPatternParser.RunnableParser;
|
||||
import edu.lu.uni.serval.MultipleThreadsParser.AkkaParser;
|
||||
import edu.lu.uni.serval.MultipleThreadsParser.MessageFile;
|
||||
import edu.lu.uni.serval.MultipleThreadsParser.ParseFixPatternActor;
|
||||
import edu.lu.uni.serval.MultipleThreadsParser.WorkMessage;
|
||||
import edu.lu.uni.serval.config.Configuration;
|
||||
import edu.lu.uni.serval.utils.FileHelper;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class TestHunkParser {
|
||||
|
||||
private static Logger log = LoggerFactory.getLogger(TestHunkParser.class);
|
||||
public static void main(String[] args) {
|
||||
// public static void main(String[] args) {
|
||||
public static void main(String inputPath, String outputPath,String numOfWorkers) {
|
||||
// input data
|
||||
|
||||
// String rootPath = "/Users/anilkoyuncu/bugStudy";
|
||||
String inputPath;
|
||||
String outputPath;
|
||||
if(args.length > 0){
|
||||
inputPath = args[1];
|
||||
outputPath = args[0];
|
||||
}else{
|
||||
// inputPath = "/Users/anilkoyuncu/bugStudy/dataset/GumTreeInputBug4";
|
||||
inputPath = "/Users/anilkoyuncu/bugStudy/dataset/GumTreeInputBug13April";
|
||||
// outputPath = "/Users/anilkoyuncu/bugStudy/code/python/GumTreeOutput2/";
|
||||
outputPath = "/Users/anilkoyuncu/bugStudy/dataset/GumTreeOutput13April";
|
||||
}
|
||||
|
||||
//// String rootPath = "/Users/anilkoyuncu/bugStudy";
|
||||
// String inputPath;
|
||||
// String outputPath;
|
||||
// if(args.length > 0){
|
||||
// inputPath = args[1];
|
||||
// outputPath = args[0];
|
||||
// }else{
|
||||
//// inputPath = "/Users/anilkoyuncu/bugStudy/dataset/GumTreeInputBug4";
|
||||
// inputPath = "/Users/anilkoyuncu/bugStudy/dataset/GumTreeInputBug13April";
|
||||
//// outputPath = "/Users/anilkoyuncu/bugStudy/code/python/GumTreeOutput2/";
|
||||
// outputPath = "/Users/anilkoyuncu/bugStudy/dataset/GumTreeOutput13April";
|
||||
// }
|
||||
|
||||
String parameters = String.format("\nInput path %s \nOutput path %s",inputPath,outputPath);
|
||||
log.info(parameters);
|
||||
|
||||
File folder = new File(inputPath);
|
||||
File[] listOfFiles = folder.listFiles();
|
||||
@@ -74,7 +65,7 @@ public class TestHunkParser {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
final List<MessageFile> msgFiles = getMessageFiles(target.toString() + "/"); //"/Users/anilkoyuncu/bugStudy/code/python/GumTreeInput/Apache/CAMEL/"
|
||||
final List<MessageFile> msgFiles = getMessageFiles(target.toString() + "/", outputPath); //"/Users/anilkoyuncu/bugStudy/code/python/GumTreeInput/Apache/CAMEL/"
|
||||
System.out.println(msgFiles.size());
|
||||
if(msgFiles.size() == 0)
|
||||
continue;
|
||||
@@ -108,7 +99,7 @@ public class TestHunkParser {
|
||||
try {
|
||||
log.info("Akka begins...");
|
||||
system = ActorSystem.create("Mining-FixPattern-System");
|
||||
parsingActor = system.actorOf(ParseFixPatternActor.props(100, editScriptsFilePath,
|
||||
parsingActor = system.actorOf(ParseFixPatternActor.props(Integer.valueOf(numOfWorkers), editScriptsFilePath,
|
||||
patchesSourceCodeFilePath, buggyTokensFilePath, editScriptSizesFilePath), "mine-fix-pattern-actor");
|
||||
parsingActor.tell(msg, ActorRef.noSender());
|
||||
} catch (Exception e) {
|
||||
@@ -178,7 +169,7 @@ public class TestHunkParser {
|
||||
}
|
||||
|
||||
|
||||
private static List<MessageFile> getMessageFiles(String gumTreeInput) {
|
||||
private static List<MessageFile> getMessageFiles(String gumTreeInput,String outputPath) {
|
||||
String inputPath = gumTreeInput; // prevFiles revFiles diffentryFile positionsFile
|
||||
File revFilesPath = new File(inputPath + "revFiles/");
|
||||
File[] revFiles = revFilesPath.listFiles(); // project folders
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package edu.lu.uni.serval;
|
||||
|
||||
import edu.lu.uni.serval.FixPatternParser.cluster.*;
|
||||
import edu.lu.uni.serval.FixPatternParser.violations.MultiThreadTreeLoaderCluster;
|
||||
import edu.lu.uni.serval.FixPatternParser.violations.MultiThreadTreeLoaderCluster3;
|
||||
import edu.lu.uni.serval.FixPatternParser.violations.TestHunkParser;
|
||||
|
||||
/**
|
||||
* Created by anilkoyuncu on 14/04/2018.
|
||||
@@ -9,7 +12,7 @@ public class Launcher {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
String inputPath;
|
||||
// String inputPath;
|
||||
String portInner;
|
||||
String serverWait;
|
||||
String dbDir;
|
||||
@@ -17,42 +20,74 @@ public class Launcher {
|
||||
String numOfWorkers;
|
||||
String jobType;
|
||||
String port;
|
||||
String outputPath;
|
||||
String pairsPath;
|
||||
String csvInputPath;
|
||||
String dumpsName;
|
||||
String gumInput;
|
||||
String gumOutput;
|
||||
if (args.length > 0) {
|
||||
jobType = args[0];
|
||||
inputPath = args[1];
|
||||
gumInput = args[1];
|
||||
portInner = args[2];
|
||||
serverWait = args[3];
|
||||
chunkName = args[4];
|
||||
numOfWorkers = args[5];
|
||||
dbDir = args[6];
|
||||
port = args[7];
|
||||
outputPath = args[8];
|
||||
pairsPath = args[8];
|
||||
csvInputPath = args[9];
|
||||
dumpsName = args[10];
|
||||
gumOutput =args[12];
|
||||
} else {
|
||||
inputPath = "/Users/anilkoyuncu/bugStudy/dataset/pairs";
|
||||
// inputPath = "/Users/anilkoyuncu/bugStudy/dataset/pairs";
|
||||
gumInput = "/Users/anilkoyuncu/bugStudy/dataset/Defects4J/";
|
||||
portInner = "6380";
|
||||
serverWait = "10000";
|
||||
chunkName = "dumps.rdb";
|
||||
chunkName = "textfile.txt.csv.rdb";
|
||||
dbDir = "/Users/anilkoyuncu/bugStudy/dataset/redis";
|
||||
numOfWorkers = "1";
|
||||
jobType = "LEVEL1DB";
|
||||
jobType = "L3PAIRDB";
|
||||
port = "6399";
|
||||
outputPath = "/Users/anilkoyuncu/bugStudy/dataset/pairsImport";
|
||||
pairsPath = "/Users/anilkoyuncu/bugStudy/dataset/pairsImportDefects4J";
|
||||
gumOutput = "/Users/anilkoyuncu/bugStudy/dataset/GumTreeOutputDefects4J";
|
||||
csvInputPath = "/Users/anilkoyuncu/bugStudy/dataset/pairsImportDefects4J-CSV";
|
||||
dumpsName = "dumpsDefect4J.rdb";
|
||||
}
|
||||
String parameters = String.format("\nJob %s \nInput path %s \nportInner %s \nserverWait %s \nchunkName %s \nnumOfWorks %s \ndbDir %s", jobType, inputPath, portInner, serverWait, chunkName, numOfWorkers, dbDir);
|
||||
// String parameters = String.format("\nJob %s \nInput path %s \nportInner %s \nserverWait %s \nchunkName %s \nnumOfWorks %s \ndbDir %s", jobType, inputPath, portInner, serverWait, chunkName, numOfWorkers, dbDir);
|
||||
|
||||
|
||||
switch (jobType){
|
||||
case "DUMPTREE":
|
||||
TestHunkParser.main(gumInput,gumOutput,numOfWorkers);
|
||||
break;
|
||||
case "STORE":
|
||||
StoreFile.main(inputPath,portInner,serverWait,dbDir,chunkName,numOfWorkers);
|
||||
StoreFile.main(gumOutput,portInner,serverWait,dbDir,dumpsName);
|
||||
break;
|
||||
case "CALCPAIRS":
|
||||
CalculatePairs.main(inputPath,portInner,serverWait,dbDir,chunkName,numOfWorkers,port,outputPath);
|
||||
CalculatePairs.main(serverWait,dbDir,dumpsName,port,pairsPath,"DEFECT4J");
|
||||
break;
|
||||
case "IMPORTPAIRS":
|
||||
ImportPairs2DB.main(inputPath,portInner,serverWait,dbDir,chunkName,numOfWorkers);
|
||||
ImportPairs2DB.main(csvInputPath,portInner,serverWait,dbDir,numOfWorkers);
|
||||
break;
|
||||
case "AKKA":
|
||||
AkkaTreeLoader.main(portInner,serverWait,dbDir,chunkName,port);
|
||||
AkkaTreeLoader.main(portInner,serverWait,dbDir,chunkName,port,dumpsName);
|
||||
break;
|
||||
case "LEVEL1DB":
|
||||
TreeLoaderClusterL1.main(portInner,serverWait,port,inputPath);
|
||||
TreeLoaderClusterL1.main(portInner,serverWait,port,dbDir,"level1-defect4j.rdb",dbDir+"/level1-defect4j/");
|
||||
break;
|
||||
//CALC python abstractPatch.py to from cluster folder
|
||||
case "L2CALCPAIRS":
|
||||
MultiThreadTreeLoaderCluster.calculatePairsOfClusters("/Users/anilkoyuncu/bugStudy/code/python/clusterDefect4J","/Users/anilkoyuncu/bugStudy/dataset/");
|
||||
break;
|
||||
case "L2PAIRDB":
|
||||
MultiThreadTreeLoaderCluster.mainCompare("6300","/Users/anilkoyuncu/bugStudy/dataset/pairs-csv","/Users/anilkoyuncu/bugStudy/dataset/redisSingleImport.sh",dbDir,"clusterl1-d4j.rdb",dumpsName,"6301");
|
||||
break;
|
||||
case "L3CALCPAIRS":
|
||||
MultiThreadTreeLoaderCluster3.calculatePairsOfClusters("/Users/anilkoyuncu/bugStudy/code/python/clusterDefect4J-2l","/Users/anilkoyuncu/bugStudy/dataset/");
|
||||
break;
|
||||
case "L3PAIRDB":
|
||||
MultiThreadTreeLoaderCluster3.mainCompare("6300","/Users/anilkoyuncu/bugStudy/dataset/pairs-2l-csv","/Users/anilkoyuncu/bugStudy/dataset/redisSingleImport.sh",dbDir,"clusterl2-d4j.rdb",dumpsName,"6301");
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -85,6 +85,8 @@ public class ParseFixPatternWorker extends UntypedActor {
|
||||
File revFile = msgFile.getRevFile();
|
||||
File prevFile = msgFile.getPrevFile();
|
||||
File diffentryFile = msgFile.getDiffEntryFile();
|
||||
|
||||
|
||||
// File positionFile = msgFile.getPositionFile();
|
||||
/*if (revFile.getName().toLowerCase().contains("test")) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user