]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7027 add SnapshotTesting#newSnapshotForDeveloper + fix depth
authorSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Mon, 23 Nov 2015 16:37:32 +0000 (17:37 +0100)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Wed, 25 Nov 2015 14:33:06 +0000 (15:33 +0100)
depth field should be set whenever path is set

sonar-db/src/test/java/org/sonar/db/component/SnapshotTesting.java

index 10c3eb0ab435c4a7170ebf382040eee1dd52d81f..65d2aca5c72c3e7145d6755c21f07a52141a9fd9 100644 (file)
@@ -34,17 +34,26 @@ public class SnapshotTesting {
     return createBasicSnapshot(component, parentSnapshot.getRootProjectId())
       .setRootId(parentRootId != null ? parentRootId : parentSnapshot.getId())
       .setParentId(parentSnapshot.getId())
-      .setPath(Strings.isNullOrEmpty(parentSnapshot.getPath()) ? 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 newSnapshotForProject(ComponentDto project) {
     return createBasicSnapshot(project, project.getId())
-        .setPath("");
+      .setDepth(0)
+      .setPath("");
   }
 
   public static SnapshotDto newSnapshotForView(ComponentDto view) {
     return createBasicSnapshot(view, view.getId())
-        .setPath("");
+      .setDepth(0)
+      .setPath("");
+  }
+
+  public static SnapshotDto newSnapshotForDeveloper(ComponentDto developer) {
+    return createBasicSnapshot(developer, developer.getId())
+      .setDepth(0)
+      .setPath("");
   }
 
   private static SnapshotDto createBasicSnapshot(ComponentDto component, Long rootProjectId) {