From fc5c4eb0759899611099798d3704c71fc4f875d1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Lesaint?= Date: Tue, 7 Jun 2016 18:35:06 +0200 Subject: [PATCH] SONAR-7692 support uuid columns in resource_index --- .../src/test/java/it/dbCleaner/PurgeTest.java | 4 +- .../server/component/ComponentService.java | 2 +- .../server/measure/MeasureFilterSql.java | 2 +- .../java/org/sonar/server/ui/JRubyFacade.java | 11 +-- .../server/ce/ws/ActivityActionTest.java | 14 ++-- ...urn_only_authorized_projects_from_view.xml | 6 +- .../SearchViewComponentsActionTest/shared.xml | 6 +- ...e_when_filter_by_component_name_or_key.xml | 8 +-- .../MeasureFilterExecutorTest/shared.xml | 26 +++---- .../controllers/api/components_controller.rb | 16 ++--- .../controllers/api/resources_controller.rb | 10 +-- .../main/webapp/WEB-INF/app/models/project.rb | 2 +- .../WEB-INF/app/models/resource_index.rb | 7 +- .../sonar/db/component/ResourceIndexDao.java | 67 +++++++------------ .../sonar/db/component/ResourceIndexDto.java | 20 +++--- .../db/component/ResourceIndexMapper.java | 6 +- .../org/sonar/db/purge/PurgeCommands.java | 4 +- .../java/org/sonar/db/purge/PurgeDao.java | 2 +- .../java/org/sonar/db/purge/PurgeMapper.java | 2 +- .../sonar/db/component/ComponentMapper.xml | 13 ++-- .../db/component/ResourceIndexMapper.xml | 39 ++++++----- .../org/sonar/db/purge/PurgeMapper.xml | 6 +- .../ProjectQgateAssociationMapper.xml | 2 +- .../sonar/db/component/ComponentDbTester.java | 6 +- .../db/component/ResourceIndexDaoTest.java | 40 ++++++----- .../v52/IncreasePrecisionOfNumericsTest.java | 20 +++++- ...s_from_query_and_view_or_sub_view_uuid.xml | 36 +++++----- .../shouldIndexMultiModulesProject-result.xml | 58 ++++++++-------- .../shouldIndexResource-result.xml | 14 ++-- ...ouldIndexTwoLettersLongResource-result.xml | 4 +- ...ouldNotReindexUnchangedResource-result.xml | 10 +-- .../shouldNotReindexUnchangedResource.xml | 10 +-- ...eIndexNewTwoLettersLongResource-result.xml | 4 +- ...shouldReIndexNewTwoLettersLongResource.xml | 8 +-- ...ldReIndexTwoLettersLongResource-result.xml | 4 +- .../shouldReIndexTwoLettersLongResource.xml | 2 +- ...ouldReindexProjectAfterRenaming-result.xml | 22 +++--- .../shouldReindexProjectAfterRenaming.xml | 8 +-- .../shouldReindexResource-result.xml | 18 ++--- .../shouldReindexResource.xml | 10 +-- .../ProjectQgateAssociationDaoTest/shared.xml | 34 +++++----- 41 files changed, 291 insertions(+), 292 deletions(-) diff --git a/it/it-tests/src/test/java/it/dbCleaner/PurgeTest.java b/it/it-tests/src/test/java/it/dbCleaner/PurgeTest.java index b49a6c9a7f3..be1a983e7dc 100644 --- a/it/it-tests/src/test/java/it/dbCleaner/PurgeTest.java +++ b/it/it-tests/src/test/java/it/dbCleaner/PurgeTest.java @@ -291,12 +291,12 @@ public class PurgeTest { private void assertDeleted(String key) { assertThat(count("snapshots s where s.project_id=(select p.id from projects p where p.kee='" + key + "')")).isZero(); - assertThat(count("resource_index ri where ri.resource_id=(select p.id from projects p where p.kee='" + key + "')")).isZero(); + assertThat(count("resource_index ri where ri.component_uuid=(select p.uuid from projects p where p.kee='" + key + "')")).isZero(); } private void assertSingleSnapshot(String key) { assertThat(count("snapshots s where s.project_id=(select p.id from projects p where p.kee='" + key + "')")).isEqualTo(1); - assertThat(count("resource_index ri where ri.resource_id=(select p.id from projects p where p.kee='" + key + "')")).isGreaterThan(1); + assertThat(count("resource_index ri where ri.component_uuid=(select p.uuid from projects p where p.kee='" + key + "')")).isGreaterThan(1); } private BuildResult scan(String path, String date) { diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/ComponentService.java b/server/sonar-server/src/main/java/org/sonar/server/component/ComponentService.java index 3329cebd8e6..670dfea5f9c 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/ComponentService.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/ComponentService.java @@ -196,7 +196,7 @@ public class ComponentService { .setQualifier(newComponent.qualifier()) .setCreatedAt(new Date(system2.now())); dbClient.componentDao().insert(session, component); - dbClient.componentIndexDao().indexResource(session, component.getId()); + dbClient.componentIndexDao().indexResource(session, component.uuid()); session.commit(); return component; } diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterSql.java b/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterSql.java index 33ee397013b..c2ee2b6aed2 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterSql.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/MeasureFilterSql.java @@ -194,7 +194,7 @@ class MeasureFilterSql { private void appendResourceNameCondition(StringBuilder sb) { if (StringUtils.isNotBlank(filter.getResourceName())) { - sb.append(" AND s.project_id IN (SELECT rindex.resource_id FROM resource_index rindex WHERE rindex.kee LIKE '"); + sb.append(" AND p.uuid IN (SELECT rindex.component_uuid FROM resource_index rindex WHERE rindex.kee LIKE '"); sb.append(escapePercentAndUnderscrore(StringEscapeUtils.escapeSql(StringUtils.lowerCase(filter.getResourceName())))); sb.append("%'"); appendEscapeForSomeDb(sb); diff --git a/server/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java b/server/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java index b1a05e4d43b..aafd283563d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java +++ b/server/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java @@ -28,7 +28,6 @@ import java.util.Map; import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.sonar.api.Plugin; -import org.sonar.api.SonarPlugin; import org.sonar.api.config.License; import org.sonar.api.config.PropertyDefinitions; import org.sonar.api.config.Settings; @@ -36,6 +35,7 @@ import org.sonar.api.platform.NewUserHandler; import org.sonar.api.resources.Language; import org.sonar.api.resources.ResourceType; import org.sonar.api.resources.ResourceTypes; +import org.sonar.api.server.authentication.IdentityProvider; import org.sonar.api.utils.log.Loggers; import org.sonar.api.web.Footer; import org.sonar.api.web.Page; @@ -46,12 +46,10 @@ import org.sonar.core.platform.PluginInfo; import org.sonar.core.platform.PluginRepository; import org.sonar.core.timemachine.Periods; import org.sonar.db.Database; -import org.sonar.db.component.ResourceIndexDao; import org.sonar.db.version.DatabaseMigration; import org.sonar.db.version.DatabaseVersion; import org.sonar.process.ProcessProperties; import org.sonar.server.authentication.IdentityProviderRepository; -import org.sonar.api.server.authentication.IdentityProvider; import org.sonar.server.component.ComponentCleanerService; import org.sonar.server.db.migrations.DatabaseMigrator; import org.sonar.server.measure.MeasureFilterEngine; @@ -407,13 +405,6 @@ public final class JRubyFacade { return !database.getDialect().supportsMigration(); } - /** - * Used by Developer Cockpit - */ - public void indexResource(long resourceId) { - get(ResourceIndexDao.class).indexResource(resourceId); - } - public List getIdentityProviders(){ return get(IdentityProviderRepository.class).getAllEnabledAndSorted(); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java index 246d6018109..93b82da9c74 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/ActivityActionTest.java @@ -214,14 +214,14 @@ public class ActivityActionTest { @Test public void search_activity_by_component_name() throws IOException { - ComponentDto struts = newProjectDto().setName("old apache struts").setUuid("P1"); - ComponentDto zookeeper = newProjectDto().setName("new apache zookeeper").setUuid("P2"); - ComponentDto eclipse = newProjectDto().setName("eclipse").setUuid("P3"); + ComponentDto struts = newProjectDto().setName("old apache struts").setUuid("P1").setProjectUuid("P1"); + ComponentDto zookeeper = newProjectDto().setName("new apache zookeeper").setUuid("P2").setProjectUuid("P2"); + ComponentDto eclipse = newProjectDto().setName("eclipse").setUuid("P3").setProjectUuid("P3"); componentDb.insertProjectAndSnapshot(struts); componentDb.insertProjectAndSnapshot(zookeeper); componentDb.insertProjectAndSnapshot(eclipse); dbTester.commit(); - componentDb.indexComponents(struts.getId(), zookeeper.getId(), eclipse.getId()); + componentDb.indexComponents(struts.uuid(), zookeeper.uuid(), eclipse.uuid()); globalAdmin(); insertActivity("T1", "P1", CeActivityDto.Status.SUCCESS); insertActivity("T2", "P2", CeActivityDto.Status.SUCCESS); @@ -234,11 +234,11 @@ public class ActivityActionTest { @Test public void search_activity_returns_views_and_developers() { - ComponentDto developer = newDeveloper("Apache Developer").setUuid("D1"); - ComponentDto apacheView = newView().setName("Apache View").setUuid("V1"); + ComponentDto apacheView = newView().setName("Apache View").setUuid("V1").setProjectUuid("V1"); + ComponentDto developer = newDeveloper("Apache Developer").setUuid("D1").setProjectUuid("D1"); componentDb.insertDeveloperAndSnapshot(developer); componentDb.insertViewAndSnapshot(apacheView); - componentDb.indexComponents(developer.getId(), apacheView.getId()); + componentDb.indexComponents(developer.uuid(), apacheView.uuid()); globalAdmin(); insertActivity("T1", "D1", CeActivityDto.Status.SUCCESS); insertActivity("T2", "V1", CeActivityDto.Status.SUCCESS); diff --git a/server/sonar-server/src/test/resources/org/sonar/server/component/ws/SearchViewComponentsActionTest/return_only_authorized_projects_from_view.xml b/server/sonar-server/src/test/resources/org/sonar/server/component/ws/SearchViewComponentsActionTest/return_only_authorized_projects_from_view.xml index 0b5c0343840..0bf9a7d567e 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/component/ws/SearchViewComponentsActionTest/return_only_authorized_projects_from_view.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/component/ws/SearchViewComponentsActionTest/return_only_authorized_projects_from_view.xml @@ -23,8 +23,8 @@ uuid="KLMN" project_uuid="KLMN" module_uuid="[null]" module_uuid_path="." enabled="[true]" copy_resource_id="[null]" path="[null]"/> - - - + + + diff --git a/server/sonar-server/src/test/resources/org/sonar/server/component/ws/SearchViewComponentsActionTest/shared.xml b/server/sonar-server/src/test/resources/org/sonar/server/component/ws/SearchViewComponentsActionTest/shared.xml index 687ef3d7b14..2f4dbf7348d 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/component/ws/SearchViewComponentsActionTest/shared.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/component/ws/SearchViewComponentsActionTest/shared.xml @@ -28,8 +28,8 @@ uuid="KLMN" project_uuid="KLMN" module_uuid="[null]" module_uuid_path="." enabled="[true]" copy_resource_id="[null]" path="[null]"/> - - - + + + diff --git a/server/sonar-server/src/test/resources/org/sonar/server/measure/MeasureFilterExecutorTest/escape_percent_and_underscore_when_filter_by_component_name_or_key.xml b/server/sonar-server/src/test/resources/org/sonar/server/measure/MeasureFilterExecutorTest/escape_percent_and_underscore_when_filter_by_component_name_or_key.xml index 81112762aab..1436974b82b 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/measure/MeasureFilterExecutorTest/escape_percent_and_underscore_when_filter_by_component_name_or_key.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/measure/MeasureFilterExecutorTest/escape_percent_and_underscore_when_filter_by_component_name_or_key.xml @@ -58,10 +58,10 @@ created_at="1229727600000" build_date="1229727600000" version="1.0" status="P" islast="[true]"/> - - - - + + + + diff --git a/server/sonar-server/src/test/resources/org/sonar/server/measure/MeasureFilterExecutorTest/shared.xml b/server/sonar-server/src/test/resources/org/sonar/server/measure/MeasureFilterExecutorTest/shared.xml index 914567097c2..7adb0a9cefa 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/measure/MeasureFilterExecutorTest/shared.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/measure/MeasureFilterExecutorTest/shared.xml @@ -24,23 +24,23 @@ @@ -128,7 +128,7 @@ @@ -158,15 +158,15 @@ alert_status="[null]" description="[null]" characteristic_id="[null]"/> - - - - + + + + - - - - + + + + diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/components_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/components_controller.rb index 6bc2267382f..cdf63cd52a8 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/components_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/components_controller.rb @@ -32,28 +32,28 @@ class Api::ComponentsController < Api::ApiController additional_escape = dialect == 'oracle' || dialect == 'mssql' ? "ESCAPE '\\'" : '' key = escape_like(search).downcase - results = ResourceIndex.all(:select => 'distinct(resource_id),root_project_id,qualifier,name_size', # optimization to not load unused columns like 'kee' + results = ResourceIndex.all(:select => 'distinct(component_uuid),root_component_uuid,qualifier,name_size', # optimization to not load unused columns like 'kee' :conditions => ['kee like ? ' + additional_escape, key + '%'], :order => 'name_size') results = select_authorized(:user, results) - resource_ids=[] + resource_uuids=[] resource_indexes_by_qualifier={} results.each do |resource_index| qualifier = fix_qualifier(resource_index.qualifier) resource_indexes_by_qualifier[qualifier] ||= [] array = resource_indexes_by_qualifier[qualifier] if array.size < MAX_RESULTS - resource_ids << resource_index.resource_id + resource_uuids << resource_index.component_uuid array << resource_index end end - resources_by_id = {} - unless resource_ids.empty? - Project.find(:all, :conditions => ['id in (?)', resource_ids]).each do |resource| - resources_by_id[resource.id]=resource + resources_by_uuid = {} + unless resource_uuids.empty? + Project.find(:all, :conditions => ['uuid in (?)', resource_uuids]).each do |resource| + resources_by_uuid[resource.uuid]=resource end end @@ -67,7 +67,7 @@ class Api::ComponentsController < Api::ApiController qualifier_results['name']=Api::Utils.message("qualifiers.#{qualifier}") resource_indexes=resource_indexes_by_qualifier[qualifier]||[] qualifier_results['items']=resource_indexes.map do |resource_index| - resource=resources_by_id[resource_index.resource_id] + resource=resources_by_uuid[resource_index.component_uuid] { 'key' => resource.key, 'name' => resource.name(true) diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb index c13baa7a803..bebd548773c 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/api/resources_controller.rb @@ -50,7 +50,7 @@ class Api::ResourcesController < Api::ApiController conditions<<'qualifier in (?)' condition_values< 'distinct(resource_id),root_project_id,qualifier,name_size', # optimization to not load unused columns like 'kee' + indexes = ResourceIndex.all(:select => 'distinct(component_uuid),root_component_uuid,qualifier,name_size', # optimization to not load unused columns like 'kee' :conditions => [conditions.join(' and ')].concat(condition_values), :order => 'name_size') @@ -61,16 +61,16 @@ class Api::ResourcesController < Api::ApiController if select2_format && qualifiers.size>1 # select2.js does not manage lazy loading of grouped options -> (almost) all the results are returned - resource_ids=indexes[0...100].map { |index| index.resource_id } + resource_uuids=indexes[0...100].map { |index| index.component_uuid } else # we don't group results when only one qualifier is requested, so we can enable lazy loading (pagination) offset=(page-1)*page_size - resource_ids=indexes[offset...offset+page_size].map { |index| index.resource_id } + resource_uuids=indexes[offset...offset+page_size].map { |index| index.component_uuid } end resources=[] - unless resource_ids.empty? - resources=Project.all(:select => 'id,qualifier,name,long_name,kee,uuid', :conditions => ['id in (?) and enabled=?', resource_ids, true]) + unless resource_uuids.empty? + resources=Project.all(:select => 'id,qualifier,name,long_name,kee,uuid', :conditions => ['uuid in (?) and enabled=?', resource_uuids, true]) end if select2_format diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/models/project.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/models/project.rb index ad3fd0379ea..7ea0b1c49a8 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/models/project.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/models/project.rb @@ -32,7 +32,7 @@ class Project < ActiveRecord::Base belongs_to :copy_resource, :class_name => 'Project', :foreign_key => 'copy_resource_id' belongs_to :person, :class_name => 'Project', :foreign_key => 'person_id' has_many :authors, :foreign_key => 'person_id', :dependent => :delete_all - has_one :index, :class_name => 'ResourceIndex', :foreign_key => 'resource_id', :conditions => 'position=0', :select => 'kee' + has_one :index, :class_name => 'ResourceIndex', :foreign_key => 'component_uuid', :primary_key => 'uuid', :conditions => 'position=0', :select => 'kee' has_many :resource_index, :foreign_key => 'resource_id' def self.by_key(k) diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/models/resource_index.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/models/resource_index.rb index 7e60fd31b82..6d3bb81f7fe 100644 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/models/resource_index.rb +++ b/server/sonar-web/src/main/webapp/WEB-INF/app/models/resource_index.rb @@ -21,13 +21,14 @@ class ResourceIndex < ActiveRecord::Base set_table_name 'resource_index' - belongs_to :resource, :class_name => 'Project', :foreign_key => 'resource_id' - belongs_to :root_project, :class_name => 'Project', :foreign_key => 'root_project_id' + belongs_to :resource, :class_name => 'Project', :foreign_key => 'component_uuid', :primary_key => 'uuid' + belongs_to :root_project, :class_name => 'Project', :foreign_key => 'root_component_uuid', :primary_key => 'uuid' MIN_SEARCH_SIZE=2 def resource_id_for_authorization - root_project_id + # FIXME this generates a join for every resource + root_project.id end end diff --git a/sonar-db/src/main/java/org/sonar/db/component/ResourceIndexDao.java b/sonar-db/src/main/java/org/sonar/db/component/ResourceIndexDao.java index 5081fb1fa10..b93717e1e1f 100644 --- a/sonar-db/src/main/java/org/sonar/db/component/ResourceIndexDao.java +++ b/sonar-db/src/main/java/org/sonar/db/component/ResourceIndexDao.java @@ -21,8 +21,6 @@ package org.sonar.db.component; import java.util.List; import org.apache.commons.lang.StringUtils; -import org.apache.ibatis.session.ResultContext; -import org.apache.ibatis.session.ResultHandler; import org.apache.ibatis.session.SqlSession; import org.sonar.api.resources.Qualifiers; import org.sonar.api.resources.Scopes; @@ -87,12 +85,9 @@ public class ResourceIndexDao extends AbstractDao { .setScopes(NOT_RENAMABLE_SCOPES) .setRootProjectId(rootProjectId); - session.select(SELECT_RESOURCES, query, new ResultHandler() { - @Override - public void handleResult(ResultContext context) { - ResourceDto resource = (ResourceDto) context.getResultObject(); - doIndex(resource, mapper); - } + session.select(SELECT_RESOURCES, query, context -> { + ResourceDto resource = (ResourceDto) context.getResultObject(); + doIndex(resource, mapper); }); // some resources can be renamed, so index must be regenerated @@ -103,78 +98,66 @@ public class ResourceIndexDao extends AbstractDao { .setScopes(RENAMABLE_SCOPES) .setRootProjectId(rootProjectId); - session.select(SELECT_RESOURCES, query, new ResultHandler() { - @Override - public void handleResult(ResultContext context) { - ResourceDto resource = (ResourceDto) context.getResultObject(); + session.select(SELECT_RESOURCES, query, context -> { + ResourceDto resource = (ResourceDto) context.getResultObject(); - mapper.deleteByResourceId(resource.getId()); - doIndex(resource, mapper); - } + mapper.deleteByComponentUuid(resource.getUuid()); + doIndex(resource, mapper); }); } void doIndex(ResourceDto resource, ResourceIndexMapper mapper) { String key = nameToKey(resource.getName()); if (key.length() >= MINIMUM_KEY_SIZE || key.length() == SINGLE_INDEX_SIZE) { - insertIndexEntries(key, resource.getId(), resource.getQualifier(), resource.getRootId(), resource.getName().length(), mapper); - } - } - - public boolean indexResource(long id) { - DbSession session = myBatis().openSession(false); - try { - return indexResource(session, id); - } finally { - MyBatis.closeQuietly(session); + insertIndexEntries(key, resource.getUuid(), resource.getQualifier(), resource.getProjectUuid(), resource.getName().length(), mapper); } } - public boolean indexResource(DbSession session, long id) { + public boolean indexResource(DbSession session, String uuid) { boolean indexed = false; ResourceIndexMapper mapper = session.getMapper(ResourceIndexMapper.class); - ResourceDto resource = mapper.selectResourceToIndex(id); + ResourceDto resource = mapper.selectResourceToIndex(uuid); if (resource != null) { - Long rootId = resource.getRootId(); - if (rootId == null) { - rootId = resource.getId(); + String rootUuid = resource.getProjectUuid(); + if (rootUuid == null) { + rootUuid = resource.getUuid(); } - indexed = indexResource(resource.getId(), resource.getName(), resource.getQualifier(), rootId, session, mapper); + indexed = indexResource(resource.getUuid(), resource.getName(), resource.getQualifier(), rootUuid, session, mapper); } return indexed; } - public boolean indexResource(int id, String name, String qualifier, int rootId) { + public boolean indexResource(String uuid, String name, String qualifier, String rootUuid) { boolean indexed = false; SqlSession session = myBatis().openSession(false); ResourceIndexMapper mapper = session.getMapper(ResourceIndexMapper.class); try { - indexed = indexResource(id, name, qualifier, rootId, session, mapper); + indexed = indexResource(uuid, name, qualifier, rootUuid, session, mapper); } finally { MyBatis.closeQuietly(session); } return indexed; } - private static boolean indexResource(long id, String name, String qualifier, long rootId, SqlSession session, ResourceIndexMapper mapper) { + private static boolean indexResource(String componentUuid, String name, String qualifier, String rootUuid, SqlSession session, ResourceIndexMapper mapper) { boolean indexed = false; String key = nameToKey(name); if (key.length() >= MINIMUM_KEY_SIZE || key.length() == SINGLE_INDEX_SIZE) { indexed = true; - boolean toBeIndexed = sanitizeIndex(id, key, mapper); + boolean toBeIndexed = sanitizeIndex(componentUuid, key, mapper); if (toBeIndexed) { - insertIndexEntries(key, id, qualifier, rootId, name.length(), mapper); + insertIndexEntries(key, componentUuid, qualifier, rootUuid, name.length(), mapper); session.commit(); } } return indexed; } - private static void insertIndexEntries(String key, long resourceId, String qualifier, long rootId, int nameLength, ResourceIndexMapper mapper) { + private static void insertIndexEntries(String key, String componentUuid, String qualifier, String rootId, int nameLength, ResourceIndexMapper mapper) { ResourceIndexDto dto = new ResourceIndexDto() - .setResourceId(resourceId) + .setComponentUuid(componentUuid) .setQualifier(qualifier) - .setRootProjectId(rootId) + .setRootComponentUuid(rootId) .setNameSize(nameLength); int maxPosition = key.length() == SINGLE_INDEX_SIZE ? 0 : key.length() - MINIMUM_KEY_SIZE; @@ -190,11 +173,11 @@ public class ResourceIndexDao extends AbstractDao { * If the resource is indexed with a different key, then this index is dropped and the * resource must be indexed again. */ - private static boolean sanitizeIndex(long resourceId, String key, ResourceIndexMapper mapper) { - ResourceIndexDto masterIndex = mapper.selectMasterIndexByResourceId(resourceId); + private static boolean sanitizeIndex(String componentUuid, String key, ResourceIndexMapper mapper) { + ResourceIndexDto masterIndex = mapper.selectMasterIndexByComponentUuid(componentUuid); if (masterIndex != null && !StringUtils.equals(key, masterIndex.getKey())) { // resource has been renamed -> drop existing indexes - mapper.deleteByResourceId(resourceId); + mapper.deleteByComponentUuid(componentUuid); masterIndex = null; } return masterIndex == null; diff --git a/sonar-db/src/main/java/org/sonar/db/component/ResourceIndexDto.java b/sonar-db/src/main/java/org/sonar/db/component/ResourceIndexDto.java index 746ea39c84b..3f7d02adfd0 100644 --- a/sonar-db/src/main/java/org/sonar/db/component/ResourceIndexDto.java +++ b/sonar-db/src/main/java/org/sonar/db/component/ResourceIndexDto.java @@ -24,8 +24,8 @@ public final class ResourceIndexDto { private String key; private int position; private int nameSize; - private long resourceId; - private long rootProjectId; + private String componentUuid; + private String rootComponentUuid; private String qualifier; public Long getId() { @@ -55,21 +55,21 @@ public final class ResourceIndexDto { return this; } - public long getResourceId() { - return resourceId; + public String getComponentUuid() { + return componentUuid; } - public ResourceIndexDto setResourceId(long i) { - this.resourceId = i; + public ResourceIndexDto setComponentUuid(String i) { + this.componentUuid = i; return this; } - public long getRootProjectId() { - return rootProjectId; + public String getRootComponentUuid() { + return rootComponentUuid; } - public ResourceIndexDto setRootProjectId(long i) { - this.rootProjectId = i; + public ResourceIndexDto setRootComponentUuid(String i) { + this.rootComponentUuid = i; return this; } diff --git a/sonar-db/src/main/java/org/sonar/db/component/ResourceIndexMapper.java b/sonar-db/src/main/java/org/sonar/db/component/ResourceIndexMapper.java index e0a8b498b3d..54adc036c18 100644 --- a/sonar-db/src/main/java/org/sonar/db/component/ResourceIndexMapper.java +++ b/sonar-db/src/main/java/org/sonar/db/component/ResourceIndexMapper.java @@ -26,11 +26,11 @@ public interface ResourceIndexMapper { List selectProjectIdsFromQueryAndViewOrSubViewUuid(@Param("query") String query, @Param("viewUuidQuery") String viewUuidQuery); - ResourceIndexDto selectMasterIndexByResourceId(long resourceId); + ResourceIndexDto selectMasterIndexByComponentUuid(@Param("componentUuid") String componentUuid); - ResourceDto selectResourceToIndex(long resourceId); + ResourceDto selectResourceToIndex(@Param("componentUuid") String componentUuid); - void deleteByResourceId(long resourceId); + void deleteByComponentUuid(@Param("componentUuid") String componentUuid); void insert(ResourceIndexDto dto); } diff --git a/sonar-db/src/main/java/org/sonar/db/purge/PurgeCommands.java b/sonar-db/src/main/java/org/sonar/db/purge/PurgeCommands.java index 2f1ca4fbc7d..214e07aef30 100644 --- a/sonar-db/src/main/java/org/sonar/db/purge/PurgeCommands.java +++ b/sonar-db/src/main/java/org/sonar/db/purge/PurgeCommands.java @@ -82,8 +82,8 @@ class PurgeCommands { profiler.stop(); profiler.start("deleteResourceIndex (resource_index)"); - for (List partResourceIds : componentIdPartitions) { - purgeMapper.deleteResourceIndex(partResourceIds); + for (List componentUuidPartition : componentUuidsPartitions) { + purgeMapper.deleteResourceIndex(componentUuidPartition); } session.commit(); profiler.stop(); diff --git a/sonar-db/src/main/java/org/sonar/db/purge/PurgeDao.java b/sonar-db/src/main/java/org/sonar/db/purge/PurgeDao.java index 395ee0bf1a7..9d265f0ebda 100644 --- a/sonar-db/src/main/java/org/sonar/db/purge/PurgeDao.java +++ b/sonar-db/src/main/java/org/sonar/db/purge/PurgeDao.java @@ -182,7 +182,7 @@ public class PurgeDao implements Dao { private void disableResource(IdUuidPair componentIdUuid, PurgeMapper mapper) { long componentId = componentIdUuid.getId(); - mapper.deleteResourceIndex(Arrays.asList(componentId)); + mapper.deleteResourceIndex(Arrays.asList(componentIdUuid.getUuid())); mapper.setSnapshotIsLastToFalse(componentId); mapper.deleteFileSourcesByUuid(componentIdUuid.getUuid()); mapper.disableResource(componentId); diff --git a/sonar-db/src/main/java/org/sonar/db/purge/PurgeMapper.java b/sonar-db/src/main/java/org/sonar/db/purge/PurgeMapper.java index d412f0ec6f8..bf3c97cc6dc 100644 --- a/sonar-db/src/main/java/org/sonar/db/purge/PurgeMapper.java +++ b/sonar-db/src/main/java/org/sonar/db/purge/PurgeMapper.java @@ -52,7 +52,7 @@ public interface PurgeMapper { void resolveResourceIssuesNotAlreadyResolved(@Param("componentUuid") String componentUuid, @Param("dateAsLong") Long dateAsLong); - void deleteResourceIndex(@Param("resourceIds") List resourceIds); + void deleteResourceIndex(@Param("componentUuids") List componentUuids); void deleteEvent(long eventId); diff --git a/sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml b/sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml index a21fca2c369..afe8e015818 100644 --- a/sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/component/ComponentMapper.xml @@ -293,8 +293,8 @@ AND ( p.kee=#{query.nameOrKeyQuery} OR - p.id IN ( - SELECT ri.resource_id + p.uuid IN ( + SELECT ri.component_uuid FROM resource_index ri WHERE ri.kee like #{query.nameOrKeyQueryToSqlForResourceIndex} ESCAPE '/' @@ -361,16 +361,17 @@ AND ( p.kee=#{query.nameOrKeyQuery} OR - p.id IN ( - SELECT ri.resource_id + p.uuid IN ( + SELECT ri.component_uuid FROM resource_index ri WHERE ri.kee like #{query.nameOrKeyQueryToSqlForResourceIndex} ESCAPE '/' ) OR p.copy_resource_id IN ( - SELECT ri.resource_id - FROM resource_index ri + SELECT p1.id + FROM resource_index ri, projects p1 WHERE ri.kee like #{query.nameOrKeyQueryToSqlForResourceIndex} ESCAPE '/' + and p1.uuid = ri.component_uuid ) ) diff --git a/sonar-db/src/main/resources/org/sonar/db/component/ResourceIndexMapper.xml b/sonar-db/src/main/resources/org/sonar/db/component/ResourceIndexMapper.xml index 66265a1d3ef..15c1c98568c 100644 --- a/sonar-db/src/main/resources/org/sonar/db/component/ResourceIndexMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/component/ResourceIndexMapper.xml @@ -2,10 +2,10 @@ - - select p.name as "name", p.id as "id", p.scope as "scope", p.qualifier as "qualifier", s.root_project_id as "rootId" - from projects p, snapshots s + select + p.name as "name", p.id as "id", p.uuid as "uuid", p.scope as "scope", p.qualifier as "qualifier", root.uuid as "projectUuid" + from projects p, projects root, snapshots s p.enabled=${_true} and p.copy_resource_id is null @@ -38,33 +39,37 @@ and s.root_project_id=#{rootProjectId} - and not exists(select * from resource_index ri where ri.resource_id=p.id) + and not exists(select * from resource_index ri where ri.component_uuid=p.uuid) + and root.id = s.root_project_id order by p.id - + select kee as "key", component_uuid as "componentUuid" from resource_index - where resource_id=#{id} and position=0 + where component_uuid=#{componentUuid} and position=0 - + select p.id, p.uuid as "uuid", p.name, root.uuid as "projectUuid", p.qualifier + from projects p + join projects root on root.uuid = p.project_uuid + where + p.uuid=#{componentUuid} + and p.enabled=${_true} - + delete from resource_index - where resource_id=#{id} + where component_uuid=#{componentUuid} - insert into resource_index (kee, position, name_size, resource_id, root_project_id, qualifier) + insert into resource_index (kee, position, name_size, component_uuid, root_component_uuid, qualifier) values (#{key}, #{position}, #{nameSize}, - #{resourceId}, #{rootProjectId}, #{qualifier}) + #{componentUuid}, #{rootComponentUuid}, #{qualifier}) diff --git a/sonar-db/src/main/resources/org/sonar/db/purge/PurgeMapper.xml b/sonar-db/src/main/resources/org/sonar/db/purge/PurgeMapper.xml index fb05f2ebe2c..64b7ae0fba2 100644 --- a/sonar-db/src/main/resources/org/sonar/db/purge/PurgeMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/purge/PurgeMapper.xml @@ -145,9 +145,9 @@ - delete from resource_index where resource_id in - - #{resourceId} + delete from resource_index where component_uuid in + + #{componentUuid} diff --git a/sonar-db/src/main/resources/org/sonar/db/qualitygate/ProjectQgateAssociationMapper.xml b/sonar-db/src/main/resources/org/sonar/db/qualitygate/ProjectQgateAssociationMapper.xml index 76f7654ad0b..fe6683b58db 100644 --- a/sonar-db/src/main/resources/org/sonar/db/qualitygate/ProjectQgateAssociationMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/qualitygate/ProjectQgateAssociationMapper.xml @@ -7,7 +7,7 @@ SELECT proj.id as id, proj.name as name, prop.text_value as gateId FROM projects proj - JOIN resource_index ind ON ind.root_project_id=proj.id + JOIN resource_index ind ON ind.root_component_uuid=proj.uuid LEFT JOIN properties prop ON prop.resource_id=proj.id AND prop.prop_key='sonar.qualitygate' AND prop.text_value LIKE #{query.gateId} diff --git a/sonar-db/src/test/java/org/sonar/db/component/ComponentDbTester.java b/sonar-db/src/test/java/org/sonar/db/component/ComponentDbTester.java index 8666df9742a..7ac2fec5c8b 100644 --- a/sonar-db/src/test/java/org/sonar/db/component/ComponentDbTester.java +++ b/sonar-db/src/test/java/org/sonar/db/component/ComponentDbTester.java @@ -96,9 +96,9 @@ public class ComponentDbTester { db.commit(); } - public void indexComponents(long... componentIdList) { - for (long componentId : componentIdList) { - dbClient.componentIndexDao().indexResource(dbSession, componentId); + public void indexComponents(String... componentUuids) { + for (String componnentUuid : componentUuids) { + dbClient.componentIndexDao().indexResource(dbSession, componnentUuid); } db.commit(); } diff --git a/sonar-db/src/test/java/org/sonar/db/component/ResourceIndexDaoTest.java b/sonar-db/src/test/java/org/sonar/db/component/ResourceIndexDaoTest.java index 4bd171d65da..75b1984dbba 100644 --- a/sonar-db/src/test/java/org/sonar/db/component/ResourceIndexDaoTest.java +++ b/sonar-db/src/test/java/org/sonar/db/component/ResourceIndexDaoTest.java @@ -32,6 +32,10 @@ import static org.assertj.core.api.Assertions.assertThat; public class ResourceIndexDaoTest { + private static final String[] EXCLUDED_ID_COLUMN = new String[]{"id"}; + private static final String CPT_UUID = "cpt_uuid"; + private static final String ROOT_UUID = "ABCD"; + @Rule public DbTester dbTester = DbTester.create(System2.INSTANCE); @@ -41,9 +45,9 @@ public class ResourceIndexDaoTest { public void shouldIndexResource() { dbTester.prepareDbUnit(getClass(), "shouldIndexResource.xml"); - underTest.indexResource(10, "ZipUtils", "FIL", 8); + underTest.indexResource(CPT_UUID, "ZipUtils", "FIL", ROOT_UUID); - dbTester.assertDbUnit(getClass(), "shouldIndexResource-result.xml", new String[] {"id"}, "resource_index"); + dbTester.assertDbUnit(getClass(), "shouldIndexResource-result.xml", EXCLUDED_ID_COLUMN, "resource_index"); } @Test @@ -52,7 +56,7 @@ public class ResourceIndexDaoTest { underTest.indexProject(1); - dbTester.assertDbUnit(getClass(), "shouldIndexMultiModulesProject-result.xml", new String[] {"id"}, "resource_index"); + dbTester.assertDbUnit(getClass(), "shouldIndexMultiModulesProject-result.xml", EXCLUDED_ID_COLUMN, "resource_index"); } @Test @@ -61,7 +65,7 @@ public class ResourceIndexDaoTest { underTest.indexProject(1); - dbTester.assertDbUnit(getClass(), "shouldReindexProjectAfterRenaming-result.xml", new String[] {"id"}, "resource_index"); + dbTester.assertDbUnit(getClass(), "shouldReindexProjectAfterRenaming-result.xml", EXCLUDED_ID_COLUMN, "resource_index"); } @Test @@ -70,56 +74,56 @@ public class ResourceIndexDaoTest { underTest.indexProject(1); // project - assertThat(dbTester.countSql("select count(1) from resource_index where resource_id=1")).isGreaterThan(0); + assertThat(dbTester.countSql("select count(1) from resource_index where component_uuid='ABCD'")).isGreaterThan(0); // directory - assertThat(dbTester.countSql("select count(1) from resource_index where resource_id=2")).isEqualTo(0); + assertThat(dbTester.countSql("select count(1) from resource_index where component_uuid='BCDE'")).isEqualTo(0); // file - assertThat(dbTester.countSql("select count(1) from resource_index where resource_id=3")).isGreaterThan(0); + assertThat(dbTester.countSql("select count(1) from resource_index where component_uuid='CDEF'")).isGreaterThan(0); } @Test public void shouldIndexTwoLettersLongResources() { dbTester.prepareDbUnit(getClass(), "shouldIndexTwoLettersLongResource.xml"); - underTest.indexResource(10, "AB", Qualifiers.PROJECT, 3); + underTest.indexResource(CPT_UUID, "AB", Qualifiers.PROJECT, ROOT_UUID); - dbTester.assertDbUnit(getClass(), "shouldIndexTwoLettersLongResource-result.xml", new String[] {"id"}, "resource_index"); + dbTester.assertDbUnit(getClass(), "shouldIndexTwoLettersLongResource-result.xml", EXCLUDED_ID_COLUMN, "resource_index"); } @Test public void shouldReIndexTwoLettersLongResources() { dbTester.prepareDbUnit(getClass(), "shouldReIndexTwoLettersLongResource.xml"); - underTest.indexResource(1, "AS", Qualifiers.PROJECT, 1); + underTest.indexResource(ROOT_UUID, "AS", Qualifiers.PROJECT, ROOT_UUID); - dbTester.assertDbUnit(getClass(), "shouldReIndexTwoLettersLongResource-result.xml", new String[] {"id"}, "resource_index"); + dbTester.assertDbUnit(getClass(), "shouldReIndexTwoLettersLongResource-result.xml", EXCLUDED_ID_COLUMN, "resource_index"); } @Test public void shouldReIndexNewTwoLettersLongResource() { dbTester.prepareDbUnit(getClass(), "shouldReIndexNewTwoLettersLongResource.xml"); - underTest.indexResource(1, "AS", Qualifiers.PROJECT, 1); + underTest.indexResource(ROOT_UUID, "AS", Qualifiers.PROJECT, ROOT_UUID); - dbTester.assertDbUnit(getClass(), "shouldReIndexNewTwoLettersLongResource-result.xml", new String[] {"id"}, "resource_index"); + dbTester.assertDbUnit(getClass(), "shouldReIndexNewTwoLettersLongResource-result.xml", EXCLUDED_ID_COLUMN, "resource_index"); } @Test public void shouldReindexResource() { dbTester.prepareDbUnit(getClass(), "shouldReindexResource.xml"); - underTest.indexResource(1, "New Struts", Qualifiers.PROJECT, 1); + underTest.indexResource(ROOT_UUID, "New Struts", Qualifiers.PROJECT, ROOT_UUID); - dbTester.assertDbUnit(getClass(), "shouldReindexResource-result.xml", new String[] {"id"}, "resource_index"); + dbTester.assertDbUnit(getClass(), "shouldReindexResource-result.xml", EXCLUDED_ID_COLUMN, "resource_index"); } @Test public void shouldNotReindexUnchangedResource() { dbTester.prepareDbUnit(getClass(), "shouldNotReindexUnchangedResource.xml"); - underTest.indexResource(1, "Struts", Qualifiers.PROJECT, 1); + underTest.indexResource(ROOT_UUID, "Struts", Qualifiers.PROJECT, ROOT_UUID); - dbTester.assertDbUnit(getClass(), "shouldNotReindexUnchangedResource-result.xml", new String[] {"id"}, "resource_index"); + dbTester.assertDbUnit(getClass(), "shouldNotReindexUnchangedResource-result.xml", EXCLUDED_ID_COLUMN, "resource_index"); } @Test @@ -143,7 +147,7 @@ public class ResourceIndexDaoTest { @Test public void restrict_indexed_combinations_to_400_characters() { String longName = repeat("a", 2_000); - ComponentDto project = new ComponentDto().setKey("the_key").setName(longName).setScope(Scopes.PROJECT).setQualifier(Qualifiers.PROJECT); + ComponentDto project = new ComponentDto().setUuid(ROOT_UUID).setKey("the_key").setName(longName).setScope(Scopes.PROJECT).setQualifier(Qualifiers.PROJECT); DbSession session = dbTester.getSession(); dbTester.getDbClient().componentDao().insert(session, project); dbTester.getDbClient().snapshotDao().insert(session, new SnapshotDto().setComponentId(project.getId()).setRootProjectId(project.getId()).setLast(true)); diff --git a/sonar-db/src/test/java/org/sonar/db/version/v52/IncreasePrecisionOfNumericsTest.java b/sonar-db/src/test/java/org/sonar/db/version/v52/IncreasePrecisionOfNumericsTest.java index e17286792ef..39cbbe10d6a 100644 --- a/sonar-db/src/test/java/org/sonar/db/version/v52/IncreasePrecisionOfNumericsTest.java +++ b/sonar-db/src/test/java/org/sonar/db/version/v52/IncreasePrecisionOfNumericsTest.java @@ -45,15 +45,29 @@ public class IncreasePrecisionOfNumericsTest { underTest.execute(context); - verify(context).execute("ALTER TABLE metrics ALTER COLUMN worst_value TYPE NUMERIC (38,20), ALTER COLUMN best_value TYPE NUMERIC (38,20)"); + verify(context).execute("ALTER TABLE metrics " + + "ALTER COLUMN worst_value TYPE NUMERIC (38,20), " + + "ALTER COLUMN worst_value DROP NOT NULL, " + + "ALTER COLUMN best_value TYPE NUMERIC (38,20), " + + "ALTER COLUMN best_value DROP NOT NULL" + ); verify(context).execute("ALTER TABLE project_measures " + "ALTER COLUMN value TYPE NUMERIC (38,20), " + + "ALTER COLUMN value DROP NOT NULL, " + "ALTER COLUMN variation_value_1 TYPE NUMERIC (38,20), " + + "ALTER COLUMN variation_value_1 DROP NOT NULL, " + "ALTER COLUMN variation_value_2 TYPE NUMERIC (38,20), " + + "ALTER COLUMN variation_value_2 DROP NOT NULL, " + "ALTER COLUMN variation_value_3 TYPE NUMERIC (38,20), " + + "ALTER COLUMN variation_value_3 DROP NOT NULL, " + "ALTER COLUMN variation_value_4 TYPE NUMERIC (38,20), " + - "ALTER COLUMN variation_value_5 TYPE NUMERIC (38,20)"); - verify(context).execute("ALTER TABLE manual_measures ALTER COLUMN value TYPE NUMERIC (38,20)"); + "ALTER COLUMN variation_value_4 DROP NOT NULL, " + + "ALTER COLUMN variation_value_5 TYPE NUMERIC (38,20), " + + "ALTER COLUMN variation_value_5 DROP NOT NULL"); + verify(context).execute("ALTER TABLE manual_measures " + + "ALTER COLUMN value TYPE NUMERIC (38,20), " + + "ALTER COLUMN value DROP NOT NULL" + ); } } diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/select_project_ids_from_query_and_view_or_sub_view_uuid.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/select_project_ids_from_query_and_view_or_sub_view_uuid.xml index bdb7aa44055..e0cc9bc51f3 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/select_project_ids_from_query_and_view_or_sub_view_uuid.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/select_project_ids_from_query_and_view_or_sub_view_uuid.xml @@ -1,4 +1,4 @@ - +IncreasePrecisionOfNumericsTest.update_column_types:48 @@ -11,22 +11,22 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexMultiModulesProject-result.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexMultiModulesProject-result.xml index 48899d945c3..95fcec6efb0 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexMultiModulesProject-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexMultiModulesProject-result.xml @@ -27,43 +27,43 @@ description="[null]" enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> - - - - + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - + + + + - - - - - - - - - + + + + + + + + + diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexResource-result.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexResource-result.xml index f4cf0805ede..6d62588a7ca 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexResource-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexResource-result.xml @@ -1,8 +1,8 @@ - - - - - - - \ No newline at end of file + + + + + + + diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexTwoLettersLongResource-result.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexTwoLettersLongResource-result.xml index c9941e492bd..344265bade2 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexTwoLettersLongResource-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexTwoLettersLongResource-result.xml @@ -1,3 +1,3 @@ - - \ No newline at end of file + + diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldNotReindexUnchangedResource-result.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldNotReindexUnchangedResource-result.xml index 4292af5708d..1938b8ed281 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldNotReindexUnchangedResource-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldNotReindexUnchangedResource-result.xml @@ -1,6 +1,6 @@ - - - - - \ No newline at end of file + + + + + diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldNotReindexUnchangedResource.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldNotReindexUnchangedResource.xml index 89a3a8c465d..754923bbd26 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldNotReindexUnchangedResource.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldNotReindexUnchangedResource.xml @@ -1,6 +1,6 @@ - - - - - \ No newline at end of file + + + + + diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReIndexNewTwoLettersLongResource-result.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReIndexNewTwoLettersLongResource-result.xml index 52db35f3ad4..60176439bfa 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReIndexNewTwoLettersLongResource-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReIndexNewTwoLettersLongResource-result.xml @@ -1,3 +1,3 @@ - - \ No newline at end of file + + diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReIndexNewTwoLettersLongResource.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReIndexNewTwoLettersLongResource.xml index af5863edbda..ea9318e91f3 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReIndexNewTwoLettersLongResource.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReIndexNewTwoLettersLongResource.xml @@ -10,9 +10,9 @@ qualifier="TRK"/> - - - - + + + + diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReIndexTwoLettersLongResource-result.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReIndexTwoLettersLongResource-result.xml index 52db35f3ad4..60176439bfa 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReIndexTwoLettersLongResource-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReIndexTwoLettersLongResource-result.xml @@ -1,3 +1,3 @@ - - \ No newline at end of file + + diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReIndexTwoLettersLongResource.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReIndexTwoLettersLongResource.xml index 529e83c1a44..85b7abab512 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReIndexTwoLettersLongResource.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReIndexTwoLettersLongResource.xml @@ -10,6 +10,6 @@ qualifier="TRK"/> - + diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReindexProjectAfterRenaming-result.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReindexProjectAfterRenaming-result.xml index e28b5945816..1d5c5d31259 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReindexProjectAfterRenaming-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReindexProjectAfterRenaming-result.xml @@ -9,16 +9,16 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReindexProjectAfterRenaming.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReindexProjectAfterRenaming.xml index 84815e52e64..8017ad92ff5 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReindexProjectAfterRenaming.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReindexProjectAfterRenaming.xml @@ -10,9 +10,9 @@ qualifier="TRK"/> - - - - + + + + diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReindexResource-result.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReindexResource-result.xml index b9f39157aea..a9f3286edf5 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReindexResource-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReindexResource-result.xml @@ -1,10 +1,10 @@ - - - - - - - - - \ No newline at end of file + + + + + + + + + diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReindexResource.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReindexResource.xml index 89a3a8c465d..754923bbd26 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReindexResource.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldReindexResource.xml @@ -1,6 +1,6 @@ - - - - - \ No newline at end of file + + + + + diff --git a/sonar-db/src/test/resources/org/sonar/db/qualitygate/ProjectQgateAssociationDaoTest/shared.xml b/sonar-db/src/test/resources/org/sonar/db/qualitygate/ProjectQgateAssociationDaoTest/shared.xml index 48410ec3321..c58db5391e2 100644 --- a/sonar-db/src/test/resources/org/sonar/db/qualitygate/ProjectQgateAssociationDaoTest/shared.xml +++ b/sonar-db/src/test/resources/org/sonar/db/qualitygate/ProjectQgateAssociationDaoTest/shared.xml @@ -11,32 +11,32 @@ - - - - - - - - - - + + + + + - - - - - - - + + + -- 2.39.5