aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/index/MeasurePersisterTest.java3
-rw-r--r--sonar-core/src/main/java/org/sonar/core/permission/PermissionFacade.java2
-rw-r--r--sonar-core/src/main/java/org/sonar/core/resource/DefaultResourcePermissions.java2
-rw-r--r--sonar-core/src/test/java/org/sonar/core/permission/PermissionFacadeTest.java2
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureTest.java12
5 files changed, 12 insertions, 9 deletions
diff --git a/sonar-batch/src/test/java/org/sonar/batch/index/MeasurePersisterTest.java b/sonar-batch/src/test/java/org/sonar/batch/index/MeasurePersisterTest.java
index e3e5407f0c5..82b7abe50c3 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/index/MeasurePersisterTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/index/MeasurePersisterTest.java
@@ -261,6 +261,9 @@ public class MeasurePersisterTest extends AbstractDaoTestCase {
@Test
public void should_not_save_measures_without_data() {
assertThat(MeasurePersister.shouldPersistMeasure(aFile, new Measure(CoreMetrics.LINES))).isFalse();
+
+ Measure duplicatedLines = new Measure(CoreMetrics.DUPLICATED_LINES_DENSITY);
+ assertThat(MeasurePersister.shouldPersistMeasure(aFile, duplicatedLines)).isFalse();
}
private static Snapshot snapshot(int id) {
diff --git a/sonar-core/src/main/java/org/sonar/core/permission/PermissionFacade.java b/sonar-core/src/main/java/org/sonar/core/permission/PermissionFacade.java
index 21d4d93c1fd..dff20b42263 100644
--- a/sonar-core/src/main/java/org/sonar/core/permission/PermissionFacade.java
+++ b/sonar-core/src/main/java/org/sonar/core/permission/PermissionFacade.java
@@ -174,7 +174,7 @@ public class PermissionFacade implements TaskComponent, ServerComponent {
}
}
- public int countComponentsPermissions(Long resourceId) {
+ public int countComponentPermissions(Long resourceId) {
return roleDao.countResourceGroupRoles(resourceId) + roleDao.countResourceUserRoles(resourceId);
}
diff --git a/sonar-core/src/main/java/org/sonar/core/resource/DefaultResourcePermissions.java b/sonar-core/src/main/java/org/sonar/core/resource/DefaultResourcePermissions.java
index 67624c41e6d..ffe91a333d4 100644
--- a/sonar-core/src/main/java/org/sonar/core/resource/DefaultResourcePermissions.java
+++ b/sonar-core/src/main/java/org/sonar/core/resource/DefaultResourcePermissions.java
@@ -55,7 +55,7 @@ public class DefaultResourcePermissions implements ResourcePermissions {
public boolean hasRoles(Resource resource) {
if (resource.getId() != null) {
Long resourceId = Long.valueOf(resource.getId());
- return permissionFacade.countComponentsPermissions(resourceId) > 0;
+ return permissionFacade.countComponentPermissions(resourceId) > 0;
}
return false;
}
diff --git a/sonar-core/src/test/java/org/sonar/core/permission/PermissionFacadeTest.java b/sonar-core/src/test/java/org/sonar/core/permission/PermissionFacadeTest.java
index 4fbdc3b435a..6f342949151 100644
--- a/sonar-core/src/test/java/org/sonar/core/permission/PermissionFacadeTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/permission/PermissionFacadeTest.java
@@ -65,7 +65,7 @@ public class PermissionFacadeTest extends AbstractDaoTestCase {
public void should_count_component_permissions() throws Exception {
setupData("should_count_component_permissions");
- assertThat(permissionFacade.countComponentsPermissions(123L)).isEqualTo(2);
+ assertThat(permissionFacade.countComponentPermissions(123L)).isEqualTo(2);
}
@Test
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureTest.java
index 3be80238d8e..694519d0db0 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/measures/MeasureTest.java
@@ -197,12 +197,12 @@ public class MeasureTest {
@Test
public void null_value_and_null_variations_should_be_considered_as_best_value() {
- assertThat(new Measure(CoreMetrics.NEW_VIOLATIONS).setVariation1(0.0).isBestValue()).isTrue();
- assertThat(new Measure(CoreMetrics.NEW_VIOLATIONS).setVariation1(1.0).isBestValue()).isFalse();
- assertThat(new Measure(CoreMetrics.NEW_VIOLATIONS).setVariation2(1.0).isBestValue()).isFalse();
- assertThat(new Measure(CoreMetrics.NEW_VIOLATIONS).setVariation3(1.0).isBestValue()).isFalse();
- assertThat(new Measure(CoreMetrics.NEW_VIOLATIONS).setVariation4(1.0).isBestValue()).isFalse();
- assertThat(new Measure(CoreMetrics.NEW_VIOLATIONS).setVariation5(1.0).isBestValue()).isFalse();
+ assertThat(new Measure(CoreMetrics.VIOLATIONS).setVariation1(0.0).isBestValue()).isTrue();
+ assertThat(new Measure(CoreMetrics.VIOLATIONS).setVariation1(1.0).isBestValue()).isFalse();
+ assertThat(new Measure(CoreMetrics.VIOLATIONS).setVariation2(1.0).isBestValue()).isFalse();
+ assertThat(new Measure(CoreMetrics.VIOLATIONS).setVariation3(1.0).isBestValue()).isFalse();
+ assertThat(new Measure(CoreMetrics.VIOLATIONS).setVariation4(1.0).isBestValue()).isFalse();
+ assertThat(new Measure(CoreMetrics.VIOLATIONS).setVariation5(1.0).isBestValue()).isFalse();
}
}