From: Julien Lancelot Date: Tue, 28 Apr 2015 15:07:23 +0000 (+0200) Subject: Remove useless ResourceSnapshotMapper and rename folder dependency to design X-Git-Tag: 5.2-RC1~2096 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a60633c3404c98d97d6e05c84c2fc121f2343d9a;p=sonarqube.git Remove useless ResourceSnapshotMapper and rename folder dependency to design --- diff --git a/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/output/BatchReport.java b/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/output/BatchReport.java index c70067cdd98..981a8877125 100644 --- a/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/output/BatchReport.java +++ b/sonar-batch-protocol/src/main/gen-java/org/sonar/batch/protocol/output/BatchReport.java @@ -19508,7 +19508,7 @@ public final class BatchReport { * optional int32 conditions = 2; * *
-     * Number of conditions to cover (never 0)
+     * Number of conditions to cover (if set, the value must be greater than 0)
      * 
*/ boolean hasConditions(); @@ -19516,53 +19516,93 @@ public final class BatchReport { * optional int32 conditions = 2; * *
-     * Number of conditions to cover (never 0)
+     * Number of conditions to cover (if set, the value must be greater than 0)
      * 
*/ int getConditions(); /** * optional bool ut_hits = 3; + * + *
+     * Is the line has been touched by a unit test ? Returning false means that no test has touched this executable line.
+     * 
*/ boolean hasUtHits(); /** * optional bool ut_hits = 3; + * + *
+     * Is the line has been touched by a unit test ? Returning false means that no test has touched this executable line.
+     * 
*/ boolean getUtHits(); /** * optional bool it_hits = 4; + * + *
+     * Is the line has been touched by a integration test ? Returning false means that no test has touched this executable line.
+     * 
*/ boolean hasItHits(); /** * optional bool it_hits = 4; + * + *
+     * Is the line has been touched by a integration test ? Returning false means that no test has touched this executable line.
+     * 
*/ boolean getItHits(); /** * optional int32 ut_covered_conditions = 5; + * + *
+     * Number of conditions covered by unit tests
+     * 
*/ boolean hasUtCoveredConditions(); /** * optional int32 ut_covered_conditions = 5; + * + *
+     * Number of conditions covered by unit tests
+     * 
*/ int getUtCoveredConditions(); /** * optional int32 it_covered_conditions = 6; + * + *
+     * Number of conditions covered by integration tests
+     * 
*/ boolean hasItCoveredConditions(); /** * optional int32 it_covered_conditions = 6; + * + *
+     * Number of conditions covered by integration tests
+     * 
*/ int getItCoveredConditions(); /** * optional int32 overall_covered_conditions = 7; + * + *
+     * Number of conditions covered by overall tests
+     * 
*/ boolean hasOverallCoveredConditions(); /** * optional int32 overall_covered_conditions = 7; + * + *
+     * Number of conditions covered by overall tests
+     * 
*/ int getOverallCoveredConditions(); } @@ -19570,7 +19610,7 @@ public final class BatchReport { * Protobuf type {@code Coverage} * *
-   * Only FILE component has coverage information
+   * Only FILE component has coverage information, and only executable lines should contains this information.
    * TODO rename it LineCoverage ?
    * 
*/ @@ -19719,7 +19759,7 @@ public final class BatchReport { * optional int32 conditions = 2; * *
-     * Number of conditions to cover (never 0)
+     * Number of conditions to cover (if set, the value must be greater than 0)
      * 
*/ public boolean hasConditions() { @@ -19729,7 +19769,7 @@ public final class BatchReport { * optional int32 conditions = 2; * *
-     * Number of conditions to cover (never 0)
+     * Number of conditions to cover (if set, the value must be greater than 0)
      * 
*/ public int getConditions() { @@ -19740,12 +19780,20 @@ public final class BatchReport { private boolean utHits_; /** * optional bool ut_hits = 3; + * + *
+     * Is the line has been touched by a unit test ? Returning false means that no test has touched this executable line.
+     * 
*/ public boolean hasUtHits() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional bool ut_hits = 3; + * + *
+     * Is the line has been touched by a unit test ? Returning false means that no test has touched this executable line.
+     * 
*/ public boolean getUtHits() { return utHits_; @@ -19755,12 +19803,20 @@ public final class BatchReport { private boolean itHits_; /** * optional bool it_hits = 4; + * + *
+     * Is the line has been touched by a integration test ? Returning false means that no test has touched this executable line.
+     * 
*/ public boolean hasItHits() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional bool it_hits = 4; + * + *
+     * Is the line has been touched by a integration test ? Returning false means that no test has touched this executable line.
+     * 
*/ public boolean getItHits() { return itHits_; @@ -19770,12 +19826,20 @@ public final class BatchReport { private int utCoveredConditions_; /** * optional int32 ut_covered_conditions = 5; + * + *
+     * Number of conditions covered by unit tests
+     * 
*/ public boolean hasUtCoveredConditions() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional int32 ut_covered_conditions = 5; + * + *
+     * Number of conditions covered by unit tests
+     * 
*/ public int getUtCoveredConditions() { return utCoveredConditions_; @@ -19785,12 +19849,20 @@ public final class BatchReport { private int itCoveredConditions_; /** * optional int32 it_covered_conditions = 6; + * + *
+     * Number of conditions covered by integration tests
+     * 
*/ public boolean hasItCoveredConditions() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional int32 it_covered_conditions = 6; + * + *
+     * Number of conditions covered by integration tests
+     * 
*/ public int getItCoveredConditions() { return itCoveredConditions_; @@ -19800,12 +19872,20 @@ public final class BatchReport { private int overallCoveredConditions_; /** * optional int32 overall_covered_conditions = 7; + * + *
+     * Number of conditions covered by overall tests
+     * 
*/ public boolean hasOverallCoveredConditions() { return ((bitField0_ & 0x00000040) == 0x00000040); } /** * optional int32 overall_covered_conditions = 7; + * + *
+     * Number of conditions covered by overall tests
+     * 
*/ public int getOverallCoveredConditions() { return overallCoveredConditions_; @@ -19973,7 +20053,7 @@ public final class BatchReport { * Protobuf type {@code Coverage} * *
-     * Only FILE component has coverage information
+     * Only FILE component has coverage information, and only executable lines should contains this information.
      * TODO rename it LineCoverage ?
      * 
*/ @@ -20184,7 +20264,7 @@ public final class BatchReport { * optional int32 conditions = 2; * *
-       * Number of conditions to cover (never 0)
+       * Number of conditions to cover (if set, the value must be greater than 0)
        * 
*/ public boolean hasConditions() { @@ -20194,7 +20274,7 @@ public final class BatchReport { * optional int32 conditions = 2; * *
-       * Number of conditions to cover (never 0)
+       * Number of conditions to cover (if set, the value must be greater than 0)
        * 
*/ public int getConditions() { @@ -20204,7 +20284,7 @@ public final class BatchReport { * optional int32 conditions = 2; * *
-       * Number of conditions to cover (never 0)
+       * Number of conditions to cover (if set, the value must be greater than 0)
        * 
*/ public Builder setConditions(int value) { @@ -20217,7 +20297,7 @@ public final class BatchReport { * optional int32 conditions = 2; * *
-       * Number of conditions to cover (never 0)
+       * Number of conditions to cover (if set, the value must be greater than 0)
        * 
*/ public Builder clearConditions() { @@ -20230,18 +20310,30 @@ public final class BatchReport { private boolean utHits_ ; /** * optional bool ut_hits = 3; + * + *
+       * Is the line has been touched by a unit test ? Returning false means that no test has touched this executable line.
+       * 
*/ public boolean hasUtHits() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional bool ut_hits = 3; + * + *
+       * Is the line has been touched by a unit test ? Returning false means that no test has touched this executable line.
+       * 
*/ public boolean getUtHits() { return utHits_; } /** * optional bool ut_hits = 3; + * + *
+       * Is the line has been touched by a unit test ? Returning false means that no test has touched this executable line.
+       * 
*/ public Builder setUtHits(boolean value) { bitField0_ |= 0x00000004; @@ -20251,6 +20343,10 @@ public final class BatchReport { } /** * optional bool ut_hits = 3; + * + *
+       * Is the line has been touched by a unit test ? Returning false means that no test has touched this executable line.
+       * 
*/ public Builder clearUtHits() { bitField0_ = (bitField0_ & ~0x00000004); @@ -20262,18 +20358,30 @@ public final class BatchReport { private boolean itHits_ ; /** * optional bool it_hits = 4; + * + *
+       * Is the line has been touched by a integration test ? Returning false means that no test has touched this executable line.
+       * 
*/ public boolean hasItHits() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional bool it_hits = 4; + * + *
+       * Is the line has been touched by a integration test ? Returning false means that no test has touched this executable line.
+       * 
*/ public boolean getItHits() { return itHits_; } /** * optional bool it_hits = 4; + * + *
+       * Is the line has been touched by a integration test ? Returning false means that no test has touched this executable line.
+       * 
*/ public Builder setItHits(boolean value) { bitField0_ |= 0x00000008; @@ -20283,6 +20391,10 @@ public final class BatchReport { } /** * optional bool it_hits = 4; + * + *
+       * Is the line has been touched by a integration test ? Returning false means that no test has touched this executable line.
+       * 
*/ public Builder clearItHits() { bitField0_ = (bitField0_ & ~0x00000008); @@ -20294,18 +20406,30 @@ public final class BatchReport { private int utCoveredConditions_ ; /** * optional int32 ut_covered_conditions = 5; + * + *
+       * Number of conditions covered by unit tests
+       * 
*/ public boolean hasUtCoveredConditions() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional int32 ut_covered_conditions = 5; + * + *
+       * Number of conditions covered by unit tests
+       * 
*/ public int getUtCoveredConditions() { return utCoveredConditions_; } /** * optional int32 ut_covered_conditions = 5; + * + *
+       * Number of conditions covered by unit tests
+       * 
*/ public Builder setUtCoveredConditions(int value) { bitField0_ |= 0x00000010; @@ -20315,6 +20439,10 @@ public final class BatchReport { } /** * optional int32 ut_covered_conditions = 5; + * + *
+       * Number of conditions covered by unit tests
+       * 
*/ public Builder clearUtCoveredConditions() { bitField0_ = (bitField0_ & ~0x00000010); @@ -20326,18 +20454,30 @@ public final class BatchReport { private int itCoveredConditions_ ; /** * optional int32 it_covered_conditions = 6; + * + *
+       * Number of conditions covered by integration tests
+       * 
*/ public boolean hasItCoveredConditions() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional int32 it_covered_conditions = 6; + * + *
+       * Number of conditions covered by integration tests
+       * 
*/ public int getItCoveredConditions() { return itCoveredConditions_; } /** * optional int32 it_covered_conditions = 6; + * + *
+       * Number of conditions covered by integration tests
+       * 
*/ public Builder setItCoveredConditions(int value) { bitField0_ |= 0x00000020; @@ -20347,6 +20487,10 @@ public final class BatchReport { } /** * optional int32 it_covered_conditions = 6; + * + *
+       * Number of conditions covered by integration tests
+       * 
*/ public Builder clearItCoveredConditions() { bitField0_ = (bitField0_ & ~0x00000020); @@ -20358,18 +20502,30 @@ public final class BatchReport { private int overallCoveredConditions_ ; /** * optional int32 overall_covered_conditions = 7; + * + *
+       * Number of conditions covered by overall tests
+       * 
*/ public boolean hasOverallCoveredConditions() { return ((bitField0_ & 0x00000040) == 0x00000040); } /** * optional int32 overall_covered_conditions = 7; + * + *
+       * Number of conditions covered by overall tests
+       * 
*/ public int getOverallCoveredConditions() { return overallCoveredConditions_; } /** * optional int32 overall_covered_conditions = 7; + * + *
+       * Number of conditions covered by overall tests
+       * 
*/ public Builder setOverallCoveredConditions(int value) { bitField0_ |= 0x00000040; @@ -20379,6 +20535,10 @@ public final class BatchReport { } /** * optional int32 overall_covered_conditions = 7; + * + *
+       * Number of conditions covered by overall tests
+       * 
*/ 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 index 4c938179ede..00000000000 --- a/sonar-core/src/main/java/org/sonar/core/dependency/DependencyDto.java +++ /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 index 84e9771858b..00000000000 --- a/sonar-core/src/main/java/org/sonar/core/dependency/DependencyMapper.java +++ /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 index a90c2f23f57..00000000000 --- a/sonar-core/src/main/java/org/sonar/core/dependency/ResourceSnapshotDto.java +++ /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 index 693a630737e..00000000000 --- a/sonar-core/src/main/java/org/sonar/core/dependency/ResourceSnapshotMapper.java +++ /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 index ade664442b2..00000000000 --- a/sonar-core/src/main/java/org/sonar/core/dependency/package-info.java +++ /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 index 00000000000..f7c3aa7cd21 --- /dev/null +++ b/sonar-core/src/main/java/org/sonar/core/design/DependencyDto.java @@ -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 index 00000000000..d596bbca71c --- /dev/null +++ b/sonar-core/src/main/java/org/sonar/core/design/DependencyMapper.java @@ -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 index 00000000000..23d1da72558 --- /dev/null +++ b/sonar-core/src/main/java/org/sonar/core/design/package-info.java @@ -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; diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java b/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java index 8c6edaf62a9..d95c62afbab 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/MyBatis.java @@ -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 index dc93ec177f2..00000000000 --- a/sonar-core/src/main/resources/org/sonar/core/dependency/DependencyMapper.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - 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 index b84277f4962..00000000000 --- a/sonar-core/src/main/resources/org/sonar/core/dependency/ResourceSnapshotMapper.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - 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 index 00000000000..313a9ba7148 --- /dev/null +++ b/sonar-core/src/main/resources/org/sonar/core/design/DependencyMapper.xml @@ -0,0 +1,10 @@ + + + + + + + + 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 index e42fa5ff68d..00000000000 --- a/sonar-core/src/test/java/org/sonar/core/dependency/DependencyMapperTest.java +++ /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 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 index b721690ba58..00000000000 --- a/sonar-core/src/test/java/org/sonar/core/dependency/ResourceSnapshotMapperTest.java +++ /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 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 index 00000000000..98244b3963d --- /dev/null +++ b/sonar-core/src/test/java/org/sonar/core/design/DependencyMapperTest.java @@ -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 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 index f190e3a4221..00000000000 --- a/sonar-core/src/test/resources/org/sonar/core/dependency/DependencyMapperTest/fixture.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - 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 index 9b9fa7d4942..00000000000 --- a/sonar-core/src/test/resources/org/sonar/core/dependency/ResourceSnapshotMapperTest/fixture.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ 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 index 00000000000..f190e3a4221 --- /dev/null +++ b/sonar-core/src/test/resources/org/sonar/core/design/DependencyMapperTest/fixture.xml @@ -0,0 +1,4 @@ + + + +