aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2014-01-16 16:20:45 +0100
committerJulien HENRY <julien.henry@sonarsource.com>2014-01-16 16:21:13 +0100
commit8e03f8be326f8074f49c8c74bd58347740eafb73 (patch)
tree68cdf8b3e92110dabb4070742b1273257c437312 /plugins
parent49321e0d2b04a32359c14efb052f2f1aa51abc95 (diff)
downloadsonarqube-8e03f8be326f8074f49c8c74bd58347740eafb73.tar.gz
sonarqube-8e03f8be326f8074f49c8c74bd58347740eafb73.zip
SONAR-926 Merge Java package and directory concepts. Display full path of resources as name.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/DirectoriesDecoratorTest.java6
-rw-r--r--plugins/sonar-design-plugin/src/test/java/org/sonar/plugins/design/batch/DsmSerializerTest.java8
-rw-r--r--plugins/sonar-design-plugin/src/test/resources/org/sonar/plugins/design/batch/DsmSerializerTest/dsm.json2
3 files changed, 8 insertions, 8 deletions
diff --git a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/DirectoriesDecoratorTest.java b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/DirectoriesDecoratorTest.java
index a365e3d7d87..e2128dde7ea 100644
--- a/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/DirectoriesDecoratorTest.java
+++ b/plugins/sonar-core-plugin/src/test/java/org/sonar/plugins/core/sensors/DirectoriesDecoratorTest.java
@@ -70,12 +70,12 @@ public class DirectoriesDecoratorTest {
}
@Test
- public void packagesAreIgnored() {
+ public void packagesAreConsideredAsDirectories() {
DirectoriesDecorator decorator = new DirectoriesDecorator();
- Resource pac = new JavaPackage("org.foo");
+ Resource pac = new JavaPackage("org/foo");
DecoratorContext context = mock(DecoratorContext.class);
decorator.decorate(pac, context);
- verify(context, never()).saveMeasure(eq(CoreMetrics.DIRECTORIES), anyDouble());
+ verify(context).saveMeasure(eq(CoreMetrics.DIRECTORIES), eq(1.0));
}
@Test
diff --git a/plugins/sonar-design-plugin/src/test/java/org/sonar/plugins/design/batch/DsmSerializerTest.java b/plugins/sonar-design-plugin/src/test/java/org/sonar/plugins/design/batch/DsmSerializerTest.java
index bb5dc533e06..2518f12526b 100644
--- a/plugins/sonar-design-plugin/src/test/java/org/sonar/plugins/design/batch/DsmSerializerTest.java
+++ b/plugins/sonar-design-plugin/src/test/java/org/sonar/plugins/design/batch/DsmSerializerTest.java
@@ -22,7 +22,7 @@ package org.sonar.plugins.design.batch;
import org.apache.commons.io.IOUtils;
import org.junit.Test;
import org.sonar.api.design.Dependency;
-import org.sonar.api.resources.JavaPackage;
+import org.sonar.api.resources.Directory;
import org.sonar.api.resources.Resource;
import org.sonar.graph.DirectedGraph;
import org.sonar.graph.Dsm;
@@ -43,8 +43,8 @@ public class DsmSerializerTest {
@Test
public void serialize() throws IOException {
- Resource foo = new JavaPackage("org.foo").setId(7);
- Resource bar = new JavaPackage("org.bar").setId(8);
+ Resource foo = Directory.create("src/org/foo", "org/foo").setId(7);
+ Resource bar = Directory.create("src/org/bar", "org/bar").setId(8);
Dependency dep = new Dependency(foo, bar).setId(30l).setWeight(1);
DirectedGraph<Resource, Dependency> graph = new DirectedGraph<Resource, Dependency>();
@@ -54,7 +54,7 @@ public class DsmSerializerTest {
Dsm<Resource> dsm = new Dsm<Resource>(graph);
DsmManualSorter.sort(dsm, bar, foo); // for test reproductibility
- String json = IOUtils.toString(getClass().getResourceAsStream("/org/sonar/plugins/design/batch/DsmSerializerTest/dsm.json"));
+ String json = IOUtils.toString(getClass().getResourceAsStream("/org/sonar/plugins/design/batch/DsmSerializerTest/dsm.json")).trim();
assertThat(DsmSerializer.serialize(dsm), is(json));
}
}
diff --git a/plugins/sonar-design-plugin/src/test/resources/org/sonar/plugins/design/batch/DsmSerializerTest/dsm.json b/plugins/sonar-design-plugin/src/test/resources/org/sonar/plugins/design/batch/DsmSerializerTest/dsm.json
index d0b8861b439..76b06c0f37d 100644
--- a/plugins/sonar-design-plugin/src/test/resources/org/sonar/plugins/design/batch/DsmSerializerTest/dsm.json
+++ b/plugins/sonar-design-plugin/src/test/resources/org/sonar/plugins/design/batch/DsmSerializerTest/dsm.json
@@ -1 +1 @@
-[{"i":8,"n":"org.bar","q":"PAC","v":[{},{"i":30,"w":1}]},{"i":7,"n":"org.foo","q":"PAC","v":[{},{}]}] \ No newline at end of file
+[{"i":8,"n":"/src/org/bar","q":"DIR","v":[{},{"i":30,"w":1}]},{"i":7,"n":"/src/org/foo","q":"DIR","v":[{},{}]}]