summaryrefslogtreecommitdiffstats
path: root/sonar-core
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2015-02-18 15:24:01 +0100
committerStas Vilchik <vilchiks@gmail.com>2015-02-18 15:24:01 +0100
commit318df64dc365d1bd21b6576f9a00f29bda66882a (patch)
treee2c246660f2c94aa7dee11ad44f4d6a4d08df8f6 /sonar-core
parent7f646b72d3c5dc7700c36188ece84ad6e205fc53 (diff)
parent8640ce8dee1ff1f515d8c8b8564e0c53e5d6b5ec (diff)
downloadsonarqube-318df64dc365d1bd21b6576f9a00f29bda66882a.tar.gz
sonarqube-318df64dc365d1bd21b6576f9a00f29bda66882a.zip
Merge branch 'master' into feature/branding
Diffstat (limited to 'sonar-core')
-rw-r--r--sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java36
-rw-r--r--sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java4
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql4
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl4
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties8
-rw-r--r--sonar-core/src/test/java/org/sonar/core/purge/PurgeCommandsTest.java6
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteResource.xml2
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml2
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml4
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml8
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml8
-rw-r--r--sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldSelectPurgeableSnapshots.xml2
12 files changed, 65 insertions, 23 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java b/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java
index b9b5fb61955..97977cd2162 100644
--- a/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java
+++ b/sonar-core/src/main/java/org/sonar/core/config/CorePropertyDefinitions.java
@@ -22,6 +22,7 @@ package org.sonar.core.config;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import org.sonar.api.CoreProperties;
+import org.sonar.api.PropertyType;
import org.sonar.api.config.PropertyDefinition;
import org.sonar.api.resources.Qualifiers;
import org.sonar.core.computation.dbcleaner.DataCleanerProperties;
@@ -118,8 +119,41 @@ public class CorePropertyDefinitions {
.onlyOnQualifiers(Qualifiers.PROJECT)
.category(CoreProperties.CATEGORY_GENERAL)
.subCategory(CoreProperties.SUBCATEGORY_DIFFERENTIAL_VIEWS)
+ .build(),
+
+ // CPD
+ PropertyDefinition.builder(CoreProperties.CPD_CROSS_PROJECT)
+ .defaultValue(CoreProperties.CPD_CROSS_RPOJECT_DEFAULT_VALUE + "")
+ .name("Cross project duplication detection")
+ .description("By default, SonarQube detects duplications at sub-project level. This means that a block "
+ + "duplicated on two sub-projects of the same project won't be reported. Setting this parameter to \"true\" "
+ + "allows to detect duplicates across sub-projects and more generally across projects. Note that activating "
+ + "this property will slightly increase each SonarQube analysis time.")
+ .onQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE)
+ .category(CoreProperties.CATEGORY_GENERAL)
+ .subCategory(CoreProperties.SUBCATEGORY_DUPLICATIONS)
+ .type(PropertyType.BOOLEAN)
+ .build(),
+ PropertyDefinition.builder(CoreProperties.CPD_SKIP_PROPERTY)
+ .defaultValue("false")
+ .name("Skip")
+ .description("Disable detection of duplications")
+ .hidden()
+ .category(CoreProperties.CATEGORY_GENERAL)
+ .subCategory(CoreProperties.SUBCATEGORY_DUPLICATIONS)
+ .type(PropertyType.BOOLEAN)
+ .build(),
+ PropertyDefinition.builder(CoreProperties.CPD_EXCLUSIONS)
+ .defaultValue("")
+ .name("Duplication Exclusions")
+ .description("Patterns used to exclude some source files from the duplication detection mechanism. " +
+ "See below to know how to use wildcards to specify this property.")
+ .onQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE)
+ .category(CoreProperties.CATEGORY_EXCLUSIONS)
+ .subCategory(CoreProperties.SUBCATEGORY_DUPLICATIONS_EXCLUSIONS)
+ .multiValues(true)
.build()
- ));
+ ));
return defs;
}
}
diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java
index 048e602afe9..7bc6687dd22 100644
--- a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java
+++ b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseVersion.java
@@ -33,7 +33,7 @@ import java.util.List;
*/
public class DatabaseVersion implements BatchComponent, ServerComponent {
- public static final int LAST_VERSION = 790;
+ public static final int LAST_VERSION = 794;
/**
* List of all the tables.n
@@ -88,7 +88,7 @@ public class DatabaseVersion implements BatchComponent, ServerComponent {
"user_roles",
"widgets",
"widget_properties"
- );
+ );
private MyBatis mybatis;
public DatabaseVersion(MyBatis mybatis) {
diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql
index af6b0b2df00..ef5ff49f785 100644
--- a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql
+++ b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-h2.sql
@@ -317,6 +317,10 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('787');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('788');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('789');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('790');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('791');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('792');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('793');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('794');
INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT, REMEMBER_TOKEN, REMEMBER_TOKEN_EXPIRES_AT) VALUES (1, 'admin', 'Administrator', '', 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '1418215735482', '1418215735482', null, null);
ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2;
diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl
index 484d9265b83..86d2134ef54 100644
--- a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl
+++ b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl
@@ -167,8 +167,8 @@ CREATE TABLE "EVENTS" (
"RESOURCE_ID" INTEGER,
"SNAPSHOT_ID" INTEGER,
"CATEGORY" VARCHAR(50),
- "EVENT_DATE" TIMESTAMP,
- "CREATED_AT" TIMESTAMP,
+ "EVENT_DATE" BIGINT NOT NULL,
+ "CREATED_AT" BIGINT NOT NULL,
"DESCRIPTION" VARCHAR(4000),
"EVENT_DATA" VARCHAR(4000)
);
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index c683d372e66..fe991e780d1 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -2884,7 +2884,13 @@ component_viewer.workspace.hide_workspace=Hide workspace
source_viewer.covered=Covered
source_viewer.not_covered=Not covered
source_viewer.conditions=conditions
-source_viewer.expand_duplications=Click to display more in details all the duplicated blocks of this file
+
+source_viewer.tooltip.duplicated_line=This line is duplicated. Click to see duplicated blocks.
+source_viewer.tooltip.duplicated_block=Duplicated block. Click for details.
+source_viewer.tooltip.covered=Fully covered by tests. Click for details.
+source_viewer.tooltip.partially-covered=Partially covered by tests. Click for details.
+source_viewer.tooltip.uncovered=Not covered by tests.
+source_viewer.tooltip.new_code=New {0}.
#------------------------------------------------------------------------------
diff --git a/sonar-core/src/test/java/org/sonar/core/purge/PurgeCommandsTest.java b/sonar-core/src/test/java/org/sonar/core/purge/PurgeCommandsTest.java
index d7d285e42fa..693ea65a447 100644
--- a/sonar-core/src/test/java/org/sonar/core/purge/PurgeCommandsTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/purge/PurgeCommandsTest.java
@@ -115,12 +115,10 @@ public class PurgeCommandsTest extends AbstractDaoTestCase {
@Test
public void shouldDeleteResource() {
setupData("shouldDeleteResource");
- SqlSession session = getMyBatis().openSession();
- try {
+ try (SqlSession session = getMyBatis().openSession()) {
new PurgeCommands(session, profiler).deleteResources(newArrayList(new IdUuidPair(1L, "1")));
- } finally {
- MyBatis.closeQuietly(session);
}
+
assertEmptyTables("projects", "snapshots", "events", "issues", "issue_changes", "authors");
}
diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteResource.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteResource.xml
index e7d8f49a2b4..2f30df757d0 100644
--- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteResource.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteResource.xml
@@ -16,7 +16,7 @@
version="[null]" path="[null]"/>
<events id="1" name="Version 1.0" resource_id="1" snapshot_id="1" category="VERSION" description="[null]"
- event_date="2008-12-02 13:58:00.00" created_at="[null]" event_data="[null]"/>
+ event_date="1228222680000" created_at="1228222680000" event_data="[null]"/>
<issues id="1" kee="ABCDE" component_uuid="1" project_uuid="1" status="CLOSED" resolution="[null]" line="200"
severity="BLOCKER"
diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml
index 3bac29d413a..f7a0a3a81b3 100644
--- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml
@@ -26,7 +26,7 @@
parent_dependency_id="[null]" project_snapshot_id="1"
dep_usage="USES" dep_weight="1" from_scope="PRJ" to_scope="LIB"/>
<events id="1" name="Version 1.0" resource_id="1" snapshot_id="1" category="VERSION" description="[null]"
- event_date="2008-12-02 13:58:00.00" created_at="[null]" event_data="[null]"/>
+ event_date="1228222680000" created_at="1228222680000" event_data="[null]"/>
<duplications_index id="1" project_snapshot_id="1" snapshot_id="1" hash="bb" index_in_file="0" start_line="0"
end_line="0"/>
</dataset>
diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml
index 8fd273d1c08..45eaee58163 100644
--- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml
@@ -25,7 +25,7 @@
parent_dependency_id="[null]" project_snapshot_id="1"
dep_usage="USES" dep_weight="1" from_scope="PRJ" to_scope="LIB"/>
<events id="1" name="Version 1.0" resource_id="1" snapshot_id="1" category="VERSION" description="[null]"
- event_date="2008-12-02 13:58:00.00" created_at="[null]" event_data="[null]"/>
+ event_date="1228222680000" created_at="1228222680000" event_data="[null]"/>
<duplications_index id="1" project_snapshot_id="1" snapshot_id="1" hash="bb" index_in_file="0" start_line="0"
end_line="0"/>
@@ -58,7 +58,7 @@
parent_dependency_id="[null]" project_snapshot_id="5"
dep_usage="USES" dep_weight="1" from_scope="PRJ" to_scope="LIB"/>
<events id="2" name="Version 1.0" resource_id="5" snapshot_id="5" category="VERSION" description="[null]"
- event_date="2008-12-02 13:58:00.00" created_at="[null]" event_data="[null]"/>
+ event_date="1228222680000" created_at="1228222680000" event_data="[null]"/>
<duplications_index id="2" project_snapshot_id="5" snapshot_id="5" hash="bb" index_in_file="0" start_line="0"
end_line="0"/>
diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml
index bcd5544b9f6..4a45a7fc405 100644
--- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml
@@ -42,8 +42,8 @@ Note that measures, events and reviews are not deleted.
<!--dep_usage="USES" dep_weight="1" from_scope="LIB" to_scope="PRJ"/>-->
<events id="1" resource_id="1" snapshot_id="1"
- category="VERSION" description="[null]" name="Version 1.0" event_date="2008-12-02 13:58:00.00"
- created_at="[null]"
+ category="VERSION" description="[null]" name="Version 1.0" event_date="1228222680000"
+ created_at="1228222680000"
event_data="[null]"/>
<!--<duplications_index id="1" project_snapshot_id="1" snapshot_id="1"-->
@@ -81,8 +81,8 @@ Note that measures, events and reviews are not deleted.
dep_usage="USES" dep_weight="1" from_scope="LIB" to_scope="PRJ"/>
<events id="2" resource_id="2" snapshot_id="2"
- category="VERSION" description="[null]" name="Version 1.0" event_date="2008-12-02 13:58:00.00"
- created_at="[null]"
+ category="VERSION" description="[null]" name="Version 1.0" event_date="1228222680000"
+ created_at="1228222680000"
event_data="[null]"/>
<duplications_index id="2" project_snapshot_id="2" snapshot_id="2"
diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml
index 5a576b3edf8..6c6e5bd44c2 100644
--- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml
@@ -27,8 +27,8 @@
dep_usage="USES" dep_weight="1" from_scope="LIB" to_scope="PRJ"/>
<events id="1" resource_id="1" snapshot_id="1"
- category="VERSION" description="[null]" name="Version 1.0" event_date="2008-12-02 13:58:00.00"
- created_at="[null]"
+ category="VERSION" description="[null]" name="Version 1.0" event_date="1228222680000"
+ created_at="1228222680000"
event_data="[null]"/>
<duplications_index id="1" project_snapshot_id="1" snapshot_id="1"
@@ -65,8 +65,8 @@
dep_usage="USES" dep_weight="1" from_scope="LIB" to_scope="PRJ"/>
<events id="2" resource_id="2" snapshot_id="2"
- category="VERSION" description="[null]" name="Version 1.0" event_date="2008-12-02 13:58:00.00"
- created_at="[null]"
+ category="VERSION" description="[null]" name="Version 1.0" event_date="1228222680000"
+ created_at="1228222680000"
event_data="[null]"/>
<duplications_index id="2" project_snapshot_id="2" snapshot_id="2"
diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldSelectPurgeableSnapshots.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldSelectPurgeableSnapshots.xml
index f3a3b9bd0b3..78e14ead2a7 100644
--- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldSelectPurgeableSnapshots.xml
+++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldSelectPurgeableSnapshots.xml
@@ -56,7 +56,7 @@
depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" version="[null]" path="[null]"/>
<events id="2" resource_id="1" snapshot_id="5"
- category="Version" description="[null]" name="Version 1.0" event_date="2008-12-02 13:58:00.00" created_at="[null]"
+ category="Version" description="[null]" name="Version 1.0" event_date="1228222680000" created_at="1228222680000"
event_data="[null]"/>
</dataset>