]> source.dussan.org Git - sonarqube.git/commitdiff
Remove useless ResourceSnapshotMapper and rename folder dependency to design
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 28 Apr 2015 15:07:23 +0000 (17:07 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Tue, 28 Apr 2015 15:07:23 +0000 (17:07 +0200)
19 files changed:
sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/output/BatchReport.java
sonar-core/src/main/java/org/sonar/core/dependency/DependencyDto.java [deleted file]
sonar-core/src/main/java/org/sonar/core/dependency/DependencyMapper.java [deleted file]
sonar-core/src/main/java/org/sonar/core/dependency/ResourceSnapshotDto.java [deleted file]
sonar-core/src/main/java/org/sonar/core/dependency/ResourceSnapshotMapper.java [deleted file]
sonar-core/src/main/java/org/sonar/core/dependency/package-info.java [deleted file]
sonar-core/src/main/java/org/sonar/core/design/DependencyDto.java [new file with mode: 0644]
sonar-core/src/main/java/org/sonar/core/design/DependencyMapper.java [new file with mode: 0644]
sonar-core/src/main/java/org/sonar/core/design/package-info.java [new file with mode: 0644]
sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java
sonar-core/src/main/resources/org/sonar/core/dependency/DependencyMapper.xml [deleted file]
sonar-core/src/main/resources/org/sonar/core/dependency/ResourceSnapshotMapper.xml [deleted file]
sonar-core/src/main/resources/org/sonar/core/design/DependencyMapper.xml [new file with mode: 0644]
sonar-core/src/test/java/org/sonar/core/dependency/DependencyMapperTest.java [deleted file]
sonar-core/src/test/java/org/sonar/core/dependency/ResourceSnapshotMapperTest.java [deleted file]
sonar-core/src/test/java/org/sonar/core/design/DependencyMapperTest.java [new file with mode: 0644]
sonar-core/src/test/resources/org/sonar/core/dependency/DependencyMapperTest/fixture.xml [deleted file]
sonar-core/src/test/resources/org/sonar/core/dependency/ResourceSnapshotMapperTest/fixture.xml [deleted file]
sonar-core/src/test/resources/org/sonar/core/design/DependencyMapperTest/fixture.xml [new file with mode: 0644]

index c70067cdd982a8671133a3cdc732ab8eef5e8363..981a887712585dfc9f38f92aaefc8bcd1628c18f 100644 (file)
@@ -19508,7 +19508,7 @@ public final class BatchReport {
      * <code>optional int32 conditions = 2;</code>
      *
      * <pre>
-     * Number of conditions to cover (never 0)
+     * Number of conditions to cover (if set, the value must be greater than 0)
      * </pre>
      */
     boolean hasConditions();
@@ -19516,53 +19516,93 @@ public final class BatchReport {
      * <code>optional int32 conditions = 2;</code>
      *
      * <pre>
-     * Number of conditions to cover (never 0)
+     * Number of conditions to cover (if set, the value must be greater than 0)
      * </pre>
      */
     int getConditions();
 
     /**
      * <code>optional bool ut_hits = 3;</code>
+     *
+     * <pre>
+     * Is the line has been touched by a unit test ? Returning false means that no test has touched this executable line.
+     * </pre>
      */
     boolean hasUtHits();
     /**
      * <code>optional bool ut_hits = 3;</code>
+     *
+     * <pre>
+     * Is the line has been touched by a unit test ? Returning false means that no test has touched this executable line.
+     * </pre>
      */
     boolean getUtHits();
 
     /**
      * <code>optional bool it_hits = 4;</code>
+     *
+     * <pre>
+     * Is the line has been touched by a integration test ? Returning false means that no test has touched this executable line.
+     * </pre>
      */
     boolean hasItHits();
     /**
      * <code>optional bool it_hits = 4;</code>
+     *
+     * <pre>
+     * Is the line has been touched by a integration test ? Returning false means that no test has touched this executable line.
+     * </pre>
      */
     boolean getItHits();
 
     /**
      * <code>optional int32 ut_covered_conditions = 5;</code>
+     *
+     * <pre>
+     * Number of conditions covered by unit tests
+     * </pre>
      */
     boolean hasUtCoveredConditions();
     /**
      * <code>optional int32 ut_covered_conditions = 5;</code>
+     *
+     * <pre>
+     * Number of conditions covered by unit tests
+     * </pre>
      */
     int getUtCoveredConditions();
 
     /**
      * <code>optional int32 it_covered_conditions = 6;</code>
+     *
+     * <pre>
+     * Number of conditions covered by integration tests
+     * </pre>
      */
     boolean hasItCoveredConditions();
     /**
      * <code>optional int32 it_covered_conditions = 6;</code>
+     *
+     * <pre>
+     * Number of conditions covered by integration tests
+     * </pre>
      */
     int getItCoveredConditions();
 
     /**
      * <code>optional int32 overall_covered_conditions = 7;</code>
+     *
+     * <pre>
+     * Number of conditions covered by overall tests
+     * </pre>
      */
     boolean hasOverallCoveredConditions();
     /**
      * <code>optional int32 overall_covered_conditions = 7;</code>
+     *
+     * <pre>
+     * Number of conditions covered by overall tests
+     * </pre>
      */
     int getOverallCoveredConditions();
   }
@@ -19570,7 +19610,7 @@ public final class BatchReport {
    * Protobuf type {@code Coverage}
    *
    * <pre>
-   * Only FILE component has coverage information
+   * Only FILE component has coverage information, and only executable lines should contains this information.
    * TODO rename it LineCoverage ?
    * </pre>
    */
@@ -19719,7 +19759,7 @@ public final class BatchReport {
      * <code>optional int32 conditions = 2;</code>
      *
      * <pre>
-     * Number of conditions to cover (never 0)
+     * Number of conditions to cover (if set, the value must be greater than 0)
      * </pre>
      */
     public boolean hasConditions() {
@@ -19729,7 +19769,7 @@ public final class BatchReport {
      * <code>optional int32 conditions = 2;</code>
      *
      * <pre>
-     * Number of conditions to cover (never 0)
+     * Number of conditions to cover (if set, the value must be greater than 0)
      * </pre>
      */
     public int getConditions() {
@@ -19740,12 +19780,20 @@ public final class BatchReport {
     private boolean utHits_;
     /**
      * <code>optional bool ut_hits = 3;</code>
+     *
+     * <pre>
+     * Is the line has been touched by a unit test ? Returning false means that no test has touched this executable line.
+     * </pre>
      */
     public boolean hasUtHits() {
       return ((bitField0_ & 0x00000004) == 0x00000004);
     }
     /**
      * <code>optional bool ut_hits = 3;</code>
+     *
+     * <pre>
+     * Is the line has been touched by a unit test ? Returning false means that no test has touched this executable line.
+     * </pre>
      */
     public boolean getUtHits() {
       return utHits_;
@@ -19755,12 +19803,20 @@ public final class BatchReport {
     private boolean itHits_;
     /**
      * <code>optional bool it_hits = 4;</code>
+     *
+     * <pre>
+     * Is the line has been touched by a integration test ? Returning false means that no test has touched this executable line.
+     * </pre>
      */
     public boolean hasItHits() {
       return ((bitField0_ & 0x00000008) == 0x00000008);
     }
     /**
      * <code>optional bool it_hits = 4;</code>
+     *
+     * <pre>
+     * Is the line has been touched by a integration test ? Returning false means that no test has touched this executable line.
+     * </pre>
      */
     public boolean getItHits() {
       return itHits_;
@@ -19770,12 +19826,20 @@ public final class BatchReport {
     private int utCoveredConditions_;
     /**
      * <code>optional int32 ut_covered_conditions = 5;</code>
+     *
+     * <pre>
+     * Number of conditions covered by unit tests
+     * </pre>
      */
     public boolean hasUtCoveredConditions() {
       return ((bitField0_ & 0x00000010) == 0x00000010);
     }
     /**
      * <code>optional int32 ut_covered_conditions = 5;</code>
+     *
+     * <pre>
+     * Number of conditions covered by unit tests
+     * </pre>
      */
     public int getUtCoveredConditions() {
       return utCoveredConditions_;
@@ -19785,12 +19849,20 @@ public final class BatchReport {
     private int itCoveredConditions_;
     /**
      * <code>optional int32 it_covered_conditions = 6;</code>
+     *
+     * <pre>
+     * Number of conditions covered by integration tests
+     * </pre>
      */
     public boolean hasItCoveredConditions() {
       return ((bitField0_ & 0x00000020) == 0x00000020);
     }
     /**
      * <code>optional int32 it_covered_conditions = 6;</code>
+     *
+     * <pre>
+     * Number of conditions covered by integration tests
+     * </pre>
      */
     public int getItCoveredConditions() {
       return itCoveredConditions_;
@@ -19800,12 +19872,20 @@ public final class BatchReport {
     private int overallCoveredConditions_;
     /**
      * <code>optional int32 overall_covered_conditions = 7;</code>
+     *
+     * <pre>
+     * Number of conditions covered by overall tests
+     * </pre>
      */
     public boolean hasOverallCoveredConditions() {
       return ((bitField0_ & 0x00000040) == 0x00000040);
     }
     /**
      * <code>optional int32 overall_covered_conditions = 7;</code>
+     *
+     * <pre>
+     * Number of conditions covered by overall tests
+     * </pre>
      */
     public int getOverallCoveredConditions() {
       return overallCoveredConditions_;
@@ -19973,7 +20053,7 @@ public final class BatchReport {
      * Protobuf type {@code Coverage}
      *
      * <pre>
-     * Only FILE component has coverage information
+     * Only FILE component has coverage information, and only executable lines should contains this information.
      * TODO rename it LineCoverage ?
      * </pre>
      */
@@ -20184,7 +20264,7 @@ public final class BatchReport {
        * <code>optional int32 conditions = 2;</code>
        *
        * <pre>
-       * Number of conditions to cover (never 0)
+       * Number of conditions to cover (if set, the value must be greater than 0)
        * </pre>
        */
       public boolean hasConditions() {
@@ -20194,7 +20274,7 @@ public final class BatchReport {
        * <code>optional int32 conditions = 2;</code>
        *
        * <pre>
-       * Number of conditions to cover (never 0)
+       * Number of conditions to cover (if set, the value must be greater than 0)
        * </pre>
        */
       public int getConditions() {
@@ -20204,7 +20284,7 @@ public final class BatchReport {
        * <code>optional int32 conditions = 2;</code>
        *
        * <pre>
-       * Number of conditions to cover (never 0)
+       * Number of conditions to cover (if set, the value must be greater than 0)
        * </pre>
        */
       public Builder setConditions(int value) {
@@ -20217,7 +20297,7 @@ public final class BatchReport {
        * <code>optional int32 conditions = 2;</code>
        *
        * <pre>
-       * Number of conditions to cover (never 0)
+       * Number of conditions to cover (if set, the value must be greater than 0)
        * </pre>
        */
       public Builder clearConditions() {
@@ -20230,18 +20310,30 @@ public final class BatchReport {
       private boolean utHits_ ;
       /**
        * <code>optional bool ut_hits = 3;</code>
+       *
+       * <pre>
+       * Is the line has been touched by a unit test ? Returning false means that no test has touched this executable line.
+       * </pre>
        */
       public boolean hasUtHits() {
         return ((bitField0_ & 0x00000004) == 0x00000004);
       }
       /**
        * <code>optional bool ut_hits = 3;</code>
+       *
+       * <pre>
+       * Is the line has been touched by a unit test ? Returning false means that no test has touched this executable line.
+       * </pre>
        */
       public boolean getUtHits() {
         return utHits_;
       }
       /**
        * <code>optional bool ut_hits = 3;</code>
+       *
+       * <pre>
+       * Is the line has been touched by a unit test ? Returning false means that no test has touched this executable line.
+       * </pre>
        */
       public Builder setUtHits(boolean value) {
         bitField0_ |= 0x00000004;
@@ -20251,6 +20343,10 @@ public final class BatchReport {
       }
       /**
        * <code>optional bool ut_hits = 3;</code>
+       *
+       * <pre>
+       * Is the line has been touched by a unit test ? Returning false means that no test has touched this executable line.
+       * </pre>
        */
       public Builder clearUtHits() {
         bitField0_ = (bitField0_ & ~0x00000004);
@@ -20262,18 +20358,30 @@ public final class BatchReport {
       private boolean itHits_ ;
       /**
        * <code>optional bool it_hits = 4;</code>
+       *
+       * <pre>
+       * Is the line has been touched by a integration test ? Returning false means that no test has touched this executable line.
+       * </pre>
        */
       public boolean hasItHits() {
         return ((bitField0_ & 0x00000008) == 0x00000008);
       }
       /**
        * <code>optional bool it_hits = 4;</code>
+       *
+       * <pre>
+       * Is the line has been touched by a integration test ? Returning false means that no test has touched this executable line.
+       * </pre>
        */
       public boolean getItHits() {
         return itHits_;
       }
       /**
        * <code>optional bool it_hits = 4;</code>
+       *
+       * <pre>
+       * Is the line has been touched by a integration test ? Returning false means that no test has touched this executable line.
+       * </pre>
        */
       public Builder setItHits(boolean value) {
         bitField0_ |= 0x00000008;
@@ -20283,6 +20391,10 @@ public final class BatchReport {
       }
       /**
        * <code>optional bool it_hits = 4;</code>
+       *
+       * <pre>
+       * Is the line has been touched by a integration test ? Returning false means that no test has touched this executable line.
+       * </pre>
        */
       public Builder clearItHits() {
         bitField0_ = (bitField0_ & ~0x00000008);
@@ -20294,18 +20406,30 @@ public final class BatchReport {
       private int utCoveredConditions_ ;
       /**
        * <code>optional int32 ut_covered_conditions = 5;</code>
+       *
+       * <pre>
+       * Number of conditions covered by unit tests
+       * </pre>
        */
       public boolean hasUtCoveredConditions() {
         return ((bitField0_ & 0x00000010) == 0x00000010);
       }
       /**
        * <code>optional int32 ut_covered_conditions = 5;</code>
+       *
+       * <pre>
+       * Number of conditions covered by unit tests
+       * </pre>
        */
       public int getUtCoveredConditions() {
         return utCoveredConditions_;
       }
       /**
        * <code>optional int32 ut_covered_conditions = 5;</code>
+       *
+       * <pre>
+       * Number of conditions covered by unit tests
+       * </pre>
        */
       public Builder setUtCoveredConditions(int value) {
         bitField0_ |= 0x00000010;
@@ -20315,6 +20439,10 @@ public final class BatchReport {
       }
       /**
        * <code>optional int32 ut_covered_conditions = 5;</code>
+       *
+       * <pre>
+       * Number of conditions covered by unit tests
+       * </pre>
        */
       public Builder clearUtCoveredConditions() {
         bitField0_ = (bitField0_ & ~0x00000010);
@@ -20326,18 +20454,30 @@ public final class BatchReport {
       private int itCoveredConditions_ ;
       /**
        * <code>optional int32 it_covered_conditions = 6;</code>
+       *
+       * <pre>
+       * Number of conditions covered by integration tests
+       * </pre>
        */
       public boolean hasItCoveredConditions() {
         return ((bitField0_ & 0x00000020) == 0x00000020);
       }
       /**
        * <code>optional int32 it_covered_conditions = 6;</code>
+       *
+       * <pre>
+       * Number of conditions covered by integration tests
+       * </pre>
        */
       public int getItCoveredConditions() {
         return itCoveredConditions_;
       }
       /**
        * <code>optional int32 it_covered_conditions = 6;</code>
+       *
+       * <pre>
+       * Number of conditions covered by integration tests
+       * </pre>
        */
       public Builder setItCoveredConditions(int value) {
         bitField0_ |= 0x00000020;
@@ -20347,6 +20487,10 @@ public final class BatchReport {
       }
       /**
        * <code>optional int32 it_covered_conditions = 6;</code>
+       *
+       * <pre>
+       * Number of conditions covered by integration tests
+       * </pre>
        */
       public Builder clearItCoveredConditions() {
         bitField0_ = (bitField0_ & ~0x00000020);
@@ -20358,18 +20502,30 @@ public final class BatchReport {
       private int overallCoveredConditions_ ;
       /**
        * <code>optional int32 overall_covered_conditions = 7;</code>
+       *
+       * <pre>
+       * Number of conditions covered by overall tests
+       * </pre>
        */
       public boolean hasOverallCoveredConditions() {
         return ((bitField0_ & 0x00000040) == 0x00000040);
       }
       /**
        * <code>optional int32 overall_covered_conditions = 7;</code>
+       *
+       * <pre>
+       * Number of conditions covered by overall tests
+       * </pre>
        */
       public int getOverallCoveredConditions() {
         return overallCoveredConditions_;
       }
       /**
        * <code>optional int32 overall_covered_conditions = 7;</code>
+       *
+       * <pre>
+       * Number of conditions covered by overall tests
+       * </pre>
        */
       public Builder setOverallCoveredConditions(int value) {
         bitField0_ |= 0x00000040;
@@ -20379,6 +20535,10 @@ public final class BatchReport {
       }
       /**
        * <code>optional int32 overall_covered_conditions = 7;</code>
+       *
+       * <pre>
+       * Number of conditions covered by overall tests
+       * </pre>
        */
       public Builder clearOverallCoveredConditions() {
         bitField0_ = (bitField0_ & ~0x00000040);
diff --git a/sonar-core/src/main/java/org/sonar/core/dependency/DependencyDto.java b/sonar-core/src/main/java/org/sonar/core/dependency/DependencyDto.java
deleted file mode 100644 (file)
index 4c93817..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.core.dependency;
-
-public final class DependencyDto {
-  private Long id;
-  private Long fromSnapshotId;
-  private Long toSnapshotId;
-  private String usage;
-
-  public Long getId() {
-    return id;
-  }
-
-  public DependencyDto setId(Long id) {
-    this.id = id;
-    return this;
-  }
-
-  public Long getFromSnapshotId() {
-    return fromSnapshotId;
-  }
-
-  public DependencyDto setFromSnapshotId(Long fromSnapshotId) {
-    this.fromSnapshotId = fromSnapshotId;
-    return this;
-  }
-
-  public Long getToSnapshotId() {
-    return toSnapshotId;
-  }
-
-  public DependencyDto setToSnapshotId(Long toSnapshotId) {
-    this.toSnapshotId = toSnapshotId;
-    return this;
-  }
-
-  public String getUsage() {
-    return usage;
-  }
-
-  public DependencyDto setUsage(String usage) {
-    this.usage = usage;
-    return this;
-  }
-}
diff --git a/sonar-core/src/main/java/org/sonar/core/dependency/DependencyMapper.java b/sonar-core/src/main/java/org/sonar/core/dependency/DependencyMapper.java
deleted file mode 100644 (file)
index 84e9771..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.core.dependency;
-
-import org.apache.ibatis.session.ResultHandler;
-
-public interface DependencyMapper {
-  void selectAll(ResultHandler handler);
-}
diff --git a/sonar-core/src/main/java/org/sonar/core/dependency/ResourceSnapshotDto.java b/sonar-core/src/main/java/org/sonar/core/dependency/ResourceSnapshotDto.java
deleted file mode 100644 (file)
index a90c2f2..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.core.dependency;
-
-public final class ResourceSnapshotDto {
-  private Long id;
-  private Long projectId;
-  private String version;
-
-  public Long getId() {
-    return id;
-  }
-
-  public ResourceSnapshotDto setId(Long id) {
-    this.id = id;
-    return this;
-  }
-
-  public Long getProjectId() {
-    return projectId;
-  }
-
-  public ResourceSnapshotDto setProjectId(Long projectId) {
-    this.projectId = projectId;
-    return this;
-  }
-
-  public String getVersion() {
-    return version;
-  }
-
-  public ResourceSnapshotDto setVersion(String version) {
-    this.version = version;
-    return this;
-  }
-}
diff --git a/sonar-core/src/main/java/org/sonar/core/dependency/ResourceSnapshotMapper.java b/sonar-core/src/main/java/org/sonar/core/dependency/ResourceSnapshotMapper.java
deleted file mode 100644 (file)
index 693a630..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.core.dependency;
-
-import org.apache.ibatis.session.ResultHandler;
-
-public interface ResourceSnapshotMapper {
-  void selectAll(ResultHandler handler);
-}
diff --git a/sonar-core/src/main/java/org/sonar/core/dependency/package-info.java b/sonar-core/src/main/java/org/sonar/core/dependency/package-info.java
deleted file mode 100644 (file)
index ade6644..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-@ParametersAreNonnullByDefault
-package org.sonar.core.dependency;
-
-import javax.annotation.ParametersAreNonnullByDefault;
diff --git a/sonar-core/src/main/java/org/sonar/core/design/DependencyDto.java b/sonar-core/src/main/java/org/sonar/core/design/DependencyDto.java
new file mode 100644 (file)
index 0000000..f7c3aa7
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+package org.sonar.core.design;
+
+public final class DependencyDto {
+  private Long id;
+  private Long fromSnapshotId;
+  private Long toSnapshotId;
+  private String usage;
+
+  public Long getId() {
+    return id;
+  }
+
+  public DependencyDto setId(Long id) {
+    this.id = id;
+    return this;
+  }
+
+  public Long getFromSnapshotId() {
+    return fromSnapshotId;
+  }
+
+  public DependencyDto setFromSnapshotId(Long fromSnapshotId) {
+    this.fromSnapshotId = fromSnapshotId;
+    return this;
+  }
+
+  public Long getToSnapshotId() {
+    return toSnapshotId;
+  }
+
+  public DependencyDto setToSnapshotId(Long toSnapshotId) {
+    this.toSnapshotId = toSnapshotId;
+    return this;
+  }
+
+  public String getUsage() {
+    return usage;
+  }
+
+  public DependencyDto setUsage(String usage) {
+    this.usage = usage;
+    return this;
+  }
+}
diff --git a/sonar-core/src/main/java/org/sonar/core/design/DependencyMapper.java b/sonar-core/src/main/java/org/sonar/core/design/DependencyMapper.java
new file mode 100644 (file)
index 0000000..d596bbc
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+package org.sonar.core.design;
+
+import org.apache.ibatis.session.ResultHandler;
+
+public interface DependencyMapper {
+  void selectAll(ResultHandler handler);
+}
diff --git a/sonar-core/src/main/java/org/sonar/core/design/package-info.java b/sonar-core/src/main/java/org/sonar/core/design/package-info.java
new file mode 100644 (file)
index 0000000..23d1da7
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.core.design;
+
+import javax.annotation.ParametersAreNonnullByDefault;
index 8c6edaf62a96f88153bc438892ec0b105a40d3af..d95c62afbab32498086a5547ebfb55692f7cd3c7 100644 (file)
@@ -25,7 +25,11 @@ import com.google.common.io.Closeables;
 import org.apache.ibatis.builder.xml.XMLMapperBuilder;
 import org.apache.ibatis.logging.LogFactory;
 import org.apache.ibatis.mapping.Environment;
-import org.apache.ibatis.session.*;
+import org.apache.ibatis.session.Configuration;
+import org.apache.ibatis.session.ExecutorType;
+import org.apache.ibatis.session.SqlSession;
+import org.apache.ibatis.session.SqlSessionFactory;
+import org.apache.ibatis.session.SqlSessionFactoryBuilder;
 import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory;
 import org.apache.ibatis.type.JdbcType;
 import org.slf4j.LoggerFactory;
@@ -35,7 +39,11 @@ import org.sonar.api.database.model.MeasureModel;
 import org.sonar.core.activity.db.ActivityDto;
 import org.sonar.core.activity.db.ActivityMapper;
 import org.sonar.core.cluster.WorkQueue;
-import org.sonar.core.component.*;
+import org.sonar.core.component.ComponentDto;
+import org.sonar.core.component.ComponentLinkDto;
+import org.sonar.core.component.FilePathWithHashDto;
+import org.sonar.core.component.SnapshotDto;
+import org.sonar.core.component.UuidWithProjectUuidDto;
 import org.sonar.core.component.db.ComponentIndexMapper;
 import org.sonar.core.component.db.ComponentLinkMapper;
 import org.sonar.core.component.db.ComponentMapper;
@@ -43,22 +51,47 @@ import org.sonar.core.component.db.SnapshotMapper;
 import org.sonar.core.computation.db.AnalysisReportDto;
 import org.sonar.core.computation.db.AnalysisReportMapper;
 import org.sonar.core.config.Logback;
-import org.sonar.core.dashboard.*;
-import org.sonar.core.dependency.DependencyDto;
-import org.sonar.core.dependency.DependencyMapper;
-import org.sonar.core.dependency.ResourceSnapshotDto;
-import org.sonar.core.dependency.ResourceSnapshotMapper;
+import org.sonar.core.dashboard.ActiveDashboardDto;
+import org.sonar.core.dashboard.ActiveDashboardMapper;
+import org.sonar.core.dashboard.DashboardDto;
+import org.sonar.core.dashboard.DashboardMapper;
+import org.sonar.core.dashboard.WidgetDto;
+import org.sonar.core.dashboard.WidgetMapper;
+import org.sonar.core.dashboard.WidgetPropertyDto;
+import org.sonar.core.dashboard.WidgetPropertyMapper;
+import org.sonar.core.design.DependencyDto;
+import org.sonar.core.design.DependencyMapper;
 import org.sonar.core.duplication.DuplicationMapper;
 import org.sonar.core.duplication.DuplicationUnitDto;
 import org.sonar.core.event.EventDto;
 import org.sonar.core.event.db.EventMapper;
 import org.sonar.core.graph.jdbc.GraphDto;
 import org.sonar.core.graph.jdbc.GraphDtoMapper;
-import org.sonar.core.issue.db.*;
-import org.sonar.core.measure.db.*;
+import org.sonar.core.issue.db.ActionPlanDto;
+import org.sonar.core.issue.db.ActionPlanMapper;
+import org.sonar.core.issue.db.ActionPlanStatsDto;
+import org.sonar.core.issue.db.ActionPlanStatsMapper;
+import org.sonar.core.issue.db.IssueChangeDto;
+import org.sonar.core.issue.db.IssueChangeMapper;
+import org.sonar.core.issue.db.IssueDto;
+import org.sonar.core.issue.db.IssueFilterDto;
+import org.sonar.core.issue.db.IssueFilterFavouriteDto;
+import org.sonar.core.issue.db.IssueFilterFavouriteMapper;
+import org.sonar.core.issue.db.IssueFilterMapper;
+import org.sonar.core.issue.db.IssueMapper;
+import org.sonar.core.measure.db.MeasureDto;
+import org.sonar.core.measure.db.MeasureFilterDto;
+import org.sonar.core.measure.db.MeasureFilterMapper;
+import org.sonar.core.measure.db.MeasureMapper;
+import org.sonar.core.measure.db.MetricMapper;
 import org.sonar.core.notification.db.NotificationQueueDto;
 import org.sonar.core.notification.db.NotificationQueueMapper;
-import org.sonar.core.permission.*;
+import org.sonar.core.permission.GroupWithPermissionDto;
+import org.sonar.core.permission.PermissionTemplateDto;
+import org.sonar.core.permission.PermissionTemplateGroupDto;
+import org.sonar.core.permission.PermissionTemplateMapper;
+import org.sonar.core.permission.PermissionTemplateUserDto;
+import org.sonar.core.permission.UserWithPermissionDto;
 import org.sonar.core.persistence.dialect.Dialect;
 import org.sonar.core.persistence.migration.v44.Migration44Mapper;
 import org.sonar.core.persistence.migration.v45.Migration45Mapper;
@@ -68,9 +101,22 @@ import org.sonar.core.properties.PropertyDto;
 import org.sonar.core.purge.IdUuidPair;
 import org.sonar.core.purge.PurgeMapper;
 import org.sonar.core.purge.PurgeableSnapshotDto;
-import org.sonar.core.qualitygate.db.*;
-import org.sonar.core.qualityprofile.db.*;
-import org.sonar.core.resource.*;
+import org.sonar.core.qualitygate.db.ProjectQgateAssociationDto;
+import org.sonar.core.qualitygate.db.ProjectQgateAssociationMapper;
+import org.sonar.core.qualitygate.db.QualityGateConditionDto;
+import org.sonar.core.qualitygate.db.QualityGateConditionMapper;
+import org.sonar.core.qualitygate.db.QualityGateDto;
+import org.sonar.core.qualitygate.db.QualityGateMapper;
+import org.sonar.core.qualityprofile.db.ActiveRuleDto;
+import org.sonar.core.qualityprofile.db.ActiveRuleMapper;
+import org.sonar.core.qualityprofile.db.ActiveRuleParamDto;
+import org.sonar.core.qualityprofile.db.QualityProfileDto;
+import org.sonar.core.qualityprofile.db.QualityProfileMapper;
+import org.sonar.core.resource.ResourceDto;
+import org.sonar.core.resource.ResourceIndexDto;
+import org.sonar.core.resource.ResourceIndexerMapper;
+import org.sonar.core.resource.ResourceKeyUpdaterMapper;
+import org.sonar.core.resource.ResourceMapper;
 import org.sonar.core.rule.RuleDto;
 import org.sonar.core.rule.RuleMapper;
 import org.sonar.core.rule.RuleParamDto;
@@ -80,7 +126,19 @@ import org.sonar.core.technicaldebt.db.CharacteristicMapper;
 import org.sonar.core.technicaldebt.db.RequirementMigrationDto;
 import org.sonar.core.template.LoadedTemplateDto;
 import org.sonar.core.template.LoadedTemplateMapper;
-import org.sonar.core.user.*;
+import org.sonar.core.user.AuthorDto;
+import org.sonar.core.user.AuthorMapper;
+import org.sonar.core.user.GroupDto;
+import org.sonar.core.user.GroupMapper;
+import org.sonar.core.user.GroupMembershipDto;
+import org.sonar.core.user.GroupMembershipMapper;
+import org.sonar.core.user.GroupRoleDto;
+import org.sonar.core.user.RoleMapper;
+import org.sonar.core.user.UserDto;
+import org.sonar.core.user.UserGroupDto;
+import org.sonar.core.user.UserGroupMapper;
+import org.sonar.core.user.UserMapper;
+import org.sonar.core.user.UserRoleDto;
 
 import javax.annotation.Nullable;
 
@@ -151,7 +209,6 @@ public class MyBatis implements BatchComponent, ServerComponent {
     loadAlias(conf, "ProjectQgateAssociation", ProjectQgateAssociationDto.class);
     loadAlias(conf, "Resource", ResourceDto.class);
     loadAlias(conf, "ResourceIndex", ResourceIndexDto.class);
-    loadAlias(conf, "ResourceSnapshot", ResourceSnapshotDto.class);
     loadAlias(conf, "Rule", RuleDto.class);
     loadAlias(conf, "RuleParam", RuleParamDto.class);
     loadAlias(conf, "Snapshot", SnapshotDto.class);
@@ -197,7 +254,7 @@ public class MyBatis implements BatchComponent, ServerComponent {
       DependencyMapper.class, DuplicationMapper.class, GraphDtoMapper.class,
       IssueMapper.class, IssueChangeMapper.class, IssueFilterMapper.class, IssueFilterFavouriteMapper.class,
       LoadedTemplateMapper.class, MeasureFilterMapper.class, Migration44Mapper.class, PermissionTemplateMapper.class, PropertiesMapper.class, PurgeMapper.class,
-      ResourceKeyUpdaterMapper.class, ResourceIndexerMapper.class, ResourceSnapshotMapper.class, RoleMapper.class, RuleMapper.class,
+      ResourceKeyUpdaterMapper.class, ResourceIndexerMapper.class, RoleMapper.class, RuleMapper.class,
       SchemaMigrationMapper.class, SemaphoreMapper.class, UserMapper.class, GroupMapper.class, UserGroupMapper.class, WidgetMapper.class, WidgetPropertyMapper.class,
       FileSourceMapper.class, ActionPlanMapper.class,
       ActionPlanStatsMapper.class,
diff --git a/sonar-core/src/main/resources/org/sonar/core/dependency/DependencyMapper.xml b/sonar-core/src/main/resources/org/sonar/core/dependency/DependencyMapper.xml
deleted file mode 100644 (file)
index dc93ec1..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="org.sonar.core.dependency.DependencyMapper">
-
-  <select id="selectAll" resultType="dependency" >
-    SELECT id, from_snapshot_id as fromSnapshotId, to_snapshot_id as toSnapshotId, dep_usage as "usage" FROM dependencies
-  </select>
-
-</mapper>
diff --git a/sonar-core/src/main/resources/org/sonar/core/dependency/ResourceSnapshotMapper.xml b/sonar-core/src/main/resources/org/sonar/core/dependency/ResourceSnapshotMapper.xml
deleted file mode 100644 (file)
index b84277f..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="org.sonar.core.dependency.ResourceSnapshotMapper">
-
-  <select id="selectAll" resultType="ResourceSnapshot" >
-    SELECT id, project_id as projectId, version FROM snapshots
-  </select>
-
-</mapper>
diff --git a/sonar-core/src/main/resources/org/sonar/core/design/DependencyMapper.xml b/sonar-core/src/main/resources/org/sonar/core/design/DependencyMapper.xml
new file mode 100644 (file)
index 0000000..313a9ba
--- /dev/null
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="org.sonar.core.design.DependencyMapper">
+
+  <select id="selectAll" resultType="dependency" >
+    SELECT id, from_snapshot_id as fromSnapshotId, to_snapshot_id as toSnapshotId, dep_usage as "usage" FROM dependencies
+  </select>
+
+</mapper>
diff --git a/sonar-core/src/test/java/org/sonar/core/dependency/DependencyMapperTest.java b/sonar-core/src/test/java/org/sonar/core/dependency/DependencyMapperTest.java
deleted file mode 100644 (file)
index e42fa5f..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.core.dependency;
-
-import com.google.common.collect.Lists;
-import org.apache.ibatis.session.ResultContext;
-import org.apache.ibatis.session.ResultHandler;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.sonar.core.persistence.DbSession;
-import org.sonar.core.persistence.DbTester;
-
-import java.util.List;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class DependencyMapperTest {
-
-  @ClassRule
-  public static DbTester dbtester = new DbTester();
-
-  DbSession session;
-
-  @Before
-  public void setUp() throws Exception {
-    dbtester.truncateTables();
-    session = dbtester.myBatis().openSession(false);
-  }
-
-  @After
-  public void tearDown() throws Exception {
-    session.close();
-  }
-
-  @Test
-  public void select_all_dependencies() {
-    dbtester.prepareDbUnit(getClass(), "fixture.xml");
-
-    final List<DependencyDto> dependencies = Lists.newArrayList();
-
-    session.getMapper(DependencyMapper.class).selectAll(new ResultHandler() {
-      public void handleResult(ResultContext context) {
-        dependencies.add((DependencyDto) context.getResultObject());
-      }
-    });
-
-    assertThat(dependencies).hasSize(2);
-
-    DependencyDto dep = dependencies.get(0);
-    assertThat(dep.getId()).isEqualTo(1L);
-    assertThat(dep.getFromSnapshotId()).isEqualTo(1000L);
-    assertThat(dep.getToSnapshotId()).isEqualTo(1001L);
-    assertThat(dep.getUsage()).isEqualTo("compile");
-  }
-}
diff --git a/sonar-core/src/test/java/org/sonar/core/dependency/ResourceSnapshotMapperTest.java b/sonar-core/src/test/java/org/sonar/core/dependency/ResourceSnapshotMapperTest.java
deleted file mode 100644 (file)
index b721690..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * SonarQube, open source software quality management tool.
- * Copyright (C) 2008-2014 SonarSource
- * mailto:contact AT sonarsource DOT com
- *
- * SonarQube is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * SonarQube is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-package org.sonar.core.dependency;
-
-import com.google.common.collect.Lists;
-import org.apache.ibatis.session.ResultContext;
-import org.apache.ibatis.session.ResultHandler;
-import org.apache.ibatis.session.SqlSession;
-import org.junit.Test;
-import org.sonar.core.persistence.AbstractDaoTestCase;
-import org.sonar.core.persistence.MyBatis;
-
-import java.util.List;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ResourceSnapshotMapperTest extends AbstractDaoTestCase {
-  @Test
-  public void should_find_all() {
-    setupData("fixture");
-
-    final List<ResourceSnapshotDto> snapshots = Lists.newArrayList();
-
-    SqlSession session = getMyBatis().openSession();
-    try {
-      session.getMapper(ResourceSnapshotMapper.class).selectAll(new ResultHandler() {
-        public void handleResult(ResultContext context) {
-          snapshots.add((ResourceSnapshotDto) context.getResultObject());
-        }
-      });
-    } finally {
-      MyBatis.closeQuietly(session);
-    }
-
-    assertThat(snapshots).hasSize(2);
-
-    ResourceSnapshotDto dep = snapshots.get(0);
-    assertThat(dep.getId()).isEqualTo(1L);
-    assertThat(dep.getProjectId()).isEqualTo(1000L);
-    assertThat(dep.getVersion()).isEqualTo("1.0");
-  }
-}
diff --git a/sonar-core/src/test/java/org/sonar/core/design/DependencyMapperTest.java b/sonar-core/src/test/java/org/sonar/core/design/DependencyMapperTest.java
new file mode 100644 (file)
index 0000000..98244b3
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ */
+package org.sonar.core.design;
+
+import com.google.common.collect.Lists;
+import org.apache.ibatis.session.ResultContext;
+import org.apache.ibatis.session.ResultHandler;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.sonar.core.persistence.DbSession;
+import org.sonar.core.persistence.DbTester;
+
+import java.util.List;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class DependencyMapperTest {
+
+  @ClassRule
+  public static DbTester dbtester = new DbTester();
+
+  DbSession session;
+
+  @Before
+  public void setUp() throws Exception {
+    dbtester.truncateTables();
+    session = dbtester.myBatis().openSession(false);
+  }
+
+  @After
+  public void tearDown() throws Exception {
+    session.close();
+  }
+
+  @Test
+  public void select_all_dependencies() {
+    dbtester.prepareDbUnit(getClass(), "fixture.xml");
+
+    final List<DependencyDto> dependencies = Lists.newArrayList();
+
+    session.getMapper(DependencyMapper.class).selectAll(new ResultHandler() {
+      public void handleResult(ResultContext context) {
+        dependencies.add((DependencyDto) context.getResultObject());
+      }
+    });
+
+    assertThat(dependencies).hasSize(2);
+
+    DependencyDto dep = dependencies.get(0);
+    assertThat(dep.getId()).isEqualTo(1L);
+    assertThat(dep.getFromSnapshotId()).isEqualTo(1000L);
+    assertThat(dep.getToSnapshotId()).isEqualTo(1001L);
+    assertThat(dep.getUsage()).isEqualTo("compile");
+  }
+}
diff --git a/sonar-core/src/test/resources/org/sonar/core/dependency/DependencyMapperTest/fixture.xml b/sonar-core/src/test/resources/org/sonar/core/dependency/DependencyMapperTest/fixture.xml
deleted file mode 100644 (file)
index f190e3a..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<dataset>
-  <dependencies id="1" from_component_uuid="ABCD" to_component_uuid="EFGH" from_snapshot_id="1000" to_snapshot_id="1001" dep_usage="compile" dep_weight="1" />
-  <dependencies id="2" from_component_uuid="DCBA" to_component_uuid="HGFE" from_snapshot_id="2000" to_snapshot_id="2001" dep_usage="provided" dep_weight="1" />
-</dataset>
diff --git a/sonar-core/src/test/resources/org/sonar/core/dependency/ResourceSnapshotMapperTest/fixture.xml b/sonar-core/src/test/resources/org/sonar/core/dependency/ResourceSnapshotMapperTest/fixture.xml
deleted file mode 100644 (file)
index 9b9fa7d..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<dataset>
-  <snapshots id="1" project_id="1000" version="1.0" />
-  <snapshots id="2" project_id="1001" version="2.0-SNAPSHOT" />
-</dataset>
\ No newline at end of file
diff --git a/sonar-core/src/test/resources/org/sonar/core/design/DependencyMapperTest/fixture.xml b/sonar-core/src/test/resources/org/sonar/core/design/DependencyMapperTest/fixture.xml
new file mode 100644 (file)
index 0000000..f190e3a
--- /dev/null
@@ -0,0 +1,4 @@
+<dataset>
+  <dependencies id="1" from_component_uuid="ABCD" to_component_uuid="EFGH" from_snapshot_id="1000" to_snapshot_id="1001" dep_usage="compile" dep_weight="1" />
+  <dependencies id="2" from_component_uuid="DCBA" to_component_uuid="HGFE" from_snapshot_id="2000" to_snapshot_id="2001" dep_usage="provided" dep_weight="1" />
+</dataset>