fixed bug with computing MD5 hash and multithreading

This commit is contained in:
2015-04-25 17:50:26 +02:00
parent db786b73c9
commit ee86dfe895
8 changed files with 172 additions and 36 deletions

View File

@@ -1,23 +1,26 @@
import org.jpacrepo.model.PkgData;
import com.thoughtworks.xstream.XStream;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.DirectoryFileFilter;
import org.apache.commons.io.filefilter.RegexFileFilter;
import org.junit.Test;
import org.jpacrepo.model.PkgData;
import org.jpacrepo.pacbase.Parser;
import org.jpacrepo.service.PacmanService;
import org.junit.Test;
import javax.naming.*;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Properties;
/**
* Created by walter on 22/03/15.
*/
public class ParseTest
{
// @Test
// @Test
public void test() throws Exception
{
@@ -26,7 +29,7 @@ public class ParseTest
List<PkgData> lista = new ArrayList<>();
for (File file : ls)
{
PkgData data = Parser.parseFile(file);
PkgData data = new Parser().parseFile(file);
lista.add(data);
//System.out.println(new XStream().toXML(data));
// if(i++>10) break;
@@ -59,16 +62,32 @@ public class ParseTest
stateService.deletePackage("linux-3.19.3-3-x86_64.pkg.tar.xz");
}
private static void traverseJndiNode(String nodeName, Context context) {
try {
private static void traverseJndiNode(String nodeName, Context context)
{
try
{
NamingEnumeration<NameClassPair> list = context.list(nodeName);
while (list.hasMore()){
while (list.hasMore())
{
String childName = nodeName + "" + list.next().getName();
System.out.println(childName);
traverseJndiNode(childName, context);
}
} catch (NamingException ex) {
} catch (NamingException ex)
{
// We reached a leaf
}
}
@Test
public void parseTest() throws Exception
{
String[] files = new String[]{"/var/cache/pacman/pkg/mesa-10.4.5-1-x86_64.pkg.tar.xz", "/var/cache/pacman/pkg/mesa-10.5.3-1-x86_64.pkg.tar.xz"};
for (String file : files)
{
PkgData data = new Parser().parseFile(new File(file));
System.out.println(new XStream().toXML(data));
}
}
}