From: Jean-Baptiste Vilain Date: Wed, 7 Aug 2013 15:22:08 +0000 (+0200) Subject: SONAR-4560 Index resources up to the first character in order to support 2 letters... X-Git-Tag: 3.7.1-RC1-~153 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=22a7bae8cd765685a5d037fca2864f17741dbaa5;p=sonarqube.git SONAR-4560 Index resources up to the first character in order to support 2 letters long projects in the bulk deletion screen --- diff --git a/sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerDao.java b/sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerDao.java index a07d48ec505..d516c1948f8 100644 --- a/sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerDao.java +++ b/sonar-core/src/main/java/org/sonar/core/resource/ResourceIndexerDao.java @@ -29,7 +29,7 @@ import org.sonar.core.persistence.MyBatis; public class ResourceIndexerDao { - public static final int MINIMUM_KEY_SIZE = 3; + public static final int MINIMUM_KEY_SIZE = 1; // The scopes and qualifiers that are not in the following constants are not indexed at all. // Directories and packages are explicitly excluded. diff --git a/sonar-core/src/test/java/org/sonar/core/resource/ResourceIndexerDaoTest.java b/sonar-core/src/test/java/org/sonar/core/resource/ResourceIndexerDaoTest.java index 9e39f4fb58b..4784e2a26bc 100644 --- a/sonar-core/src/test/java/org/sonar/core/resource/ResourceIndexerDaoTest.java +++ b/sonar-core/src/test/java/org/sonar/core/resource/ResourceIndexerDaoTest.java @@ -109,12 +109,12 @@ public class ResourceIndexerDaoTest extends AbstractDaoTestCase { } @Test - public void shouldNotIndexWhenTooShortName() { - setupData("empty"); + public void shouldIndexTwoLettersLongResources() { + setupData("shouldIndexTwoLettersLongResource"); dao.indexResource(10, "AB", Qualifiers.FILE, 3); - checkTables("empty", new String[] {"id"}, "resource_index"); + checkTables("shouldIndexTwoLettersLongResource", new String[] {"id"}, "resource_index"); } @Test diff --git a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/empty-result.xml b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/empty-result.xml deleted file mode 100644 index df17d4185c2..00000000000 --- a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/empty-result.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/empty.xml b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/empty.xml deleted file mode 100644 index 35999df443d..00000000000 --- a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/empty.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexMultiModulesProject-result.xml b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexMultiModulesProject-result.xml index 7210c845707..657d233a00a 100644 --- a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexMultiModulesProject-result.xml +++ b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexMultiModulesProject-result.xml @@ -43,12 +43,16 @@ + + + + @@ -60,6 +64,8 @@ + + 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 c7484ec4a2a..e25372f5746 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 @@ -36,11 +36,15 @@ + + + + diff --git a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexResource-result.xml b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexResource-result.xml index f4cf0805ede..22bca4ad0f4 100644 --- a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexResource-result.xml +++ b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexResource-result.xml @@ -5,4 +5,6 @@ + + \ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexTwoLettersLongResource-result.xml b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexTwoLettersLongResource-result.xml new file mode 100644 index 00000000000..75e71f72ef4 --- /dev/null +++ b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexTwoLettersLongResource-result.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexTwoLettersLongResource.xml b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexTwoLettersLongResource.xml new file mode 100644 index 00000000000..5a4a28b7df3 --- /dev/null +++ b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldIndexTwoLettersLongResource.xml @@ -0,0 +1 @@ + diff --git a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldNotReindexUnchangedResource-result.xml b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldNotReindexUnchangedResource-result.xml index 4292af5708d..65f006f11ae 100644 --- a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldNotReindexUnchangedResource-result.xml +++ b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldNotReindexUnchangedResource-result.xml @@ -3,4 +3,6 @@ + + \ No newline at end of file diff --git a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldNotReindexUnchangedResource.xml b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldNotReindexUnchangedResource.xml index 89a3a8c465d..515ffcc9c08 100644 --- a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldNotReindexUnchangedResource.xml +++ b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldNotReindexUnchangedResource.xml @@ -3,4 +3,6 @@ + + \ No newline at end of file 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 4909ab38144..40b02449634 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 @@ -18,5 +18,7 @@ + + diff --git a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldReindexResource-result.xml b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldReindexResource-result.xml index e6b0836a838..53b68f1782a 100644 --- a/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldReindexResource-result.xml +++ b/sonar-core/src/test/resources/org/sonar/core/resource/ResourceIndexerDaoTest/shouldReindexResource-result.xml @@ -7,5 +7,6 @@ - + + \ No newline at end of file