Log Message
A final stable version, 0.8, now.
Modified Paths
- trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/hudson/SerenityPublisher.java
- trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/Accumulator.java
- trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/aggregator/ClassAggregator.java
- trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/aggregator/MethodAggregator.java
- trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/aggregator/PackageAggregator.java
- trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/aggregator/ProjectAggregator.java
- trunk/hudson/plugins/serenity/src/test/java/com/ikokoon/serenity/process/AccumulatorTest.java
Diff
Modified: trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/hudson/SerenityPublisher.java (41009 => 41010)
--- trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/hudson/SerenityPublisher.java 2013-10-24 10:57:20 UTC (rev 41009)
+++ trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/hudson/SerenityPublisher.java 2013-10-24 18:19:16 UTC (rev 41010)
@@ -149,12 +149,17 @@
// Iterate over the database files that were found and merge them to the final database
for (final FilePath serenityOdb : serenityOdbs) {
- File sourceFile = File.createTempFile("serenity", ".odb");
- FilePath sourceFilePath = new FilePath(sourceFile);
- serenityOdb.copyTo(sourceFilePath);
- String sourcePath = sourceFile.getAbsolutePath();
- IDataBase sourceDataBase = IDataBase.DataBaseManager.getDataBase(DataBaseOdb.class, sourcePath, null);
+ if (serenityOdb.isDirectory()) {
+ continue;
+ }
+ String sourcePath = null;
+ IDataBase sourceDataBase = null;
try {
+ File sourceFile = File.createTempFile("serenity", ".odb");
+ FilePath sourceFilePath = new FilePath(sourceFile);
+ serenityOdb.copyTo(sourceFilePath);
+ sourcePath = sourceFile.getAbsolutePath();
+ sourceDataBase = IDataBase.DataBaseManager.getDataBase(DataBaseOdb.class, sourcePath, null);
// Copy the data from the source into the target, then close the source
printStream.println("Copying database from... " + sourcePath + " to... " + targetPath);
DataBaseToolkit.copyDataBase(sourceDataBase, targetDataBase);
@@ -167,7 +172,13 @@
printStream.println("Unable to copy Serenity database file from : " + sourcePath + ", to : " + targetPath);
LOGGER.error(null, e);
} finally {
- sourceDataBase.close();
+ if (sourceDataBase != null) {
+ try {
+ sourceDataBase.close();
+ } catch (Exception e) {
+ printStream.println("Exception closing the source database : " + sourcePath + ", target : " + targetPath);
+ }
+ }
}
}
} catch (Exception e) {
Modified: trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/Accumulator.java (41009 => 41010)
--- trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/Accumulator.java 2013-10-24 10:57:20 UTC (rev 41009)
+++ trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/Accumulator.java 2013-10-24 18:19:16 UTC (rev 41010)
@@ -53,11 +53,11 @@
// Look for all jars below this directory to find some source
File dotDirectory = new File(".");
walkFileSystem(dotDirectory, files);
- // logger.error("Files : " + files);
+ logger.debug("Files : " + files);
// Walk the class path looking for files that are included
String classpath = Configuration.getConfiguration().getClassPath();
- // logger.error("Class path : " + File.pathSeparator + ", " + classpath);
+ logger.debug("Class path : " + File.pathSeparator + ", " + classpath);
StringTokenizer stringTokenizer = new StringTokenizer(classpath, ";:", false);
while (stringTokenizer.hasMoreTokens()) {
String token = stringTokenizer.nextToken();
@@ -69,7 +69,7 @@
private void walkFileSystem(final File file, final Set<File> files) {
try {
- // logger.error("Walking file : " + file);
+ logger.debug("Walking file : " + file);
if (file.isDirectory()) {
File[] childFiles = file.listFiles();
if (childFiles != null && childFiles.length > 0) {
@@ -159,7 +159,7 @@
}
String sourceFilePath = Toolkit.slashToDot(Toolkit.cleanFilePath(file.getAbsolutePath()));
if (sourceFilePath.contains(className)) {
- // logger.error("Got source file : " + sourceFilePath);
+ logger.debug("Got source file : " + sourceFilePath);
return file;
}
}
@@ -177,7 +177,7 @@
try {
jarFile = new JarFile(file);
} catch (Exception e) {
- // logger.error("Exeption accessing the jar : " + file, e);
+ logger.error("Exeption accessing the jar : " + file, e);
return;
}
Enumeration<JarEntry> jarEntries = jarFile.entries();
@@ -189,7 +189,7 @@
continue;
}
try {
- // logger.error("Processsing entry : " + className);
+ logger.debug("Processsing entry : " + className);
InputStream inputStream = jarFile.getInputStream(jarEntry);
byte[] classFileBytes = Toolkit.getContents(inputStream).toByteArray();
ByteArrayOutputStream source = null;
@@ -208,10 +208,10 @@
protected ByteArrayOutputStream getSource(final JarFile jarFile, final String entryName) throws IOException {
// Look for the source
final String javaEntryName = entryName.substring(0, entryName.lastIndexOf('.')) + ".java";
- // logger.error("Looking for source : " + javaEntryName + ", " + entryName + ", " + jarFile.getName());
+ logger.debug("Looking for source : " + javaEntryName + ", " + entryName + ", " + jarFile.getName());
ZipEntry javaEntry = jarFile.getEntry(javaEntryName);
if (javaEntry != null) {
- // logger.error("Got source : " + javaEntry);
+ logger.debug("Got source : " + javaEntry);
InputStream inputStream = jarFile.getInputStream(javaEntry);
return Toolkit.getContents(inputStream);
}
@@ -223,7 +223,7 @@
if (strippedName != null && strippedName.endsWith("class")) {
strippedName = strippedName.substring(0, strippedName.lastIndexOf('.'));
}
- // logger.error("Adding class : " + strippedName);
+ logger.debug("Adding class : " + strippedName);
VisitorFactory.getClassVisitor(CLASS_ADAPTER_CLASSES, strippedName, classBytes, source);
}
@@ -233,17 +233,17 @@
return true;
}
if (!name.endsWith("class") && !name.endsWith("java") && !name.endsWith("jar") && !name.endsWith("zip")) {
- // logger.error("Not processing file : " + name);
+ logger.debug("Not processing file : " + name);
return true;
}
// Check that the class is included in the included packages
if (!Configuration.getConfiguration().included(name)) {
- // logger.error("File not included : " + name);
+ logger.debug("File not included : " + name);
return true;
} else {
// Check that the class is not excluded in the excluded packages
if (Configuration.getConfiguration().excluded(name)) {
- // logger.error("Excluded file : " + name);
+ logger.debug("Excluded file : " + name);
return true;
}
}
Modified: trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/aggregator/ClassAggregator.java (41009 => 41010)
--- trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/aggregator/ClassAggregator.java 2013-10-24 10:57:20 UTC (rev 41009)
+++ trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/aggregator/ClassAggregator.java 2013-10-24 18:19:16 UTC (rev 41010)
@@ -35,8 +35,6 @@
}
protected void aggregate(final Class<?, ?> klass) {
- logger.debug("Processing class : " + klass);
-
List<Line<?, ?>> lines = getLines(klass, new ArrayList<Line<?, ?>>());
List<Method<?, ?>> methods = getMethods(klass, new ArrayList<Method<?, ?>>());
Modified: trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/aggregator/MethodAggregator.java (41009 => 41010)
--- trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/aggregator/MethodAggregator.java 2013-10-24 10:57:20 UTC (rev 41009)
+++ trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/aggregator/MethodAggregator.java 2013-10-24 18:19:16 UTC (rev 41010)
@@ -25,14 +25,10 @@
}
protected void aggregate(Method<?, ?> method) {
- logger.debug("Processing method : " + method);
try {
double executed = 0d;
// Collect all the lines that were executed
for (Line<?, ?> line : method.getChildren()) {
- if (logger.isDebugEnabled()) {
- logger.debug("Line covered : " + line + ", " + line.getCounter());
- }
if (line.getCounter() > 0) {
executed++;
}
Modified: trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/aggregator/PackageAggregator.java (41009 => 41010)
--- trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/aggregator/PackageAggregator.java 2013-10-24 10:57:20 UTC (rev 41009)
+++ trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/aggregator/PackageAggregator.java 2013-10-24 18:19:16 UTC (rev 41010)
@@ -40,8 +40,6 @@
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void aggregate(Package pakkage) {
- logger.debug("Processing package : " + pakkage);
-
List<Line<?, ?>> lines = getLines(pakkage);
List<Method<?, ?>> methods = getMethods(pakkage);
@@ -82,11 +80,8 @@
for (Afferent afferent : afferents) {
afference.add(afferent);
}
- logger.info("Class : " + klass.getName());
}
- logger.info("Package : " + pakkage.getName() + ", interfaces : " + interfaces + ", implementations : " + implementations);
-
pakkage.setEfferent(efference);
pakkage.setAfferent(afference);
Modified: trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/aggregator/ProjectAggregator.java (41009 => 41010)
--- trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/aggregator/ProjectAggregator.java 2013-10-24 10:57:20 UTC (rev 41009)
+++ trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/aggregator/ProjectAggregator.java 2013-10-24 18:19:16 UTC (rev 41010)
@@ -44,10 +44,7 @@
@SuppressWarnings("rawtypes")
protected void aggregate(Project<?, ?> project) {
- logger.debug("Processing project : " + project);
-
List<Package> packages = dataBase.find(Package.class);
- logger.debug("Packages : " + packages);
project.setTimestamp(new Date());
@@ -73,10 +70,6 @@
}
}
- if (logger.isDebugEnabled()) {
- logger.debug("Lines : " + lines.size() + ", executed : " + executed);
- }
-
if (lines.size() > 0) {
for (Package<?, ?> pakkage : packages) {
interfaces += pakkage.getInterfaces();
Modified: trunk/hudson/plugins/serenity/src/test/java/com/ikokoon/serenity/process/AccumulatorTest.java (41009 => 41010)
--- trunk/hudson/plugins/serenity/src/test/java/com/ikokoon/serenity/process/AccumulatorTest.java 2013-10-24 10:57:20 UTC (rev 41009)
+++ trunk/hudson/plugins/serenity/src/test/java/com/ikokoon/serenity/process/AccumulatorTest.java 2013-10-24 18:19:16 UTC (rev 41010)
@@ -42,13 +42,13 @@
classPath = Toolkit.replaceAll(classPath, "\\.\\", "\\");
classPath = Toolkit.replaceAll(classPath, "/./", "/");
System.setProperty("java.class.path", classPath);
-
+
accumulator = new Accumulator(null);
}
-
+
@After
public void after() {
- Toolkit.deleteFile(new File("./serenity"), 3);
+ // Toolkit.deleteFile(new File("./serenity"), 3);
}
@Test
@@ -77,32 +77,33 @@
String source = accumulator.getSource(jarFile, Toolkit.dotToSlash(Accumulator.class.getName()) + ".java").toString();
assertNotNull(source);
}
-
+
@Test
public void excluded() {
Configuration.getConfiguration().excludedPackages.clear();
Configuration.getConfiguration().includedPackages.clear();
-
+
Configuration.getConfiguration().excludedPackages.add("model");
Configuration.getConfiguration().excludedPackages.add("Mock");
Configuration.getConfiguration().excludedPackages.add("Test");
Configuration.getConfiguration().excludedPackages.add("Integration");
-
+
Configuration.getConfiguration().includedPackages.add("ikube");
-
+
boolean excluded = accumulator.isExcluded(".root..jenkins.jobs.ikube.workspace.code.com.src.main.java.ikube.toolkit.ObjectToolkit.java");
assertFalse(excluded);
- excluded = accumulator.isExcluded(".usr.share.eclipse.workspace.serenity.work.workspace.ikube.code.core.serenity.ikube.action.index.handler.IIndexableHandler.class");
+ excluded = accumulator
+ .isExcluded(".usr.share.eclipse.workspace.serenity.work.workspace.ikube.code.core.serenity.ikube.action.index.handler.IIndexableHandler.class");
assertFalse(excluded);
}
@Test
@Ignore
public void getIkubeSource() {
- System.setProperty("java.class.path", "/usr/share/eclipse/workspace/serenity/work/workspace/ikube");
+ System.setProperty("java.class.path", "/usr/share/eclipse/workspace/ikube");
Configuration.getConfiguration().includedPackages.add("ikube");
accumulator.execute();
-
+
Class<?, ?> javaClass = dataBase.find(Class.class, Toolkit.hash("ikube.action.Action"));
assertNotNull(javaClass);
}
You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.