From 536562976dad7425fcb546736eaa6e463c8032a9 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Tue, 14 Feb 2012 16:36:24 +0100 Subject: SONAR-3208 complete database tables * add PROJECTS.PERSON_ID * create the table AUTHORS --- .../security/RoleManagerTest/sharedFixture.xml | 2 +- .../ViolationPersisterDecoratorTest/shared.xml | 2 +- ...opyPermanentIdFromReferenceViolation-result.xml | 2 +- .../shouldSaveViolations-result.xml | 2 +- .../sonar/plugins/dbcleaner/DefaultPurgeTask.java | 2 +- .../plugins/dbcleaner/DefaultPurgeTaskTest.java | 8 +-- .../api/PurgeUtilsTest/purgeSnapshots-result.xml | 8 +-- .../api/PurgeUtilsTest/purgeSnapshots.xml | 8 +-- .../loadMeasuresFromDate.xml | 4 +- .../ProjectConfiguratorTest/isLatestAnalysis.xml | 2 +- .../isLatestAnalysisIfNeverAnalysed.xml | 2 +- .../isNotLatestAnalysis.xml | 2 +- .../components/PastMeasuresLoaderTest/shared.xml | 6 +- .../PastSnapshotFinderByDateTest/shared.xml | 2 +- .../PastSnapshotFinderByDaysTest/shared.xml | 6 +- .../shouldNotFindSelf.xml | 6 +- .../shouldFindPreviousAnalysis.xml | 2 +- .../shouldNotFindPreviousAnalysis.xml | 2 +- .../PastSnapshotFinderByVersionTest/shared.xml | 2 +- .../TimeMachineConfigurationTest/shared.xml | 6 +- .../index/DefaultResourcePersisterTest/shared.xml | 2 +- .../shouldSaveNewDirectory-result.xml | 6 +- .../shouldSaveNewLibrary-result.xml | 6 +- .../shouldSaveNewMultiModulesProject-result.xml | 10 +-- .../shouldSaveNewProject-result.xml | 4 +- .../shouldUpdateExistingResource-result.xml | 2 +- .../shouldUpdateExistingResource.xml | 2 +- .../batch/index/MeasurePersisterTest/shared.xml | 6 +- .../shouldDelaySaving-result.xml | 6 +- .../shouldInsertMeasure-result.xml | 6 +- ...otDelaySavingWithDatabaseOnlyMeasure-result.xml | 6 +- .../shouldUpdateMeasure-result.xml | 6 +- .../batch/index/SourcePersisterTest/shared.xml | 2 +- .../shouldSaveSource-result.xml | 2 +- .../phases/UpdateStatusJobTest/sharedFixture.xml | 10 +-- .../org/sonar/core/persistence/DatabaseUtils.java | 1 + .../java/org/sonar/jpa/entity/SchemaMigration.java | 2 +- .../org/sonar/core/persistence/rows-derby.sql | 3 + .../org/sonar/core/persistence/schema-derby.ddl | 10 ++- .../java/org/sonar/core/purge/PurgeDaoTest.java | 6 +- .../purge/PurgeDaoTest/shouldDeleteProject.xml | 8 +-- .../purge/PurgeDaoTest/shouldDeleteResource.xml | 2 +- ...dDisableResourcesWithoutLastSnapshot-result.xml | 6 +- .../shouldDisableResourcesWithoutLastSnapshot.xml | 6 +- .../shouldPurgeDirectoriesAndFiles-result.xml | 6 +- .../shouldPurgeDirectoriesAndFiles.xml | 6 +- .../PurgeDaoTest/shouldPurgeProject-result.xml | 2 +- .../core/purge/PurgeDaoTest/shouldPurgeProject.xml | 2 +- .../core/resource/ResourceDaoTest/fixture.xml | 8 +-- .../shouldIndexMultiModulesProject-result.xml | 8 +-- .../shouldIndexMultiModulesProject.xml | 8 +-- .../shouldIndexProjects-result.xml | 6 +- .../ResourceIndexerDaoTest/shouldIndexProjects.xml | 6 +- .../shouldReindexProjectAfterRenaming-result.xml | 2 +- .../shouldReindexProjectAfterRenaming.xml | 2 +- .../sonar/api/database/model/ResourceModel.java | 73 ++++++++++++++-------- .../db/migrate/259_rename_action_plans_columns.rb | 30 --------- .../db/migrate/259_rename_action_plans_deadline.rb | 30 +++++++++ .../db/migrate/261_add_projects_person_id.rb | 30 +++++++++ .../WEB-INF/db/migrate/262_create_authors.rb | 34 ++++++++++ .../server/filters/FilterExecutorTest/measures.xml | 4 +- .../server/filters/FilterExecutorTest/shared.xml | 6 +- .../server/filters/FilterExecutorTest/views.xml | 6 +- .../platform/ServerSettingsTest/db/shared.xml | 2 +- 64 files changed, 282 insertions(+), 185 deletions(-) delete mode 100644 sonar-server/src/main/webapp/WEB-INF/db/migrate/259_rename_action_plans_columns.rb create mode 100644 sonar-server/src/main/webapp/WEB-INF/db/migrate/259_rename_action_plans_deadline.rb create mode 100644 sonar-server/src/main/webapp/WEB-INF/db/migrate/261_add_projects_person_id.rb create mode 100644 sonar-server/src/main/webapp/WEB-INF/db/migrate/262_create_authors.rb diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/RoleManagerTest/sharedFixture.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/RoleManagerTest/sharedFixture.xml index a9c48393d40..861917acf7c 100644 --- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/RoleManagerTest/sharedFixture.xml +++ b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/security/RoleManagerTest/sharedFixture.xml @@ -2,6 +2,6 @@ \ No newline at end of file diff --git a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shared.xml b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shared.xml index 26db515cf22..039debd839a 100644 --- a/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shared.xml +++ b/plugins/sonar-core-plugin/src/test/resources/org/sonar/plugins/core/timemachine/ViolationPersisterDecoratorTest/shared.xml @@ -13,7 +13,7 @@ + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + description="[null]" enabled="true" profile_id="[null]" language="java" copy_resource_id="[null]" person_id="[null]"/> + description="[null]" enabled="true" profile_id="[null]" language="java" copy_resource_id="[null]" person_id="[null]"/> diff --git a/sonar-batch/src/test/resources/org/sonar/batch/ProjectConfiguratorTest/isLatestAnalysis.xml b/sonar-batch/src/test/resources/org/sonar/batch/ProjectConfiguratorTest/isLatestAnalysis.xml index 6b0e7bb6e6e..de187166907 100644 --- a/sonar-batch/src/test/resources/org/sonar/batch/ProjectConfiguratorTest/isLatestAnalysis.xml +++ b/sonar-batch/src/test/resources/org/sonar/batch/ProjectConfiguratorTest/isLatestAnalysis.xml @@ -3,7 +3,7 @@ + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> diff --git a/sonar-batch/src/test/resources/org/sonar/batch/components/PastSnapshotFinderByDateTest/shared.xml b/sonar-batch/src/test/resources/org/sonar/batch/components/PastSnapshotFinderByDateTest/shared.xml index 3914489d920..2d07a1dda77 100644 --- a/sonar-batch/src/test/resources/org/sonar/batch/components/PastSnapshotFinderByDateTest/shared.xml +++ b/sonar-batch/src/test/resources/org/sonar/batch/components/PastSnapshotFinderByDateTest/shared.xml @@ -3,7 +3,7 @@ + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> diff --git a/sonar-batch/src/test/resources/org/sonar/batch/components/PastSnapshotFinderByDaysTest/shared.xml b/sonar-batch/src/test/resources/org/sonar/batch/components/PastSnapshotFinderByDaysTest/shared.xml index eb07ea0f0c5..4a2fc84eb3c 100644 --- a/sonar-batch/src/test/resources/org/sonar/batch/components/PastSnapshotFinderByDaysTest/shared.xml +++ b/sonar-batch/src/test/resources/org/sonar/batch/components/PastSnapshotFinderByDaysTest/shared.xml @@ -4,19 +4,19 @@ + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> diff --git a/sonar-batch/src/test/resources/org/sonar/batch/components/PastSnapshotFinderByDaysTest/shouldNotFindSelf.xml b/sonar-batch/src/test/resources/org/sonar/batch/components/PastSnapshotFinderByDaysTest/shouldNotFindSelf.xml index 30b4fd235ab..a62a55c49dd 100644 --- a/sonar-batch/src/test/resources/org/sonar/batch/components/PastSnapshotFinderByDaysTest/shouldNotFindSelf.xml +++ b/sonar-batch/src/test/resources/org/sonar/batch/components/PastSnapshotFinderByDaysTest/shouldNotFindSelf.xml @@ -4,19 +4,19 @@ + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> diff --git a/sonar-batch/src/test/resources/org/sonar/batch/components/PastSnapshotFinderByPreviousAnalysisTest/shouldFindPreviousAnalysis.xml b/sonar-batch/src/test/resources/org/sonar/batch/components/PastSnapshotFinderByPreviousAnalysisTest/shouldFindPreviousAnalysis.xml index f5edd855a07..f6e905101a6 100644 --- a/sonar-batch/src/test/resources/org/sonar/batch/components/PastSnapshotFinderByPreviousAnalysisTest/shouldFindPreviousAnalysis.xml +++ b/sonar-batch/src/test/resources/org/sonar/batch/components/PastSnapshotFinderByPreviousAnalysisTest/shouldFindPreviousAnalysis.xml @@ -3,7 +3,7 @@ + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> diff --git a/sonar-batch/src/test/resources/org/sonar/batch/components/PastSnapshotFinderByVersionTest/shared.xml b/sonar-batch/src/test/resources/org/sonar/batch/components/PastSnapshotFinderByVersionTest/shared.xml index c414b95daa4..98c40a5fc53 100644 --- a/sonar-batch/src/test/resources/org/sonar/batch/components/PastSnapshotFinderByVersionTest/shared.xml +++ b/sonar-batch/src/test/resources/org/sonar/batch/components/PastSnapshotFinderByVersionTest/shared.xml @@ -3,7 +3,7 @@ + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> diff --git a/sonar-batch/src/test/resources/org/sonar/batch/components/TimeMachineConfigurationTest/shared.xml b/sonar-batch/src/test/resources/org/sonar/batch/components/TimeMachineConfigurationTest/shared.xml index 5e53bd405e7..65c8a495038 100644 --- a/sonar-batch/src/test/resources/org/sonar/batch/components/TimeMachineConfigurationTest/shared.xml +++ b/sonar-batch/src/test/resources/org/sonar/batch/components/TimeMachineConfigurationTest/shared.xml @@ -1,12 +1,12 @@ + root_id="[null]" description="[null]" enabled="true" profile_id="[null]" language="java" copy_resource_id="[null]" person_id="[null]"/> + root_id="[null]" description="[null]" enabled="true" profile_id="[null]" language="java" copy_resource_id="[null]" person_id="[null]"/> + root_id="2" description="[null]" enabled="true" profile_id="[null]" language="java" copy_resource_id="[null]" person_id="[null]"/> diff --git a/sonar-batch/src/test/resources/org/sonar/batch/index/DefaultResourcePersisterTest/shared.xml b/sonar-batch/src/test/resources/org/sonar/batch/index/DefaultResourcePersisterTest/shared.xml index 61455e2ca4c..b0d3176964b 100644 --- a/sonar-batch/src/test/resources/org/sonar/batch/index/DefaultResourcePersisterTest/shared.xml +++ b/sonar-batch/src/test/resources/org/sonar/batch/index/DefaultResourcePersisterTest/shared.xml @@ -3,7 +3,7 @@ + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="[null]" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> \ No newline at end of file diff --git a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseUtils.java b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseUtils.java index 814c1ee26e2..781f8691f84 100644 --- a/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseUtils.java +++ b/sonar-core/src/main/java/org/sonar/core/persistence/DatabaseUtils.java @@ -46,6 +46,7 @@ public final class DatabaseUtils { "active_rule_parameters", "active_rule_param_changes", "alerts", + "authors", "characteristics", "characteristic_edges", "characteristic_properties", diff --git a/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java b/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java index 1d01411d815..610d9586c5a 100644 --- a/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java +++ b/sonar-core/src/main/java/org/sonar/jpa/entity/SchemaMigration.java @@ -34,7 +34,7 @@ public class SchemaMigration { public final static int VERSION_UNKNOWN = -1; - public static final int LAST_VERSION = 260; + public static final int LAST_VERSION = 262; public static final int VERSION_2_13 = 241; public final static String TABLE_NAME = "schema_migrations"; diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-derby.sql b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-derby.sql index 59c4d9f02cd..1038bf1ddc2 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/rows-derby.sql +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/rows-derby.sql @@ -177,6 +177,9 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('256'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('257'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('258'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('259'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('260'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('261'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('262'); 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', '2011-09-26 22:27:48.0', '2011-09-26 22:27:48.0', null, null); ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2; diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-derby.ddl b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-derby.ddl index 2de07173e61..e301e098883 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-derby.ddl +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-derby.ddl @@ -295,7 +295,8 @@ CREATE TABLE "PROJECTS" ( "PROFILE_ID" INTEGER, "LANGUAGE" VARCHAR(5), "COPY_RESOURCE_ID" INTEGER, - "LONG_NAME" VARCHAR(256) + "LONG_NAME" VARCHAR(256), + "PERSON_ID" INTEGER ); CREATE TABLE "REVIEWS" ( @@ -507,6 +508,13 @@ CREATE TABLE "RULE_NOTES" ( "UPDATED_AT" TIMESTAMP ); +CREATE TABLE "AUTHORS" ( + "PERSON_ID" INTEGER, + "COMMITTER" VARCHAR(100), + "CREATED_AT" TIMESTAMP, + "UPDATED_AT" TIMESTAMP +); + -- ---------------------------------------------- -- DDL Statements for indexes diff --git a/sonar-core/src/test/java/org/sonar/core/purge/PurgeDaoTest.java b/sonar-core/src/test/java/org/sonar/core/purge/PurgeDaoTest.java index 2c9dd6299a8..37bdba4d99a 100644 --- a/sonar-core/src/test/java/org/sonar/core/purge/PurgeDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/purge/PurgeDaoTest.java @@ -120,21 +120,21 @@ public class PurgeDaoTest extends DaoTestCase { @Test public void shouldPurgeProject() { setupData("shouldPurgeProject"); - dao.purgeProject(1, new String[0]); + dao.purge(1, new String[0]); checkTables("shouldPurgeProject", "projects", "snapshots"); } @Test public void shouldPurgeDirectoriesAndFiles() { setupData("shouldPurgeDirectoriesAndFiles"); - dao.purgeProject(1, new String[]{Scopes.DIRECTORY, Scopes.FILE}); + dao.purge(1, new String[]{Scopes.DIRECTORY, Scopes.FILE}); checkTables("shouldPurgeDirectoriesAndFiles", "projects", "snapshots"); } @Test public void shouldDisableResourcesWithoutLastSnapshot() { setupData("shouldDisableResourcesWithoutLastSnapshot"); - dao.purgeProject(1, new String[0]); + dao.purge(1, new String[0]); checkTables("shouldDisableResourcesWithoutLastSnapshot", "projects", "snapshots"); } diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldDeleteProject.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldDeleteProject.xml index 1d434ed08c6..e5e94801418 100644 --- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldDeleteProject.xml +++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldDeleteProject.xml @@ -3,7 +3,7 @@ + description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> + root_id="[null]" description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldPurgeProject.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldPurgeProject.xml index 55682016a04..3ad298bd6b9 100644 --- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldPurgeProject.xml +++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeDaoTest/shouldPurgeProject.xml @@ -3,7 +3,7 @@ + root_id="[null]" description="[null]" language="java" copy_resource_id="[null]" person_id="[null]" profile_id="[null]"/> diff --git a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/fixture.xml b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/fixture.xml index 41ab615c627..a993fe82a6f 100644 --- a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/fixture.xml +++ b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceDaoTest/fixture.xml @@ -3,7 +3,7 @@ + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> + description="[null]" enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> diff --git a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexMultiModulesProject.xml b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexMultiModulesProject.xml index 33fcdb11728..820d4a95e59 100644 --- a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexMultiModulesProject.xml +++ b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexMultiModulesProject.xml @@ -4,24 +4,24 @@ + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> diff --git a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexProjects-result.xml b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexProjects-result.xml index 2aca7a20445..c7484ec4a2a 100644 --- a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexProjects-result.xml +++ b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexProjects-result.xml @@ -4,20 +4,20 @@ + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> diff --git a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexProjects.xml b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexProjects.xml index 87e14d537a7..5388b78865a 100644 --- a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexProjects.xml +++ b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexProjects.xml @@ -4,19 +4,19 @@ + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> diff --git a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldReindexProjectAfterRenaming-result.xml b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldReindexProjectAfterRenaming-result.xml index 30cf6f02ba7..4909ab38144 100644 --- a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldReindexProjectAfterRenaming-result.xml +++ b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldReindexProjectAfterRenaming-result.xml @@ -3,7 +3,7 @@ + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> diff --git a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldReindexProjectAfterRenaming.xml b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldReindexProjectAfterRenaming.xml index dfce65c8413..fae54763976 100644 --- a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldReindexProjectAfterRenaming.xml +++ b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldReindexProjectAfterRenaming.xml @@ -3,7 +3,7 @@ + enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/ResourceModel.java b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/ResourceModel.java index 8109987704d..86bd05ef823 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/database/model/ResourceModel.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/database/model/ResourceModel.java @@ -77,6 +77,9 @@ public class ResourceModel extends BaseIdentifiable implements Cloneable { @Column(name = "copy_resource_id", updatable = true, nullable = true) private Integer copyResourceId; + @Column(name = "person_id", updatable = true, nullable = true) + private Integer personId; + @OneToMany(mappedBy = "resource", fetch = FetchType.LAZY, cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REMOVE}) @BatchSize(size = 8) private List projectLinks = new ArrayList(); @@ -94,11 +97,11 @@ public class ResourceModel extends BaseIdentifiable implements Cloneable { /** *

Creates a resource model

* - * @param scope the scope the rule will apply on - * @param key the rule key. This is the name of the resource, including the path + * @param scope the scope the rule will apply on + * @param key the rule key. This is the name of the resource, including the path * @param qualifier the resource qualifier - * @param rootId the rootId for the resource - * @param name the short name of the resource + * @param rootId the rootId for the resource + * @param name the short name of the resource */ public ResourceModel(String scope, String key, String qualifier, Integer rootId, String name) { this.scope = scope; @@ -154,7 +157,7 @@ public class ResourceModel extends BaseIdentifiable implements Cloneable { */ public void setName(String name) { this.name = StringUtils.abbreviate(name, NAME_COLUMN_SIZE); - if (this.longName==null) { + if (this.longName == null) { this.longName = this.name; } } @@ -206,8 +209,24 @@ public class ResourceModel extends BaseIdentifiable implements Cloneable { return copyResourceId; } - public void setCopyResourceId(Integer copyResourceId) { - this.copyResourceId = copyResourceId; + public ResourceModel setCopyResourceId(Integer i) { + this.copyResourceId = i; + return this; + } + + /** + * @since 2.14 + */ + public Integer getPersonId() { + return personId; + } + + /** + * @since 2.14 + */ + public ResourceModel setPersonId(Integer i) { + this.personId = i; + return this; } /** @@ -254,35 +273,36 @@ public class ResourceModel extends BaseIdentifiable implements Cloneable { } ResourceModel other = (ResourceModel) obj; return new EqualsBuilder() - .append(key, other.key) - .append(enabled, other.enabled) - .append(rootId, other.rootId) - .isEquals(); + .append(key, other.key) + .append(enabled, other.enabled) + .append(rootId, other.rootId) + .isEquals(); } @Override public int hashCode() { return new HashCodeBuilder(17, 37) - .append(key) - .append(enabled) - .append(rootId) - .toHashCode(); + .append(key) + .append(enabled) + .append(rootId) + .toHashCode(); } @Override public String toString() { return new ToStringBuilder(this) - .append("id", getId()) - .append("key", key) - .append("scope", scope) - .append("qualifier", qualifier) - .append("name", name) - .append("longName", longName) - .append("lang", languageKey) - .append("enabled", enabled) - .append("rootId", rootId) - .append("copyResourceId", copyResourceId) - .toString(); + .append("id", getId()) + .append("key", key) + .append("scope", scope) + .append("qualifier", qualifier) + .append("name", name) + .append("longName", longName) + .append("lang", languageKey) + .append("enabled", enabled) + .append("rootId", rootId) + .append("copyResourceId", copyResourceId) + .append("personId", personId) + .toString(); } @Override @@ -295,6 +315,7 @@ public class ResourceModel extends BaseIdentifiable implements Cloneable { clone.setLanguageKey(getLanguageKey()); clone.setCopyResourceId(getCopyResourceId()); clone.setLongName(getLongName()); + clone.setPersonId(getPersonId()); return clone; } diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/259_rename_action_plans_columns.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/259_rename_action_plans_columns.rb deleted file mode 100644 index 9ea0116032b..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/259_rename_action_plans_columns.rb +++ /dev/null @@ -1,30 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2012 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar 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. -# -# Sonar 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 Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# - -# -# Sonar 2.14 -# -class RenameActionPlansColumns < ActiveRecord::Migration - - def self.up - rename_column(:action_plans, :dead_line, :deadline) - end - -end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/259_rename_action_plans_deadline.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/259_rename_action_plans_deadline.rb new file mode 100644 index 00000000000..d9b9b5200fe --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/259_rename_action_plans_deadline.rb @@ -0,0 +1,30 @@ +# +# Sonar, entreprise quality control tool. +# Copyright (C) 2008-2012 SonarSource +# mailto:contact AT sonarsource DOT com +# +# Sonar 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. +# +# Sonar 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 Sonar; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 +# + +# +# Sonar 2.14 +# +class RenameActionPlansDeadline < ActiveRecord::Migration + + def self.up + rename_column(:action_plans, :dead_line, :deadline) + end + +end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/261_add_projects_person_id.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/261_add_projects_person_id.rb new file mode 100644 index 00000000000..a6512b007c7 --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/261_add_projects_person_id.rb @@ -0,0 +1,30 @@ +# +# Sonar, entreprise quality control tool. +# Copyright (C) 2008-2012 SonarSource +# mailto:contact AT sonarsource DOT com +# +# Sonar 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. +# +# Sonar 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 Sonar; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 +# + +# +# Sonar 2.14 +# +class AddProjectsPersonId < ActiveRecord::Migration + + def self.up + add_column 'projects', 'person_id', :integer, :null => true + end + +end diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/262_create_authors.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/262_create_authors.rb new file mode 100644 index 00000000000..f43c3b4a909 --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/262_create_authors.rb @@ -0,0 +1,34 @@ +# +# Sonar, entreprise quality control tool. +# Copyright (C) 2008-2012 SonarSource +# mailto:contact AT sonarsource DOT com +# +# Sonar 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. +# +# Sonar 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 Sonar; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 +# + +# +# Sonar 2.14 +# +class CreateAuthors < ActiveRecord::Migration + + def self.up + create_table 'authors', :id => false do |t| + t.column 'person_id', :integer, :null => false + t.column 'committer', :string, :null => true, :limit => 100 + t.timestamps + end + end + +end diff --git a/sonar-server/src/test/resources/org/sonar/server/filters/FilterExecutorTest/measures.xml b/sonar-server/src/test/resources/org/sonar/server/filters/FilterExecutorTest/measures.xml index bdc9bb389b9..daf3a4cf609 100644 --- a/sonar-server/src/test/resources/org/sonar/server/filters/FilterExecutorTest/measures.xml +++ b/sonar-server/src/test/resources/org/sonar/server/filters/FilterExecutorTest/measures.xml @@ -15,11 +15,11 @@ + description="[null]" enabled="true" profile_id="[null]" language="java" copy_resource_id="[null]" person_id="[null]"/> + description="[null]" enabled="true" profile_id="[null]" language="java" copy_resource_id="[null]" person_id="[null]"/> + description="[null]" enabled="true" profile_id="[null]" language="java" copy_resource_id="[null]" person_id="[null]"/> + description="[null]" enabled="true" profile_id="[null]" language="php" copy_resource_id="[null]" person_id="[null]"/> + description="[null]" enabled="true" profile_id="[null]" language="java" copy_resource_id="[null]" person_id="[null]"/> diff --git a/sonar-server/src/test/resources/org/sonar/server/filters/FilterExecutorTest/views.xml b/sonar-server/src/test/resources/org/sonar/server/filters/FilterExecutorTest/views.xml index ae1441dd900..aac9b0863b0 100644 --- a/sonar-server/src/test/resources/org/sonar/server/filters/FilterExecutorTest/views.xml +++ b/sonar-server/src/test/resources/org/sonar/server/filters/FilterExecutorTest/views.xml @@ -2,16 +2,16 @@ + description="[null]" enabled="true" profile_id="[null]" language="java" copy_resource_id="[null]" person_id="[null]"/> + description="[null]" enabled="true" profile_id="[null]" language="[null]" copy_resource_id="[null]" person_id="[null]"/> + description="[null]" enabled="true" profile_id="[null]" language="[null]" copy_resource_id="[null]" person_id="[null]"/> + enabled="true" language="java" copy_resource_id="[null]" person_id="[null]"/> -- cgit v1.2.3