diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-06-10 16:46:49 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2015-06-10 16:46:49 +0200 |
commit | 897e399f0086d9b6133dcabd6337b7e15421c7f9 (patch) | |
tree | 45308334cb421393c902c77fe9a085a4f0e972c7 | |
parent | 169d0f087b1d551567e2a0211749ada67b15a319 (diff) | |
download | sonarqube-897e399f0086d9b6133dcabd6337b7e15421c7f9.tar.gz sonarqube-897e399f0086d9b6133dcabd6337b7e15421c7f9.zip |
SONAR-6260 Fix test on Oracle because snapshots.path is not empty but null
16 files changed, 79 insertions, 64 deletions
diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/db/SnapshotDao.java b/server/sonar-server/src/main/java/org/sonar/server/component/db/SnapshotDao.java index e5268ddebb3..bba664b5c7c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/db/SnapshotDao.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/db/SnapshotDao.java @@ -20,6 +20,7 @@ package org.sonar.server.component.db; +import com.google.common.base.Strings; import java.util.List; import javax.annotation.CheckForNull; import javax.annotation.Nullable; @@ -69,7 +70,7 @@ public class SnapshotDao implements DaoComponent { public int updateSnapshotAndChildrenLastFlagAndStatus(DbSession session, SnapshotDto snapshot, boolean isLast, String status) { Long rootId = snapshot.getId(); - String path = snapshot.getPath() + snapshot.getId() + ".%"; + String path = Strings.nullToEmpty(snapshot.getPath()) + snapshot.getId() + ".%"; Long pathRootId = snapshot.getRootIdOrSelf(); return mapper(session).updateSnapshotAndChildrenLastFlagAndStatus(rootId, pathRootId, path, isLast, status); @@ -77,7 +78,7 @@ public class SnapshotDao implements DaoComponent { public int updateSnapshotAndChildrenLastFlag(DbSession session, SnapshotDto snapshot, boolean isLast) { Long rootId = snapshot.getId(); - String path = snapshot.getPath() + snapshot.getId() + ".%"; + String path = Strings.nullToEmpty(snapshot.getPath()) + snapshot.getId() + ".%"; Long pathRootId = snapshot.getRootIdOrSelf(); return mapper(session).updateSnapshotAndChildrenLastFlag(rootId, pathRootId, path, isLast); diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistSnapshotsStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistSnapshotsStep.java index 1bfa492e38a..b2c46bb56b9 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistSnapshotsStep.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistSnapshotsStep.java @@ -142,6 +142,7 @@ public class PersistSnapshotsStep implements ComputationStep { .setPath(parentSnapshot.getPath() + parentSnapshot.getId() + "."); } else { snapshotDto + // On Oracle, the path will be null .setPath("") .setDepth(0); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/SnapshotTesting.java b/server/sonar-server/src/test/java/org/sonar/server/component/SnapshotTesting.java index 430b405d842..0f0d6cf3ccb 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/SnapshotTesting.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/SnapshotTesting.java @@ -21,6 +21,7 @@ package org.sonar.server.component; import com.google.common.base.Preconditions; +import org.assertj.core.util.Strings; import org.sonar.core.component.ComponentDto; import org.sonar.core.component.SnapshotDto; @@ -35,7 +36,7 @@ public class SnapshotTesting { return createBasicSnapshot(component, parentSnapshot.getRootProjectId()) .setRootId(parentRootId != null ? parentRootId : parentSnapshot.getId()) .setParentId(parentSnapshot.getId()) - .setPath(parentSnapshot.getPath() == null ? Long.toString(parentSnapshot.getId()) + "." : parentSnapshot.getPath() + Long.toString(parentSnapshot.getId()) + "."); + .setPath(Strings.isNullOrEmpty(parentSnapshot.getPath()) ? Long.toString(parentSnapshot.getId()) + "." : parentSnapshot.getPath() + Long.toString(parentSnapshot.getId()) + "."); } public static SnapshotDto createForProject(ComponentDto project) { diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistSnapshotsStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistSnapshotsStepTest.java index 9c6832c9702..38b42ef5820 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistSnapshotsStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistSnapshotsStepTest.java @@ -147,7 +147,7 @@ public class PersistSnapshotsStepTest extends BaseStepTest { assertThat(projectSnapshot.getRootId()).isNull(); assertThat(projectSnapshot.getParentId()).isNull(); assertThat(projectSnapshot.getDepth()).isEqualTo(0); - assertThat(projectSnapshot.getPath()).isEqualTo(""); + assertThat(projectSnapshot.getPath()).isNullOrEmpty(); assertThat(projectSnapshot.getQualifier()).isEqualTo("TRK"); assertThat(projectSnapshot.getScope()).isEqualTo("PRJ"); assertThat(projectSnapshot.getVersion()).isEqualTo("1.0"); @@ -267,7 +267,7 @@ public class PersistSnapshotsStepTest extends BaseStepTest { assertThat(projectSnapshot.getRootId()).isNull(); assertThat(projectSnapshot.getParentId()).isNull(); assertThat(projectSnapshot.getDepth()).isEqualTo(0); - assertThat(projectSnapshot.getPath()).isEqualTo(""); + assertThat(projectSnapshot.getPath()).isNullOrEmpty(); SnapshotDto moduleASnapshot = getUnprocessedSnapshot(moduleADto.getId()); assertThat(moduleASnapshot.getRootProjectId()).isEqualTo(projectDto.getId()); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/component/db/SnapshotDaoTest/select_previous_version_snapshots.xml b/server/sonar-server/src/test/resources/org/sonar/server/component/db/SnapshotDaoTest/select_previous_version_snapshots.xml index 83290989826..3f56960cd92 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/component/db/SnapshotDaoTest/select_previous_version_snapshots.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/component/db/SnapshotDaoTest/select_previous_version_snapshots.xml @@ -3,38 +3,46 @@ <projects long_name="[null]" id="1" scope="PRJ" qualifier="TRK" kee="project" name="project" root_id="[null]" uuid="ABCD" description="[null]" - enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> - + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> <!-- version 1.0 --> - <snapshots id="1000" purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" + <snapshots id="1000" purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" + period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" + period5_param="[null]" period5_date="[null]" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1225630680000" build_date="1225630680000" version="1.0" path="" - status="P" islast="false" depth="0" /> + status="P" islast="[false]" depth="0"/> <!-- version 1.1 --> - <snapshots id="1001" purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" + <snapshots id="1001" purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" + period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" + period5_param="[null]" period5_date="[null]" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1225803480000" build_date="1225803480000" version="1.1" path="" - status="P" islast="false" depth="0" /> + status="P" islast="[false]" depth="0"/> <!-- version 1.2-SNAPSHOT --> - <snapshots id="1002" purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" + <snapshots id="1002" purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" + period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" + period5_param="[null]" period5_date="[null]" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1225976280000" build_date="1225976280000" version="1.2-SNAPSHOT" path="" - status="P" islast="false" depth="0" /> + status="P" islast="[false]" depth="0"/> <!-- version 1.2-SNAPSHOT, current analysis --> - <snapshots id="1003" purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" + <snapshots id="1003" purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" + period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" + period5_param="[null]" period5_date="[null]" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1226235480000" build_date="1226235480000" version="1.2-SNAPSHOT" path="" - status="U" islast="true" depth="0" /> + status="U" islast="[true]" depth="0"/> <events id="1" name="1.0" component_uuid="ABCD" snapshot_id="1000" category="Version" event_date="1225630680000" created_at="1225630680000" description="" event_data="[null]"/> <events id="2" name="Foo" component_uuid="ABCD" snapshot_id="1000" category="Other" event_date="1225717080000" created_at="1225717080000" description="" event_data="[null]"/> <events id="3" name="1.1" component_uuid="ABCD" snapshot_id="1001" category="Version" event_date="1225803480000" created_at="1225803480000" description="" event_data="[null]"/> <events id="4" name="Bar" component_uuid="ABCD" snapshot_id="1001" category="Other" event_date="1225889880000" created_at="1225889880000" description="" event_data="[null]"/> <events id="5" name="Uhh" component_uuid="ABCD" snapshot_id="1002" category="Other" event_date="1226062680000" created_at="1226062680000" description="" event_data="[null]"/> - <events id="6" name="1.2-SNAPSHOT" component_uuid="ABCD" snapshot_id="1003" category="Version" event_date="1226235480000" created_at="1226235480000" description="" event_data="[null]"/> + <events id="6" name="1.2-SNAPSHOT" component_uuid="ABCD" snapshot_id="1003" category="Version" event_date="1226235480000" created_at="1226235480000" description="" + event_data="[null]"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/empty.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/empty.xml index 9a36ce9a899..eb5906614d8 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/empty.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/empty.xml @@ -2,6 +2,6 @@ <projects id="1" root_id="[null]" scope="PRJ" qualifier="TRK" kee="PROJECT_KEY" name="project" long_name="[null]" description="[null]" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD." - enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/find_by_date.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/find_by_date.xml index 16c44b7f177..c0948607dce 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/find_by_date.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/find_by_date.xml @@ -3,7 +3,7 @@ <projects long_name="[null]" id="1" scope="PRJ" qualifier="TRK" kee="project" name="project" root_id="[null]" description="[null]" - enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> <!-- 2008-11-01 --> @@ -12,7 +12,7 @@ period5_param="[null]" period5_date="[null]" id="1000" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1225544280000" build_date="1225544280000" version="1.1-SNAPSHOT" path="" - status="P" islast="false" depth="0"/> + status="P" islast="[false]" depth="0"/> <!-- 2008-11-12 --> @@ -21,7 +21,7 @@ period5_param="[null]" period5_date="[null]" id="1003" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1226494680000" build_date="1226494680000" version="1.1-SNAPSHOT" path="" - status="P" islast="true" depth="0"/> + status="P" islast="[true]" depth="0"/> <!-- 2008-11-22 --> @@ -30,7 +30,7 @@ period5_param="[null]" period5_date="[null]" id="1006" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1227358680000" build_date="1227358680000" version="1.1" path="" - status="P" islast="false" depth="0"/> + status="P" islast="[false]" depth="0"/> <!-- 2008-11-25--> @@ -39,6 +39,6 @@ period5_param="[null]" period5_date="[null]" id="1009" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1227617880000" build_date="1227617880000" version="1.1" path="" - status="P" islast="false" depth="0"/> + status="P" islast="[false]" depth="0"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/find_by_days.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/find_by_days.xml index 382c921d3cc..65e29624c1b 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/find_by_days.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/find_by_days.xml @@ -4,19 +4,19 @@ <projects long_name="[null]" id="1" scope="PRJ" qualifier="TRK" kee="project" name="project" root_id="[null]" description="[null]" - enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> <!-- package --> <projects long_name="[null]" id="2" scope="DIR" qualifier="PAC" kee="project:org.foo" name="org.foo" root_id="1" description="[null]" - enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> <!-- file --> <projects long_name="org.foo.Bar" id="3" scope="FIL" qualifier="CLA" kee="project:org.foo.Bar" name="Bar" root_id="[null]" description="[null]" - enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> <!-- first analysis : 2008-11-01--> @@ -24,19 +24,19 @@ period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" id="1000" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1225544280000" build_date="1225544280000" version="[null]" path="" - status="P" islast="false" depth="0"/> + status="P" islast="[false]" depth="0"/> <snapshots purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" id="1001" project_id="2" parent_snapshot_id="1000" root_project_id="1" root_snapshot_id="1000" scope="DIR" qualifier="PAC" created_at="1225544280000" build_date="1225544280000" version="[null]" path="1000." - status="P" islast="false" depth="1"/> + status="P" islast="[false]" depth="1"/> <snapshots purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" id="1002" project_id="3" parent_snapshot_id="1001" root_project_id="1" root_snapshot_id="1000" scope="FIL" qualifier="CLA" created_at="1225544280000" build_date="1225544280000" version="[null]" path="1000.1001." - status="P" islast="false" depth="2"/> + status="P" islast="[false]" depth="2"/> <!-- second unprocessed analysis - to ignore: 2008-11-12 --> @@ -44,19 +44,19 @@ period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" id="1003" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1226494680000" build_date="1226494680000" version="[null]" path="" - status="U" islast="false" depth="0"/> + status="U" islast="[false]" depth="0"/> <snapshots purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" id="1004" project_id="2" parent_snapshot_id="1003" root_project_id="1" root_snapshot_id="1003" scope="DIR" qualifier="PAC" created_at="1226494680000" build_date="1226494680000" version="[null]" path="1003." - status="U" islast="false" depth="1"/> + status="U" islast="[false]" depth="1"/> <snapshots purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" id="1005" project_id="3" parent_snapshot_id="1004" root_project_id="1" root_snapshot_id="1003" scope="FIL" qualifier="CLA" created_at="1226494680000" build_date="1226494680000" version="[null]" path="1003.1004." - status="U" islast="false" depth="2"/> + status="U" islast="[false]" depth="2"/> <!-- second analysis : 2008-11-13--> @@ -64,18 +64,18 @@ period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" id="1006" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1226581080000" build_date="1226581080000" version="[null]" path="" - status="P" islast="true" depth="0"/> + status="P" islast="[true]" depth="0"/> <snapshots purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" id="1007" project_id="2" parent_snapshot_id="1006" root_project_id="1" root_snapshot_id="1006" scope="DIR" qualifier="PAC" created_at="1226581080000" build_date="1226581080000" version="[null]" path="1006." - status="P" islast="true" depth="1"/> + status="P" islast="[true]" depth="1"/> <snapshots purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" id="1008" project_id="3" parent_snapshot_id="1007" root_project_id="1" root_snapshot_id="1006" scope="FIL" qualifier="CLA" created_at="1226581080000" build_date="1226581080000" version="[null]" path="1006.1007." - status="P" islast="true" depth="2"/> + status="P" islast="[true]" depth="2"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/find_by_previous_analysis.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/find_by_previous_analysis.xml index 99c7c8ec7be..4e29d90589a 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/find_by_previous_analysis.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/find_by_previous_analysis.xml @@ -3,14 +3,14 @@ <projects long_name="[null]" id="1" scope="PRJ" qualifier="TRK" kee="project" name="project" root_id="[null]" description="[null]" - enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> <snapshots purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" id="1006" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1227358680000" build_date="1227358680000" version="1.1" path="" - status="P" islast="false" depth="0"/> + status="P" islast="[false]" depth="0"/> <!-- last analysis --> <snapshots purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" @@ -18,6 +18,6 @@ period5_param="[null]" period5_date="[null]" id="1009" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1227617880000" build_date="1227617880000" version="1.1" path="" - status="P" islast="true" depth="0"/> + status="P" islast="[true]" depth="0"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/find_by_previous_version.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/find_by_previous_version.xml index da4c54f7c90..f4687fe8578 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/find_by_previous_version.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/find_by_previous_version.xml @@ -3,7 +3,7 @@ <projects long_name="[null]" id="1" scope="PRJ" qualifier="TRK" kee="project" name="project" root_id="[null]" uuid="ABCD" description="[null]" - enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> <!-- version 1.0 --> <snapshots id="1000" purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" @@ -11,7 +11,7 @@ period5_param="[null]" period5_date="[null]" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1225630680000" build_date="1225630680000" version="1.0" path="" - status="P" islast="false" depth="0"/> + status="P" islast="[false]" depth="0"/> <!-- version 1.1 --> <snapshots id="1001" purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" @@ -19,7 +19,7 @@ period5_param="[null]" period5_date="[null]" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1225803480000" build_date="1225803480000" version="1.1" path="" - status="P" islast="false" depth="0"/> + status="P" islast="[false]" depth="0"/> <!-- version 1.2-SNAPSHOT --> <snapshots id="1002" purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" @@ -27,7 +27,7 @@ period5_param="[null]" period5_date="[null]" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1225976280000" build_date="1225976280000" version="1.2-SNAPSHOT" path="" - status="P" islast="false" depth="0"/> + status="P" islast="[false]" depth="0"/> <events id="1" name="1.0" component_uuid="ABCD" snapshot_id="1000" category="Version" event_date="1225630680000" created_at="1225630680000" description="" event_data="[null]"/> <events id="2" name="Foo" component_uuid="ABCD" snapshot_id="1000" category="Other" event_date="1225717080000" created_at="1225717080000" description="" event_data="[null]"/> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/find_by_version.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/find_by_version.xml index 33e4f78d390..9fe9d4ec6d8 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/find_by_version.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/find_by_version.xml @@ -3,7 +3,7 @@ <projects long_name="[null]" id="1" scope="PRJ" qualifier="TRK" kee="project" name="project" root_id="[null]" description="[null]" - enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> <!-- version 1.1-SNAPSHOT --> @@ -12,7 +12,7 @@ period5_param="[null]" period5_date="[null]" id="1000" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1225544280000" build_date="1225544280000" version="1.1-SNAPSHOT" path="" - status="P" islast="false" depth="0"/> + status="P" islast="[false]" depth="0"/> <!-- version 1.1-SNAPSHOT --> @@ -21,7 +21,7 @@ period5_param="[null]" period5_date="[null]" id="1003" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1225630680000" build_date="1225630680000" version="1.1-SNAPSHOT" path="" - status="P" islast="true" depth="0"/> + status="P" islast="[true]" depth="0"/> <!-- unprocessed version 1.1 (to ignore) --> @@ -30,7 +30,7 @@ period5_param="[null]" period5_date="[null]" id="1006" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1225717080000" build_date="1225717080000" version="1.1" path="" - status="U" islast="false" depth="0"/> + status="U" islast="[false]" depth="0"/> <!-- version 1.1 --> @@ -39,6 +39,6 @@ period5_param="[null]" period5_date="[null]" id="1009" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1225803480000" build_date="1225803480000" version="1.1" path="" - status="P" islast="false" depth="0"/> + status="P" islast="[false]" depth="0"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/no_previous_version.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/no_previous_version.xml index c35918a016e..5a2dd3644be 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/no_previous_version.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/no_previous_version.xml @@ -3,7 +3,7 @@ <projects long_name="[null]" id="1" scope="PRJ" qualifier="TRK" kee="project" name="project" root_id="[null]" uuid="ABCD" description="[null]" - enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> <!-- version 1.0 --> @@ -12,7 +12,7 @@ period5_param="[null]" period5_date="[null]" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1225630680000" build_date="1225630680000" version="1.0" path="" - status="P" islast="false" depth="0"/> + status="P" islast="[false]" depth="0"/> <!-- version 1.1 --> <snapshots id="1001" purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" @@ -20,7 +20,7 @@ period5_param="[null]" period5_date="[null]" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1225803480000" build_date="1225803480000" version="1.1" path="" - status="P" islast="false" depth="0"/> + status="P" islast="[false]" depth="0"/> <!-- version 1.2-SNAPSHOT --> <snapshots id="1002" purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" @@ -28,7 +28,7 @@ period5_param="[null]" period5_date="[null]" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1225976280000" build_date="1225976280000" version="1.2-SNAPSHOT" path="" - status="P" islast="false" depth="0"/> + status="P" islast="[false]" depth="0"/> <!-- version 1.2-SNAPSHOT, current analysis --> <snapshots id="1003" purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" @@ -36,7 +36,7 @@ period5_param="[null]" period5_date="[null]" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1226235480000" build_date="1226235480000" version="1.2-SNAPSHOT" path="" - status="U" islast="true" depth="0"/> + status="U" islast="[true]" depth="0"/> <events id="2" name="Foo" component_uuid="ABCD" snapshot_id="1000" category="Other" event_date="1225717080000" created_at="1225717080000" description="" event_data="[null]"/> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/previous_version_deleted.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/previous_version_deleted.xml index 2c000e2c4a6..7f4d8704af1 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/previous_version_deleted.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/previous_version_deleted.xml @@ -2,7 +2,7 @@ <projects id="1" root_id="[null]" scope="PRJ" qualifier="TRK" kee="PROJECT_KEY" name="project" long_name="[null]" description="[null]" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD." - enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> <!-- 2008-11-11 --> <!-- Version 0.9 --> @@ -11,7 +11,7 @@ period5_param="[null]" period5_date="[null]" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1226379600000" build_date="1226379600000" version="0.9" path="" - status="P" islast="false" depth="0"/> + status="P" islast="[false]" depth="0"/> <!-- 2008-11-12 --> <!-- Version 1.0 --> @@ -19,7 +19,7 @@ period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1226494680000" build_date="1226494680000" version="1.0" path="" - status="P" islast="false" depth="0"/> + status="P" islast="[false]" depth="0"/> <!-- 2008-11-20 --> <!-- version 1.1 --> @@ -28,7 +28,7 @@ period5_param="[null]" period5_date="[null]" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1227157200000" build_date="1227157200000" version="1.1" path="" - status="P" islast="false" depth="0"/> + status="P" islast="[false]" depth="0"/> <events id="1" name="0.9" component_uuid="ABCD" snapshot_id="1000" category="Version" event_date="1226379600000" created_at="1226379600000" description="" event_data="[null]"/> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/shared.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/shared.xml index ba062d9fd54..523edeb16aa 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/shared.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/shared.xml @@ -2,7 +2,7 @@ <projects id="1" root_id="[null]" scope="PRJ" qualifier="TRK" kee="PROJECT_KEY" name="project" long_name="[null]" description="[null]" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD." - enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> <!-- 2008-11-11 --> <!-- Version 0.9 --> @@ -11,7 +11,7 @@ period5_param="[null]" period5_date="[null]" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1226379600000" build_date="1226379600000" version="0.9" path="" - status="P" islast="false" depth="0"/> + status="P" islast="[false]" depth="0"/> <!-- 2008-11-12 --> <!-- Version 1.0 --> @@ -19,7 +19,7 @@ period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1226494680000" build_date="1226494680000" version="1.0" path="" - status="P" islast="false" depth="0"/> + status="P" islast="[false]" depth="0"/> <!-- 2008-11-20 --> <!-- First version 1.1 --> @@ -28,7 +28,7 @@ period5_param="[null]" period5_date="[null]" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1227157200000" build_date="1227157200000" version="1.1" path="" - status="P" islast="false" depth="0"/> + status="P" islast="[false]" depth="0"/> <!-- 2008-11-22 --> <snapshots id="1003" purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" @@ -36,7 +36,7 @@ period5_param="[null]" period5_date="[null]" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1227358680000" build_date="1227358680000" version="1.1" path="" - status="P" islast="false" depth="0"/> + status="P" islast="[false]" depth="0"/> <!-- 2008-11-29 --> <!-- Last version 1.1 --> @@ -44,7 +44,7 @@ period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1227934800000" build_date="1227934800000" version="1.1" path="" - status="P" islast="true" depth="0"/> + status="P" islast="[true]" depth="0"/> <events id="1" name="0.9" component_uuid="ABCD" snapshot_id="1000" category="Version" event_date="1226379600000" created_at="1226379600000" description="" event_data="[null]"/> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/unprocessed_snapshots.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/unprocessed_snapshots.xml index 848506944cc..e0a95fb14f2 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/unprocessed_snapshots.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FeedPeriodsStepTest/unprocessed_snapshots.xml @@ -2,7 +2,7 @@ <projects id="1" root_id="[null]" scope="PRJ" qualifier="TRK" kee="PROJECT_KEY" name="project" long_name="[null]" description="[null]" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD." - enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> <!-- Unprocessed snapshot --> <snapshots id="1000" purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" @@ -10,6 +10,6 @@ period5_param="[null]" period5_date="[null]" project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" scope="PRJ" qualifier="TRK" created_at="1226379600000" build_date="1226379600000" version="0.9" path="" - status="U" islast="false" depth="0"/> + status="U" islast="[false]" depth="0"/> </dataset> diff --git a/sonar-core/src/main/java/org/sonar/core/component/SnapshotDto.java b/sonar-core/src/main/java/org/sonar/core/component/SnapshotDto.java index 6d669eb1d40..f2735478980 100644 --- a/sonar-core/src/main/java/org/sonar/core/component/SnapshotDto.java +++ b/sonar-core/src/main/java/org/sonar/core/component/SnapshotDto.java @@ -176,11 +176,15 @@ public final class SnapshotDto { return this; } + /** + * On project's snapshot, the path is empty (or null on Oracle) + */ + @CheckForNull public String getPath() { return path; } - public SnapshotDto setPath(String path) { + public SnapshotDto setPath(@Nullable String path) { this.path = path; return this; } |