Title: [40985] trunk/hudson/plugins/serenity/src: Updated the accumulator to take into account directories again for the source.

Diff

Modified: trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/Collector.java (40984 => 40985)


--- trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/Collector.java	2013-09-01 13:55:37 UTC (rev 40984)
+++ trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/Collector.java	2013-09-01 20:09:10 UTC (rev 40985)
@@ -189,7 +189,7 @@
 		// We try to delete the old file first
 		boolean deleted = file.delete();
 		if (!deleted) {
-			LOGGER.warn("Didn't delete source coverage file : " + file);
+			LOGGER.debug("Didn't delete source coverage file : " + file);
 		}
 		if (!file.exists()) {
 			if (!Toolkit.createFile(file)) {

Modified: trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/instrumentation/VisitorFactory.java (40984 => 40985)


--- trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/instrumentation/VisitorFactory.java	2013-09-01 13:55:37 UTC (rev 40984)
+++ trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/instrumentation/VisitorFactory.java	2013-09-01 20:09:10 UTC (rev 40985)
@@ -54,7 +54,7 @@
 			LOGGER.debug("Adding class visitor : " + visitor);
 		}
 		// 'false' for ASM 2.2, '0' for ASM 3++
-		reader.accept(visitor, 0);
+		reader.accept(visitor, ClassReader.SKIP_FRAMES);
 		return writer;
 	}
 

Modified: trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/Accumulator.java (40984 => 40985)


--- trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/Accumulator.java	2013-09-01 13:55:37 UTC (rev 40984)
+++ trunk/hudson/plugins/serenity/src/main/java/com/ikokoon/serenity/process/Accumulator.java	2013-09-01 20:09:10 UTC (rev 40985)
@@ -53,8 +53,8 @@
 	public void execute() {
 		super.execute();
 		String classpath = Configuration.getConfiguration().getClassPath();
-		logger.debug("Class path : " + File.pathSeparator + ", " + classpath);
-		StringTokenizer stringTokenizer = new StringTokenizer(classpath, File.pathSeparator, false);
+		// logger.error("Class path : " + File.pathSeparator + ", " + classpath);
+		StringTokenizer stringTokenizer = new StringTokenizer(classpath, ";:", false);
 		while (stringTokenizer.hasMoreTokens()) {
 			String token = stringTokenizer.nextToken();
 			File file = new File(token);
@@ -64,7 +64,6 @@
 			}
 			if (file.isFile()) {
 				if (token.endsWith(".jar") || token.endsWith(".zip") || token.endsWith(".war") || token.endsWith(".ear")) {
-					logger.debug("Processing jar : " + file.getAbsolutePath());
 					processJar(file);
 				}
 			} else if (file.isDirectory()) {
@@ -83,7 +82,6 @@
 			}
 		}, list);
 		for (final File file : list) {
-			logger.debug("Processing jar : " + file.getAbsolutePath());
 			processJar(file);
 		}
 	}
@@ -95,7 +93,7 @@
 	 */
 	void processDir(final File file) {
 		// Iteratively go through the directories
-		if (file == null || !file.exists() || !file.canWrite()) {
+		if (file == null) {
 			return;
 		}
 		if (file.isDirectory()) {
@@ -164,7 +162,7 @@
 			if (excluded(className)) {
 				continue;
 			}
-			logger.debug("Processsing entry : " + className);
+			// logger.error("Processsing entry : " + className);
 			try {
 				InputStream inputStream = jarFile.getInputStream(jarEntry);
 				byte[] classFileBytes = Toolkit.getContents(inputStream).toByteArray();
@@ -184,10 +182,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.debug("Looking for source : " + javaEntryName + ", " + entryName + ", " + jarFile.getName());
+		// logger.error("Looking for source : " + javaEntryName + ", " + entryName + ", " + jarFile.getName());
 		ZipEntry javaEntry = jarFile.getEntry(javaEntryName);
 		if (javaEntry != null) {
-			logger.debug("Got source : " + javaEntry);
+			// logger.error("Got source : " + javaEntry);
 			InputStream inputStream = jarFile.getInputStream(javaEntry);
 			return Toolkit.getContents(inputStream);
 		} else {
@@ -200,7 +198,7 @@
 					filePath = Toolkit.replaceAll(filePath, "\\", "/");
 					boolean isSourceFile = filePath.contains(javaEntryName);
 					if (isSourceFile) {
-						logger.debug("Is source file : " + isSourceFile + ", " + filePath);
+						// logger.error("Is source file : " + isSourceFile + ", " + filePath);
 					}
 					return isSourceFile;
 				}
@@ -218,7 +216,7 @@
 			strippedName = strippedName.substring(0, strippedName.lastIndexOf('.'));
 		}
 		try {
-			logger.debug("Adding class : " + strippedName);
+			// logger.error("Adding class : " + strippedName);
 			VisitorFactory.getClassVisitor(CLASS_ADAPTER_CLASSES, strippedName, classBytes, source);
 		} catch (Exception e) {
 			int sourceLength = source != null ? source.size() : 0;

Modified: trunk/hudson/plugins/serenity/src/test/java/com/ikokoon/serenity/process/AccumulatorTest.java (40984 => 40985)


--- trunk/hudson/plugins/serenity/src/test/java/com/ikokoon/serenity/process/AccumulatorTest.java	2013-09-01 13:55:37 UTC (rev 40984)
+++ trunk/hudson/plugins/serenity/src/test/java/com/ikokoon/serenity/process/AccumulatorTest.java	2013-09-01 20:09:10 UTC (rev 40985)
@@ -30,6 +30,8 @@
 	public void before() {
 		String classPath = System.getProperty("java.class.path");
 		classPath += ";" + new File(".", "/target/serenity.jar").getAbsolutePath() + ";";
+		// classPath += "/usr/share/eclipse/workspace/ikube;";
+
 		classPath = Toolkit.replaceAll(classPath, "\\.\\", "\\");
 		classPath = Toolkit.replaceAll(classPath, "/./", "/");
 		System.setProperty("java.class.path", classPath);
@@ -37,6 +39,7 @@
 
 	@Test
 	public void accumulate() {
+		// Configuration.getConfiguration().includedPackages.add("ikube");
 		LOGGER.warn("Included : " + Configuration.getConfiguration().includedPackages);
 		LOGGER.warn("Excluded : " + Configuration.getConfiguration().excludedPackages);
 		Accumulator accumulator = new Accumulator(null);
@@ -45,9 +48,14 @@
 		assertNotNull(targetClass);
 		Class<?, ?> targetConsumerClass = (Class<?, ?>) dataBase.find(Class.class, Toolkit.hash(Class.class.getName()));
 		assertNull(targetConsumerClass);
+
+		// Class<?, ?> targetIkubeClass = (Class<?, ?>) dataBase.find(Class.class, Toolkit.hash("ikube.model.Indexable"));
+		// LOGGER.error("Ikube class : " + targetIkubeClass);
+		// assertNotNull(targetIkubeClass);
 	}
 
 	@Test
+	// @Ignore
 	public void getSource() throws Exception {
 		Accumulator accumulator = new Accumulator(null);
 		JarFile jarFile = new JarFile(new File("src/test/resources/serenity.jar"));

--
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to