@@ -107,7 +107,7 @@ public class ComputeEngineContainerImplTest { | |||
assertThat(picoContainer.getParent().getParent().getParent().getComponentAdapters()).hasSize( | |||
COMPONENTS_IN_LEVEL_1_AT_CONSTRUCTION | |||
+ 25 // level 1 | |||
+ 48 // content of DaoModule | |||
+ 47 // content of DaoModule | |||
+ 2 // content of EsSearchModule | |||
+ 63 // content of CorePropertyDefinitions | |||
+ 1 // content of CePropertyDefinitions |
@@ -104,7 +104,6 @@ public class ComponentUpdater { | |||
.setQualifier(newComponent.qualifier()) | |||
.setCreatedAt(new Date(system2.now())); | |||
dbClient.componentDao().insert(session, component); | |||
dbClient.componentIndexDao().indexResource(session, component.uuid()); | |||
return component; | |||
} | |||
@@ -19,19 +19,16 @@ | |||
*/ | |||
package org.sonar.server.computation.task.projectanalysis.step; | |||
import org.sonar.db.component.ResourceIndexDao; | |||
import org.sonar.server.component.index.ComponentIndexer; | |||
import org.sonar.server.computation.task.projectanalysis.component.TreeRootHolder; | |||
import org.sonar.server.computation.task.step.ComputationStep; | |||
public class IndexComponentsStep implements ComputationStep { | |||
private final ResourceIndexDao resourceIndexDao; | |||
private final ComponentIndexer elasticSearchIndexer; | |||
private final TreeRootHolder treeRootHolder; | |||
public IndexComponentsStep(ResourceIndexDao resourceIndexDao, ComponentIndexer elasticSearchIndexer, TreeRootHolder treeRootHolder) { | |||
this.resourceIndexDao = resourceIndexDao; | |||
public IndexComponentsStep(ComponentIndexer elasticSearchIndexer, TreeRootHolder treeRootHolder) { | |||
this.elasticSearchIndexer = elasticSearchIndexer; | |||
this.treeRootHolder = treeRootHolder; | |||
} | |||
@@ -39,7 +36,6 @@ public class IndexComponentsStep implements ComputationStep { | |||
@Override | |||
public void execute() { | |||
String projectUuid = treeRootHolder.getRoot().getUuid(); | |||
resourceIndexDao.indexProject(projectUuid); | |||
elasticSearchIndexer.indexByProjectUuid(projectUuid); | |||
} | |||
@@ -230,7 +230,6 @@ public class ActivityActionTest { | |||
componentDb.insertProjectAndSnapshot(zookeeper); | |||
componentDb.insertProjectAndSnapshot(eclipse); | |||
dbTester.commit(); | |||
componentDb.indexComponents(struts.uuid(), zookeeper.uuid(), eclipse.uuid()); | |||
globalAdmin(); | |||
insertActivity("T1", "P1", CeActivityDto.Status.SUCCESS); | |||
insertActivity("T2", "P2", CeActivityDto.Status.SUCCESS); | |||
@@ -248,7 +247,6 @@ public class ActivityActionTest { | |||
ComponentDto developer = newDeveloper(organizationDto, "Apache Developer").setUuid("D1").setProjectUuid("D1"); | |||
componentDb.insertDeveloperAndSnapshot(developer); | |||
componentDb.insertViewAndSnapshot(apacheView); | |||
componentDb.indexComponents(developer.uuid(), apacheView.uuid()); | |||
globalAdmin(); | |||
insertActivity("T1", "D1", CeActivityDto.Status.SUCCESS); | |||
insertActivity("T2", "V1", CeActivityDto.Status.SUCCESS); |
@@ -20,8 +20,6 @@ | |||
package org.sonar.server.component; | |||
import java.util.Arrays; | |||
import org.junit.Before; | |||
import org.assertj.core.api.Fail; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.junit.rules.ExpectedException; | |||
@@ -32,13 +30,9 @@ import org.sonar.db.DbSession; | |||
import org.sonar.db.DbTester; | |||
import org.sonar.db.component.ComponentDbTester; | |||
import org.sonar.db.component.ComponentDto; | |||
import org.sonar.db.component.ComponentTesting; | |||
import org.sonar.server.component.index.ComponentIndexDefinition; | |||
import org.sonar.server.component.index.ComponentIndexer; | |||
import org.sonar.server.es.EsTester; | |||
import org.sonar.server.exceptions.BadRequestException; | |||
import org.sonar.server.i18n.I18nRule; | |||
import org.sonar.server.exceptions.NotFoundException; | |||
import org.sonar.server.measure.index.ProjectMeasuresIndexDefinition; | |||
import org.sonar.server.measure.index.ProjectMeasuresIndexer; | |||
import org.sonar.server.tester.UserSessionRule; |
@@ -34,7 +34,6 @@ import org.sonar.db.DbTester; | |||
import org.sonar.db.component.ComponentDao; | |||
import org.sonar.db.component.ComponentDto; | |||
import org.sonar.db.component.ComponentTesting; | |||
import org.sonar.db.component.ResourceIndexDao; | |||
import org.sonar.db.organization.OrganizationDto; | |||
import org.sonar.db.permission.template.PermissionTemplateDto; | |||
import org.sonar.db.user.UserDto; | |||
@@ -157,7 +156,6 @@ public class ComponentUpdaterTest { | |||
DbClient dbClient = mock(DbClient.class); | |||
when(dbClient.openSession(false)).thenReturn(session); | |||
when(dbClient.componentDao()).thenReturn(componentDao); | |||
when(dbClient.componentIndexDao()).thenReturn(mock(ResourceIndexDao.class)); | |||
doAnswer(invocation -> { | |||
((ComponentDto) invocation.getArguments()[1]).setId(1L); |
@@ -84,17 +84,4 @@ public class ComponentsWsTest { | |||
assertThat(action.handler()).isNotNull(); | |||
assertThat(action.params()).hasSize(2); | |||
} | |||
@Test | |||
public void define_search_action() { | |||
WebService.Action action = controller.action("search"); | |||
assertThat(action).isNotNull(); | |||
assertThat(action.param("qualifiers").isRequired()).isTrue(); | |||
assertThat(action.responseExampleAsString()).isNotEmpty(); | |||
assertThat(action.description()).isNotEmpty(); | |||
assertThat(action.isInternal()).isTrue(); | |||
assertThat(action.isPost()).isFalse(); | |||
assertThat(action.since()).isEqualTo("5.2"); | |||
} | |||
} |
@@ -122,7 +122,6 @@ public class TreeActionTest { | |||
componentDb.insertComponent(directory); | |||
componentDb.insertComponent(newFileDto(module, directory, 10)); | |||
db.commit(); | |||
componentDb.indexAllComponents(); | |||
TreeWsResponse response = call(ws.newRequest() | |||
.setParam(PARAM_STRATEGY, "children") | |||
@@ -152,7 +151,6 @@ public class TreeActionTest { | |||
componentDb.insertComponent(directory); | |||
componentDb.insertComponent(newFileDto(module, directory, 1)); | |||
db.commit(); | |||
componentDb.indexAllComponents(); | |||
TreeWsResponse response = call(ws.newRequest() | |||
.setParam(PARAM_STRATEGY, "all") | |||
@@ -176,7 +174,6 @@ public class TreeActionTest { | |||
componentDb.insertComponent(newFileDto(project, 2)); | |||
componentDb.insertComponent(newModuleDto("module-uuid-1", project)); | |||
db.commit(); | |||
componentDb.indexAllComponents(); | |||
TreeWsResponse response = call(ws.newRequest() | |||
.setParam(PARAM_STRATEGY, "all") | |||
@@ -198,7 +195,6 @@ public class TreeActionTest { | |||
componentDb.insertComponent(directory); | |||
componentDb.insertComponent(newFileDto(module, directory, 3)); | |||
db.commit(); | |||
componentDb.indexAllComponents(); | |||
TreeWsResponse response = call(ws.newRequest() | |||
.setParam(PARAM_STRATEGY, "leaves") | |||
@@ -220,7 +216,6 @@ public class TreeActionTest { | |||
componentDb.insertComponent(module); | |||
componentDb.insertComponent(newDirectory(project, "path/directory/", "directory-uuid-1")); | |||
db.commit(); | |||
componentDb.indexAllComponents(); | |||
TreeWsResponse response = call(ws.newRequest() | |||
.setParam(PARAM_STRATEGY, "all") | |||
@@ -240,7 +235,6 @@ public class TreeActionTest { | |||
componentDb.insertComponent(newProjectCopy("project-uuid-1-copy", project, view)); | |||
componentDb.insertComponent(newSubView(view, "sub-view-uuid", "sub-view-key").setName("sub-view-name")); | |||
db.commit(); | |||
componentDb.indexAllComponents(); | |||
TreeWsResponse response = call(ws.newRequest() | |||
.setParam(PARAM_STRATEGY, "children") | |||
@@ -424,7 +418,6 @@ public class TreeActionTest { | |||
.setCreatedAt(now)); | |||
} | |||
db.commit(); | |||
componentDb.indexAllComponents(); | |||
return project; | |||
} | |||
@@ -21,7 +21,6 @@ package org.sonar.server.computation.task.projectanalysis.step; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonar.db.component.ResourceIndexDao; | |||
import org.sonar.server.component.index.ComponentIndexer; | |||
import org.sonar.server.computation.task.projectanalysis.batch.BatchReportReaderRule; | |||
import org.sonar.server.computation.task.projectanalysis.component.Component; | |||
@@ -45,28 +44,27 @@ public class IndexComponentsStepTest extends BaseStepTest { | |||
@Rule | |||
public BatchReportReaderRule reportReader = new BatchReportReaderRule(); | |||
ResourceIndexDao resourceIndexDao = mock(ResourceIndexDao.class); | |||
ComponentIndexer elasticSearchIndexer = mock(ComponentIndexer.class); | |||
IndexComponentsStep underTest = new IndexComponentsStep(resourceIndexDao, elasticSearchIndexer, treeRootHolder); | |||
private ComponentIndexer componentIndexer = mock(ComponentIndexer.class); | |||
private IndexComponentsStep underTest = new IndexComponentsStep(componentIndexer, treeRootHolder); | |||
@Test | |||
public void call_indexProject_of_dao_for_project() { | |||
public void call_indexByProjectUuid_of_indexer_for_project() { | |||
Component project = ReportComponent.builder(PROJECT, 1).setUuid(PROJECT_UUID).setKey(PROJECT_KEY).build(); | |||
treeRootHolder.setRoot(project); | |||
underTest.execute(); | |||
verify(resourceIndexDao).indexProject(PROJECT_UUID); | |||
verify(componentIndexer).indexByProjectUuid(PROJECT_UUID); | |||
} | |||
@Test | |||
public void call_indexProject_of_dao_for_view() { | |||
public void call_indexByProjectUuid_of_indexer_for_view() { | |||
Component view = ViewsComponent.builder(VIEW, PROJECT_KEY).setUuid(PROJECT_UUID).build(); | |||
treeRootHolder.setRoot(view); | |||
underTest.execute(); | |||
verify(resourceIndexDao).indexProject(PROJECT_UUID); | |||
verify(componentIndexer).indexByProjectUuid(PROJECT_UUID); | |||
} | |||
@Override |
@@ -155,7 +155,6 @@ public class SearchProjectPermissionsActionTest extends BasePermissionWsTest<Sea | |||
public void search_by_query_on_name() throws Exception { | |||
componentDb.insertProjectAndSnapshot(newProjectDto(db.getDefaultOrganization()).setName("project-name")); | |||
componentDb.insertProjectAndSnapshot(newProjectDto(db.getDefaultOrganization()).setName("another-name")); | |||
componentDb.indexAllComponents(); | |||
String result = newRequest() | |||
.setParam(TEXT_QUERY, "project") | |||
@@ -170,7 +169,6 @@ public class SearchProjectPermissionsActionTest extends BasePermissionWsTest<Sea | |||
OrganizationDto organizationDto = db.organizations().insert(); | |||
componentDb.insertProjectAndSnapshot(newProjectDto(organizationDto).setKey("project-key")); | |||
componentDb.insertProjectAndSnapshot(newProjectDto(organizationDto).setKey("another-key")); | |||
componentDb.indexAllComponents(); | |||
String result = newRequest() | |||
.setParam(TEXT_QUERY, "project-key") | |||
@@ -186,7 +184,6 @@ public class SearchProjectPermissionsActionTest extends BasePermissionWsTest<Sea | |||
for (int i = 1; i <= 1001; i++) { | |||
componentDb.insertProjectAndSnapshot(newProjectDto(db.getDefaultOrganization(), "project-uuid-" + i)); | |||
} | |||
componentDb.indexAllComponents(); | |||
String result = newRequest() | |||
.setParam(TEXT_QUERY, "project") |
@@ -140,7 +140,6 @@ public class BulkApplyTemplateActionTest extends BasePermissionWsTest<BulkApplyT | |||
// match must be exact on key | |||
ComponentDto projectUntouched = newProjectDto(organizationDto).setKey("new-sonar").setName("project-name"); | |||
db.components().insertProjectAndSnapshot(projectUntouched); | |||
db.components().indexAllComponents(); | |||
loginAsAdminOnDefaultOrganization(); | |||
newRequest() |
@@ -30,7 +30,6 @@ import org.sonar.db.component.ComponentDao; | |||
import org.sonar.db.component.ComponentKeyUpdaterDao; | |||
import org.sonar.db.component.ComponentLinkDao; | |||
import org.sonar.db.component.ResourceDao; | |||
import org.sonar.db.component.ResourceIndexDao; | |||
import org.sonar.db.component.SnapshotDao; | |||
import org.sonar.db.duplication.DuplicationDao; | |||
import org.sonar.db.event.EventDao; | |||
@@ -109,7 +108,6 @@ public class DaoModule extends Module { | |||
QualityGateDao.class, | |||
QualityProfileDao.class, | |||
ResourceDao.class, | |||
ResourceIndexDao.class, | |||
RoleDao.class, | |||
RuleDao.class, | |||
RuleRepositoryDao.class, |
@@ -30,7 +30,6 @@ import org.sonar.db.component.ComponentDao; | |||
import org.sonar.db.component.ComponentKeyUpdaterDao; | |||
import org.sonar.db.component.ComponentLinkDao; | |||
import org.sonar.db.component.ResourceDao; | |||
import org.sonar.db.component.ResourceIndexDao; | |||
import org.sonar.db.component.SnapshotDao; | |||
import org.sonar.db.duplication.DuplicationDao; | |||
import org.sonar.db.event.EventDao; | |||
@@ -101,7 +100,6 @@ public class DbClient { | |||
private final CeScannerContextDao ceScannerContextDao; | |||
private final FileSourceDao fileSourceDao; | |||
private final AuthorDao authorDao; | |||
private final ResourceIndexDao componentIndexDao; | |||
private final ComponentLinkDao componentLinkDao; | |||
private final EventDao eventDao; | |||
private final PurgeDao purgeDao; | |||
@@ -156,7 +154,6 @@ public class DbClient { | |||
ceScannerContextDao = getDao(map, CeScannerContextDao.class); | |||
fileSourceDao = getDao(map, FileSourceDao.class); | |||
authorDao = getDao(map, AuthorDao.class); | |||
componentIndexDao = getDao(map, ResourceIndexDao.class); | |||
componentLinkDao = getDao(map, ComponentLinkDao.class); | |||
eventDao = getDao(map, EventDao.class); | |||
purgeDao = getDao(map, PurgeDao.class); | |||
@@ -300,10 +297,6 @@ public class DbClient { | |||
return authorDao; | |||
} | |||
public ResourceIndexDao componentIndexDao() { | |||
return componentIndexDao; | |||
} | |||
public ComponentLinkDao componentLinkDao() { | |||
return componentLinkDao; | |||
} |
@@ -41,8 +41,6 @@ import org.sonar.db.component.ComponentLinkMapper; | |||
import org.sonar.db.component.ComponentMapper; | |||
import org.sonar.db.component.FilePathWithHashDto; | |||
import org.sonar.db.component.ResourceDto; | |||
import org.sonar.db.component.ResourceIndexDto; | |||
import org.sonar.db.component.ResourceIndexMapper; | |||
import org.sonar.db.component.ResourceMapper; | |||
import org.sonar.db.component.SnapshotDto; | |||
import org.sonar.db.component.SnapshotMapper; | |||
@@ -102,6 +100,8 @@ import org.sonar.db.rule.RuleDto; | |||
import org.sonar.db.rule.RuleMapper; | |||
import org.sonar.db.rule.RuleParamDto; | |||
import org.sonar.db.rule.RuleRepositoryMapper; | |||
import org.sonar.db.schemamigration.SchemaMigrationDto; | |||
import org.sonar.db.schemamigration.SchemaMigrationMapper; | |||
import org.sonar.db.source.FileSourceMapper; | |||
import org.sonar.db.user.AuthorDto; | |||
import org.sonar.db.user.AuthorMapper; | |||
@@ -117,8 +117,6 @@ import org.sonar.db.user.UserMapper; | |||
import org.sonar.db.user.UserTokenCount; | |||
import org.sonar.db.user.UserTokenDto; | |||
import org.sonar.db.user.UserTokenMapper; | |||
import org.sonar.db.schemamigration.SchemaMigrationDto; | |||
import org.sonar.db.schemamigration.SchemaMigrationMapper; | |||
import org.sonar.db.webhook.WebhookDeliveryMapper; | |||
public class MyBatis { | |||
@@ -179,7 +177,6 @@ public class MyBatis { | |||
confBuilder.loadAlias("QualityGate", QualityGateDto.class); | |||
confBuilder.loadAlias("QualityProfile", QualityProfileDto.class); | |||
confBuilder.loadAlias("RequirementMigration", RequirementMigrationDto.class); | |||
confBuilder.loadAlias("ResourceIndex", ResourceIndexDto.class); | |||
confBuilder.loadAlias("Resource", ResourceDto.class); | |||
confBuilder.loadAlias("RuleParam", RuleParamDto.class); | |||
confBuilder.loadAlias("Rule", RuleDto.class); | |||
@@ -234,7 +231,6 @@ public class MyBatis { | |||
QualityGateConditionMapper.class, | |||
QualityGateMapper.class, | |||
QualityProfileMapper.class, | |||
ResourceIndexMapper.class, | |||
RoleMapper.class, | |||
RuleMapper.class, | |||
RuleRepositoryMapper.class, |
@@ -1,189 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2016 SonarSource SA | |||
* mailto:contact AT sonarsource DOT com | |||
* | |||
* This program 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. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public License | |||
* along with this program; if not, write to the Free Software Foundation, | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.db.component; | |||
import java.util.List; | |||
import org.apache.commons.lang.StringUtils; | |||
import org.apache.ibatis.session.SqlSession; | |||
import org.sonar.api.resources.Qualifiers; | |||
import org.sonar.api.resources.Scopes; | |||
import org.sonar.api.utils.System2; | |||
import org.sonar.db.AbstractDao; | |||
import org.sonar.db.DbSession; | |||
import org.sonar.db.MyBatis; | |||
import static org.apache.commons.lang.StringUtils.substring; | |||
public class ResourceIndexDao extends AbstractDao { | |||
private static final String SELECT_RESOURCES = "org.sonar.db.component.ResourceIndexMapper.selectResources"; | |||
public static final int MINIMUM_KEY_SIZE = 3; | |||
public static final int SINGLE_INDEX_SIZE = 2; | |||
/** | |||
* Length of db column RESOURCE_INDEX.KEE | |||
*/ | |||
private static final int MAXIMUM_KEY_SIZE = 400; | |||
// The scopes and qualifiers that are not in the following constants are not indexed at all. | |||
// Directories and packages are explicitly excluded. | |||
private static final String[] RENAMABLE_QUALIFIERS = {Qualifiers.PROJECT, Qualifiers.MODULE, Qualifiers.VIEW, Qualifiers.SUBVIEW}; | |||
private static final String[] RENAMABLE_SCOPES = {Scopes.PROJECT}; | |||
private static final String[] NOT_RENAMABLE_QUALIFIERS = {Qualifiers.FILE, Qualifiers.UNIT_TEST_FILE}; | |||
private static final String[] NOT_RENAMABLE_SCOPES = {Scopes.FILE}; | |||
public ResourceIndexDao(MyBatis myBatis, System2 system2) { | |||
super(myBatis, system2); | |||
} | |||
public List<Long> selectProjectIdsFromQueryAndViewOrSubViewUuid(DbSession session, String query, String viewOrSubViewUuid) { | |||
return session.getMapper(ResourceIndexMapper.class).selectProjectIdsFromQueryAndViewOrSubViewUuid(query + "%", "%." + viewOrSubViewUuid + ".%"); | |||
} | |||
/** | |||
* This method is reentrant. It can be executed even if the project is already indexed. | |||
*/ | |||
public ResourceIndexDao indexProject(String rootComponentUuid) { | |||
DbSession session = myBatis().openSession(true); | |||
try { | |||
indexProject(session, rootComponentUuid); | |||
session.commit(); | |||
return this; | |||
} finally { | |||
MyBatis.closeQuietly(session); | |||
} | |||
} | |||
public void indexProject(DbSession session, String rootComponentUuid) { | |||
ResourceIndexMapper mapper = session.getMapper(ResourceIndexMapper.class); | |||
doIndexProject(session, rootComponentUuid, mapper); | |||
} | |||
private void doIndexProject(DbSession session, String rootProjectUuid, final ResourceIndexMapper mapper) { | |||
// non indexed resources | |||
ResourceIndexQuery query = ResourceIndexQuery.create() | |||
.setNonIndexedOnly(true) | |||
.setQualifiers(NOT_RENAMABLE_QUALIFIERS) | |||
.setScopes(NOT_RENAMABLE_SCOPES) | |||
.setRootComponentUuid(rootProjectUuid); | |||
session.select(SELECT_RESOURCES, query, context -> { | |||
ResourceDto resource = (ResourceDto) context.getResultObject(); | |||
doIndex(resource, mapper); | |||
}); | |||
// some resources can be renamed, so index must be regenerated | |||
// -> delete existing rows and create them again | |||
query = ResourceIndexQuery.create() | |||
.setNonIndexedOnly(false) | |||
.setQualifiers(RENAMABLE_QUALIFIERS) | |||
.setScopes(RENAMABLE_SCOPES) | |||
.setRootComponentUuid(rootProjectUuid); | |||
session.select(SELECT_RESOURCES, query, context -> { | |||
ResourceDto resource = (ResourceDto) context.getResultObject(); | |||
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.getUuid(), resource.getQualifier(), resource.getProjectUuid(), resource.getName().length(), mapper); | |||
} | |||
} | |||
public boolean indexResource(DbSession session, String uuid) { | |||
boolean indexed = false; | |||
ResourceIndexMapper mapper = session.getMapper(ResourceIndexMapper.class); | |||
ResourceDto resource = mapper.selectResourceToIndex(uuid); | |||
if (resource != null) { | |||
String rootUuid = resource.getProjectUuid(); | |||
if (rootUuid == null) { | |||
rootUuid = resource.getUuid(); | |||
} | |||
indexed = indexResource(resource.getUuid(), resource.getName(), resource.getQualifier(), rootUuid, session, mapper); | |||
} | |||
return indexed; | |||
} | |||
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(uuid, name, qualifier, rootUuid, session, mapper); | |||
} finally { | |||
MyBatis.closeQuietly(session); | |||
} | |||
return indexed; | |||
} | |||
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(componentUuid, key, mapper); | |||
if (toBeIndexed) { | |||
insertIndexEntries(key, componentUuid, qualifier, rootUuid, name.length(), mapper); | |||
session.commit(); | |||
} | |||
} | |||
return indexed; | |||
} | |||
private static void insertIndexEntries(String key, String componentUuid, String qualifier, String rootId, int nameLength, ResourceIndexMapper mapper) { | |||
ResourceIndexDto dto = new ResourceIndexDto() | |||
.setComponentUuid(componentUuid) | |||
.setQualifier(qualifier) | |||
.setRootComponentUuid(rootId) | |||
.setNameSize(nameLength); | |||
int maxPosition = key.length() == SINGLE_INDEX_SIZE ? 0 : key.length() - MINIMUM_KEY_SIZE; | |||
for (int position = 0; position <= maxPosition; position++) { | |||
dto.setPosition(position); | |||
dto.setKey(substring(key, position, position + MAXIMUM_KEY_SIZE)); | |||
mapper.insert(dto); | |||
} | |||
} | |||
/** | |||
* Return true if the resource must be indexed, false if the resource is already indexed. | |||
* 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(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.deleteByComponentUuid(componentUuid); | |||
masterIndex = null; | |||
} | |||
return masterIndex == null; | |||
} | |||
static String nameToKey(String input) { | |||
return StringUtils.lowerCase(StringUtils.trimToEmpty(input)); | |||
} | |||
} |
@@ -1,93 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2016 SonarSource SA | |||
* mailto:contact AT sonarsource DOT com | |||
* | |||
* This program 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. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public License | |||
* along with this program; if not, write to the Free Software Foundation, | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.db.component; | |||
public final class ResourceIndexDto { | |||
private Long id; | |||
private String key; | |||
private int position; | |||
private int nameSize; | |||
private String componentUuid; | |||
private String rootComponentUuid; | |||
private String qualifier; | |||
public Long getId() { | |||
return id; | |||
} | |||
public ResourceIndexDto setId(Long id) { | |||
this.id = id; | |||
return this; | |||
} | |||
public String getKey() { | |||
return key; | |||
} | |||
public ResourceIndexDto setKey(String key) { | |||
this.key = key; | |||
return this; | |||
} | |||
public int getPosition() { | |||
return position; | |||
} | |||
public ResourceIndexDto setPosition(int i) { | |||
this.position = i; | |||
return this; | |||
} | |||
public String getComponentUuid() { | |||
return componentUuid; | |||
} | |||
public ResourceIndexDto setComponentUuid(String i) { | |||
this.componentUuid = i; | |||
return this; | |||
} | |||
public String getRootComponentUuid() { | |||
return rootComponentUuid; | |||
} | |||
public ResourceIndexDto setRootComponentUuid(String i) { | |||
this.rootComponentUuid = i; | |||
return this; | |||
} | |||
public int getNameSize() { | |||
return nameSize; | |||
} | |||
public ResourceIndexDto setNameSize(int i) { | |||
this.nameSize = i; | |||
return this; | |||
} | |||
public String getQualifier() { | |||
return qualifier; | |||
} | |||
public ResourceIndexDto setQualifier(String qualifier) { | |||
this.qualifier = qualifier; | |||
return this; | |||
} | |||
} |
@@ -1,36 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2016 SonarSource SA | |||
* mailto:contact AT sonarsource DOT com | |||
* | |||
* This program 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. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public License | |||
* along with this program; if not, write to the Free Software Foundation, | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.db.component; | |||
import java.util.List; | |||
import org.apache.ibatis.annotations.Param; | |||
public interface ResourceIndexMapper { | |||
List<Long> selectProjectIdsFromQueryAndViewOrSubViewUuid(@Param("query") String query, @Param("viewUuidQuery") String viewUuidQuery); | |||
ResourceIndexDto selectMasterIndexByComponentUuid(@Param("componentUuid") String componentUuid); | |||
ResourceDto selectResourceToIndex(@Param("componentUuid") String componentUuid); | |||
void deleteByComponentUuid(@Param("componentUuid") String componentUuid); | |||
void insert(ResourceIndexDto dto); | |||
} |
@@ -1,70 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2016 SonarSource SA | |||
* mailto:contact AT sonarsource DOT com | |||
* | |||
* This program 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. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public License | |||
* along with this program; if not, write to the Free Software Foundation, | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.db.component; | |||
final class ResourceIndexQuery { | |||
private String rootComponentUuid; | |||
private String[] scopes = null; | |||
private String[] qualifiers = null; | |||
private boolean nonIndexedOnly = false; | |||
private ResourceIndexQuery() { | |||
} | |||
public static ResourceIndexQuery create() { | |||
return new ResourceIndexQuery(); | |||
} | |||
public String[] getScopes() { | |||
return scopes; | |||
} | |||
public String[] getQualifiers() { | |||
return qualifiers; | |||
} | |||
public ResourceIndexQuery setScopes(String[] scopes) { | |||
this.scopes = scopes; | |||
return this; | |||
} | |||
public ResourceIndexQuery setQualifiers(String[] qualifiers) { | |||
this.qualifiers = qualifiers; | |||
return this; | |||
} | |||
public String getRootComponentUuid() { | |||
return rootComponentUuid; | |||
} | |||
public ResourceIndexQuery setRootComponentUuid(String rootComponentUuid) { | |||
this.rootComponentUuid = rootComponentUuid; | |||
return this; | |||
} | |||
public boolean isNonIndexedOnly() { | |||
return nonIndexedOnly; | |||
} | |||
public ResourceIndexQuery setNonIndexedOnly(boolean b) { | |||
this.nonIndexedOnly = b; | |||
return this; | |||
} | |||
} |
@@ -79,11 +79,6 @@ class PurgeCommands { | |||
session.commit(); | |||
profiler.stop(); | |||
profiler.start("deleteResourceIndex (resource_index)"); | |||
componentUuidsPartitions.forEach(purgeMapper::deleteResourceIndex); | |||
session.commit(); | |||
profiler.stop(); | |||
profiler.start("deleteResourceGroupRoles (group_roles)"); | |||
componentIdPartitions.forEach(purgeMapper::deleteComponentGroupRoles); | |||
session.commit(); |
@@ -127,7 +127,6 @@ public class PurgeDao implements Dao { | |||
PurgeMapper mapper = mapper(session); | |||
executeLargeInputs(uuids, | |||
input -> { | |||
mapper.deleteResourceIndex(input); | |||
mapper.deleteFileSourcesByUuid(input); | |||
mapper.resolveComponentIssuesNotAlreadyResolved(input, system2.now()); | |||
return emptyList(); |
@@ -52,8 +52,6 @@ public interface PurgeMapper { | |||
void resolveComponentIssuesNotAlreadyResolved(@Param("componentUuids") List<String> componentUuids, @Param("dateAsLong") Long dateAsLong); | |||
void deleteResourceIndex(@Param("componentUuids") List<String> componentUuids); | |||
void deleteComponentLinks(@Param("componentUuids") List<String> componentUuids); | |||
void deleteComponentProperties(@Param("componentIds") List<Long> componentIds); |
@@ -1,82 +0,0 @@ | |||
<?xml version="1.0" encoding="UTF-8" ?> | |||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||
<mapper namespace="org.sonar.db.component.ResourceIndexMapper"> | |||
<select id="selectProjectIdsFromQueryAndViewOrSubViewUuid" parameterType="map" resultType="long"> | |||
SELECT original.id FROM resource_index r | |||
INNER JOIN projects original ON r.component_uuid = original.uuid | |||
INNER JOIN projects copy ON original.uuid = copy.copy_component_uuid | |||
<where> | |||
AND copy.module_uuid_path LIKE #{viewUuidQuery} | |||
AND r.kee LIKE #{query} | |||
</where> | |||
ORDER BY r.name_size | |||
</select> | |||
<select id="selectResources" parameterType="map" resultType="Resource"> | |||
select | |||
p.name as "name", p.id as "id", p.uuid as "uuid", p.scope as "scope", p.qualifier as "qualifier", p.project_uuid as "projectUuid" | |||
from projects p, snapshots s | |||
<where> | |||
p.enabled=${_true} | |||
and p.copy_component_uuid is null | |||
and p.project_uuid=s.component_uuid | |||
and s.islast=${_true} | |||
<if test="scopes != null"> | |||
and p.scope in | |||
<foreach item="scope" index="index" collection="scopes" open="(" separator="," close=")">#{scope}</foreach> | |||
</if> | |||
<if test="qualifiers != null"> | |||
and p.qualifier in | |||
<foreach item="qualifier" index="index" collection="qualifiers" open="(" separator="," close=")">#{qualifier} | |||
</foreach> | |||
</if> | |||
<if test="rootComponentUuid != null"> | |||
and p.project_uuid=#{rootComponentUuid} | |||
</if> | |||
<if test="nonIndexedOnly"> | |||
and not exists(select * from resource_index ri where ri.component_uuid=p.uuid) | |||
</if> | |||
</where> | |||
order by p.id | |||
</select> | |||
<select id="selectMasterIndexByComponentUuid" parameterType="String" resultType="ResourceIndex"> | |||
select kee as "key", component_uuid as "componentUuid" | |||
from resource_index | |||
where component_uuid=#{componentUuid} and position=0 | |||
</select> | |||
<select id="selectResourceToIndex" parameterType="String" resultType="Resource"> | |||
select p.id, p.uuid as "uuid", p.name, p.project_uuid as "projectUuid", p.qualifier | |||
from projects p | |||
where | |||
p.uuid=#{componentUuid} | |||
and p.enabled=${_true} | |||
</select> | |||
<delete id="deleteByComponentUuid" parameterType="String"> | |||
delete from resource_index | |||
where component_uuid=#{componentUuid} | |||
</delete> | |||
<insert id="insert" parameterType="ResourceIndex" useGeneratedKeys="false"> | |||
insert into resource_index ( | |||
kee, | |||
position, | |||
name_size, | |||
component_uuid, | |||
root_component_uuid, | |||
qualifier) | |||
values ( | |||
#{key, jdbcType=VARCHAR}, | |||
#{position, jdbcType=INTEGER}, | |||
#{nameSize, jdbcType=INTEGER}, | |||
#{componentUuid, jdbcType=VARCHAR}, | |||
#{rootComponentUuid, jdbcType=VARCHAR}, | |||
#{qualifier, jdbcType=VARCHAR} | |||
) | |||
</insert> | |||
</mapper> | |||
@@ -160,15 +160,6 @@ | |||
and resolution is null | |||
</update> | |||
<delete id="deleteResourceIndex" parameterType="map"> | |||
delete from resource_index | |||
where | |||
component_uuid in | |||
<foreach collection="componentUuids" open="(" close=")" item="componentUuid" separator=","> | |||
#{componentUuid,jdbcType=VARCHAR} | |||
</foreach> | |||
</delete> | |||
<delete id="deleteComponentLinks" parameterType="map"> | |||
delete from project_links | |||
where |
@@ -29,6 +29,6 @@ public class DaoModuleTest { | |||
public void verify_count_of_added_components() { | |||
ComponentContainer container = new ComponentContainer(); | |||
new DaoModule().configure(container); | |||
assertThat(container.size()).isEqualTo(2 + 46); | |||
assertThat(container.size()).isEqualTo(2 + 45); | |||
} | |||
} |
@@ -790,7 +790,6 @@ public class ComponentDaoTest { | |||
for (int i = 9; i >= 1; i--) { | |||
componentDb.insertProjectAndSnapshot(newProjectDto(organizationDto).setName("project-" + i)); | |||
} | |||
componentDb.indexAllComponents(); | |||
ComponentQuery query = ComponentQuery.builder().setNameOrKeyQuery("oJect").setQualifiers(Qualifiers.PROJECT).build(); | |||
List<ComponentDto> result = underTest.selectByQuery(dbSession, query, 1, 3); | |||
@@ -805,7 +804,6 @@ public class ComponentDaoTest { | |||
@Test | |||
public void select_by_query_name_with_special_characters() { | |||
componentDb.insertProjectAndSnapshot(newProjectDto(db.getDefaultOrganization()).setName("project-\\_%/-name")); | |||
componentDb.indexAllComponents(); | |||
ComponentQuery query = ComponentQuery.builder().setNameOrKeyQuery("-\\_%/-").setQualifiers(Qualifiers.PROJECT).build(); | |||
List<ComponentDto> result = underTest.selectByQuery(dbSession, query, 0, 10); | |||
@@ -817,7 +815,6 @@ public class ComponentDaoTest { | |||
@Test | |||
public void select_by_query_key_with_special_characters() { | |||
componentDb.insertProjectAndSnapshot(newProjectDto(db.organizations().insert()).setKey("project-_%-key")); | |||
componentDb.indexAllComponents(); | |||
ComponentQuery query = ComponentQuery.builder().setNameOrKeyQuery("project-_%-key").setQualifiers(Qualifiers.PROJECT).build(); | |||
List<ComponentDto> result = underTest.selectByQuery(dbSession, query, 0, 10); | |||
@@ -904,7 +901,6 @@ public class ComponentDaoTest { | |||
ComponentDto file3 = newFileDto(module, null, FILE_3_UUID).setKey("file-key-3").setName("File Three"); | |||
componentDb.insertComponent(file3); | |||
db.commit(); | |||
componentDb.indexAllComponents(); | |||
// test children of root | |||
ComponentTreeQuery query = newTreeQuery(PROJECT_UUID).build(); | |||
@@ -965,7 +961,6 @@ public class ComponentDaoTest { | |||
componentDb.insertComponent(newFileDto(project, null, "file-1-uuid")); | |||
componentDb.insertComponent(newFileDto(project, null, "file-2-uuid")); | |||
db.commit(); | |||
componentDb.indexAllComponents(); | |||
ComponentTreeQuery query = newTreeQuery(PROJECT_UUID).setStrategy(LEAVES).build(); | |||
@@ -993,7 +988,6 @@ public class ComponentDaoTest { | |||
ComponentDto project = newProjectDto(organizationDto, PROJECT_UUID).setName("project name"); | |||
componentDb.insertProjectAndSnapshot(project); | |||
componentDb.insertComponent(newProjectCopy("project-copy-uuid", project, view)); | |||
componentDb.indexAllComponents(); | |||
ComponentTreeQuery dbQuery = newTreeQuery(A_VIEW_UUID).setNameOrKeyQuery("name").setStrategy(CHILDREN).build(); | |||
List<ComponentDto> components = underTest.selectDescendants(dbSession, dbQuery); |
@@ -19,9 +19,7 @@ | |||
*/ | |||
package org.sonar.db.component; | |||
import java.util.List; | |||
import java.util.function.Consumer; | |||
import org.sonar.api.resources.Qualifiers; | |||
import org.sonar.db.DbClient; | |||
import org.sonar.db.DbSession; | |||
import org.sonar.db.DbTester; | |||
@@ -121,7 +119,8 @@ public class ComponentDbTester { | |||
} | |||
private static <T> Consumer<T> noExtraConfiguration() { | |||
return (t) -> {}; | |||
return (t) -> { | |||
}; | |||
} | |||
private ComponentDto insertComponentImpl(ComponentDto component, Consumer<ComponentDto> dtoPopulator) { | |||
@@ -137,25 +136,7 @@ public class ComponentDbTester { | |||
db.commit(); | |||
} | |||
public void indexAllComponents() { | |||
ComponentQuery dbQuery = ComponentQuery.builder() | |||
.setQualifiers(Qualifiers.PROJECT, Qualifiers.VIEW, "DEV") | |||
.build(); | |||
List<ComponentDto> rootProjects = dbClient.componentDao().selectByQuery(dbSession, dbQuery, 0, Integer.MAX_VALUE); | |||
for (ComponentDto project : rootProjects) { | |||
dbClient.componentIndexDao().indexProject(dbSession, project.uuid()); | |||
} | |||
db.commit(); | |||
} | |||
public void indexComponents(String... componentUuids) { | |||
for (String componentUuid : componentUuids) { | |||
dbClient.componentIndexDao().indexResource(dbSession, componentUuid); | |||
} | |||
db.commit(); | |||
} | |||
public SnapshotDto insertSnapshot(SnapshotDto snapshotDto){ | |||
public SnapshotDto insertSnapshot(SnapshotDto snapshotDto) { | |||
SnapshotDto snapshot = dbClient.snapshotDao().insert(dbSession, snapshotDto); | |||
db.commit(); | |||
return snapshot; |
@@ -1,164 +0,0 @@ | |||
/* | |||
* SonarQube | |||
* Copyright (C) 2009-2016 SonarSource SA | |||
* mailto:contact AT sonarsource DOT com | |||
* | |||
* This program 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. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |||
* Lesser General Public License for more details. | |||
* | |||
* You should have received a copy of the GNU Lesser General Public License | |||
* along with this program; if not, write to the Free Software Foundation, | |||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |||
*/ | |||
package org.sonar.db.component; | |||
import org.junit.Rule; | |||
import org.junit.Test; | |||
import org.sonar.api.resources.Qualifiers; | |||
import org.sonar.api.utils.System2; | |||
import org.sonar.db.DbSession; | |||
import org.sonar.db.DbTester; | |||
import static org.apache.commons.lang.StringUtils.repeat; | |||
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); | |||
ResourceIndexDao underTest = dbTester.getDbClient().componentIndexDao(); | |||
@Test | |||
public void shouldIndexResource() { | |||
dbTester.prepareDbUnit(getClass(), "shouldIndexResource.xml"); | |||
underTest.indexResource(CPT_UUID, "ZipUtils", "FIL", ROOT_UUID); | |||
dbTester.assertDbUnit(getClass(), "shouldIndexResource-result.xml", EXCLUDED_ID_COLUMN, "resource_index"); | |||
} | |||
@Test | |||
public void shouldIndexMultiModulesProject() { | |||
dbTester.prepareDbUnit(getClass(), "shouldIndexMultiModulesProject.xml"); | |||
underTest.indexProject("ABCD"); | |||
dbTester.assertDbUnit(getClass(), "shouldIndexMultiModulesProject-result.xml", EXCLUDED_ID_COLUMN, "resource_index"); | |||
} | |||
@Test | |||
public void shouldReindexProjectAfterRenaming() { | |||
dbTester.prepareDbUnit(getClass(), "shouldReindexProjectAfterRenaming.xml"); | |||
underTest.indexProject("ABCD"); | |||
dbTester.assertDbUnit(getClass(), "shouldReindexProjectAfterRenaming-result.xml", EXCLUDED_ID_COLUMN, "resource_index"); | |||
} | |||
@Test | |||
public void shouldNotIndexDirectories() { | |||
dbTester.prepareDbUnit(getClass(), "shouldNotIndexPackages.xml"); | |||
underTest.indexProject("ABCD"); | |||
// project | |||
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 component_uuid='BCDE'")).isEqualTo(0); | |||
// file | |||
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(CPT_UUID, "AB", Qualifiers.PROJECT, ROOT_UUID); | |||
dbTester.assertDbUnit(getClass(), "shouldIndexTwoLettersLongResource-result.xml", EXCLUDED_ID_COLUMN, "resource_index"); | |||
} | |||
@Test | |||
public void shouldReIndexTwoLettersLongResources() { | |||
dbTester.prepareDbUnit(getClass(), "shouldReIndexTwoLettersLongResource.xml"); | |||
underTest.indexResource(ROOT_UUID, "AS", Qualifiers.PROJECT, ROOT_UUID); | |||
dbTester.assertDbUnit(getClass(), "shouldReIndexTwoLettersLongResource-result.xml", EXCLUDED_ID_COLUMN, "resource_index"); | |||
} | |||
@Test | |||
public void shouldReIndexNewTwoLettersLongResource() { | |||
dbTester.prepareDbUnit(getClass(), "shouldReIndexNewTwoLettersLongResource.xml"); | |||
underTest.indexResource(ROOT_UUID, "AS", Qualifiers.PROJECT, ROOT_UUID); | |||
dbTester.assertDbUnit(getClass(), "shouldReIndexNewTwoLettersLongResource-result.xml", EXCLUDED_ID_COLUMN, "resource_index"); | |||
} | |||
@Test | |||
public void shouldReindexResource() { | |||
dbTester.prepareDbUnit(getClass(), "shouldReindexResource.xml"); | |||
underTest.indexResource(ROOT_UUID, "New Struts", Qualifiers.PROJECT, ROOT_UUID); | |||
dbTester.assertDbUnit(getClass(), "shouldReindexResource-result.xml", EXCLUDED_ID_COLUMN, "resource_index"); | |||
} | |||
@Test | |||
public void shouldNotReindexUnchangedResource() { | |||
dbTester.prepareDbUnit(getClass(), "shouldNotReindexUnchangedResource.xml"); | |||
underTest.indexResource(ROOT_UUID, "Struts", Qualifiers.PROJECT, ROOT_UUID); | |||
dbTester.assertDbUnit(getClass(), "shouldNotReindexUnchangedResource-result.xml", EXCLUDED_ID_COLUMN, "resource_index"); | |||
} | |||
@Test | |||
public void select_project_ids_from_query_and_view_or_sub_view_uuid() { | |||
dbTester.prepareDbUnit(getClass(), "select_project_ids_from_query_and_view_or_sub_view_uuid.xml"); | |||
String viewUuid = "EFGH"; | |||
DbSession session = dbTester.getSession(); | |||
assertThat(underTest.selectProjectIdsFromQueryAndViewOrSubViewUuid(session, "project", viewUuid)).containsOnly(1L, 2L); | |||
assertThat(underTest.selectProjectIdsFromQueryAndViewOrSubViewUuid(session, "one", viewUuid)).containsOnly(1L); | |||
assertThat(underTest.selectProjectIdsFromQueryAndViewOrSubViewUuid(session, "two", viewUuid)).containsOnly(2L); | |||
assertThat(underTest.selectProjectIdsFromQueryAndViewOrSubViewUuid(session, "unknown", viewUuid)).isEmpty(); | |||
} | |||
/** | |||
* SONAR-7594 | |||
* PROJECTS.NAME is 2'000 characters long whereas RESOURCE_INDEX.KEE is only 400 characters. As there's no functional need | |||
* to increase size of the latter column, indexed values must be truncated. | |||
*/ | |||
@Test | |||
public void restrict_indexed_combinations_to_400_characters() { | |||
String longName = repeat("a", 2_000); | |||
ComponentDto project = ComponentTesting.newProjectDto(dbTester.getDefaultOrganization(), ROOT_UUID) | |||
.setProjectUuid(ROOT_UUID) | |||
.setName(longName); | |||
DbSession session = dbTester.getSession(); | |||
dbTester.getDbClient().componentDao().insert(session, project); | |||
dbTester.getDbClient().snapshotDao().insert(session, new SnapshotDto() | |||
.setUuid("u1") | |||
.setComponentUuid(project.uuid()) | |||
.setLast(true)); | |||
underTest.indexProject(session, project.uuid()); | |||
session.commit(); | |||
assertThat(dbTester.countRowsOfTable("resource_index")).isEqualTo(longName.length() - ResourceIndexDao.MINIMUM_KEY_SIZE + 1); | |||
} | |||
} |
@@ -372,7 +372,6 @@ public class MeasureDaoTest { | |||
ComponentDto file1 = db.components().insertComponent(newFileDto(module1).setUuid("C1").setName("File One")); | |||
db.components().insertComponent(newFileDto(module2).setUuid("C2").setName("File Two").setQualifier(UNIT_TEST_FILE)); | |||
insertAnalysis(LAST_ANALYSIS_UUID, project.uuid(), true); | |||
db.components().indexAllComponents(); | |||
// project | |||
insertMeasure("PROJECT_M1", LAST_ANALYSIS_UUID, project.uuid(), NCLOC_METRIC_ID); | |||
@@ -423,7 +422,6 @@ public class MeasureDaoTest { | |||
db.components().insertComponent(newFileDto(project).setUuid("C2").setName("File Two").setQualifier(UNIT_TEST_FILE)); | |||
insertAnalysis(LAST_ANALYSIS_UUID, project.uuid(), true); | |||
insertAnalysis(OTHER_ANALYSIS_UUID, project.uuid(), false); | |||
db.components().indexAllComponents(); | |||
// project | |||
insertMeasure("PROJECT_M1", LAST_ANALYSIS_UUID, project.uuid(), NCLOC_METRIC_ID); | |||
@@ -455,7 +453,6 @@ public class MeasureDaoTest { | |||
ComponentDto project = db.components().insertProject(); | |||
insertAnalysis(LAST_ANALYSIS_UUID, project.uuid(), true); | |||
insertAnalysis(OTHER_ANALYSIS_UUID, project.uuid(), false); | |||
db.components().indexAllComponents(); | |||
// project | |||
insertMeasure("PROJECT_M1", LAST_ANALYSIS_UUID, project.uuid(), NCLOC_METRIC_ID); |
@@ -1,189 +0,0 @@ | |||
<dataset>IncreasePrecisionOfNumericsTest.update_column_types:48 | |||
<!-- Real projects --> | |||
<projects organization_uuid="org1" | |||
id="1" | |||
uuid="ABCD" | |||
uuid_path="NOT_USED" | |||
root_uuid="ABCD" | |||
project_uuid="ABCD" | |||
module_uuid_path=".ABCD." | |||
kee="project-one" | |||
copy_component_uuid="[null]" | |||
name="Project One" | |||
qualifier="TRK" | |||
scope="PRJ"/> | |||
<projects organization_uuid="org1" | |||
id="2" | |||
uuid="BCDE" | |||
uuid_path="NOT_USED" | |||
root_uuid="BCDE" | |||
project_uuid="BCDE" | |||
module_uuid_path=".BCDE." | |||
kee="project-two" | |||
copy_component_uuid="[null]" | |||
name="Project Two" | |||
qualifier="TRK" | |||
scope="PRJ"/> | |||
<!-- Copy projects --> | |||
<projects organization_uuid="org1" | |||
id="3" | |||
uuid="CDEF" | |||
uuid_path="NOT_USED" | |||
root_uuid="EFGH" | |||
project_uuid="EFGH" | |||
module_uuid_path=".EFGH." | |||
kee="copy-project-one" | |||
copy_component_uuid="ABCD" | |||
name="Copy Project One" | |||
qualifier="TRK" | |||
scope="FIL"/> | |||
<projects organization_uuid="org1" | |||
id="4" | |||
uuid="DEFG" | |||
uuid_path="NOT_USED" | |||
root_uuid="EFGH" | |||
project_uuid="EFGH" | |||
module_uuid_path=".EFGH." | |||
kee="copy-project-two" | |||
copy_component_uuid="BCDE" | |||
name="Copy Project One" | |||
qualifier="TRK" | |||
scope="FIL"/> | |||
<!-- View containing all projects --> | |||
<projects organization_uuid="org1" | |||
id="5" | |||
uuid="EFGH" | |||
uuid_path="NOT_USED" | |||
root_uuid="EFGH" | |||
project_uuid="EFGH" | |||
module_uuid_path=".EFGH." | |||
kee="all-projects" | |||
copy_component_uuid="[null]" | |||
name="All projects" | |||
qualifier="VW" | |||
scope="PRJ"/> | |||
<resource_index id="1" | |||
kee="project one" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
position="0" | |||
name_size="11" | |||
qualifier="TRK"/> | |||
<resource_index id="2" | |||
kee="roject one" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
position="1" | |||
name_size="11" | |||
qualifier="TRK"/> | |||
<resource_index id="3" | |||
kee="oject one" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
position="2" | |||
name_size="11" | |||
qualifier="TRK"/> | |||
<resource_index id="4" | |||
kee="ject one" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
position="3" | |||
name_size="11" | |||
qualifier="TRK"/> | |||
<resource_index id="5" | |||
kee="ect one" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
position="4" | |||
name_size="11" | |||
qualifier="TRK"/> | |||
<resource_index id="6" | |||
kee="ct one" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
position="5" | |||
name_size="11" | |||
qualifier="TRK"/> | |||
<resource_index id="7" | |||
kee="t one" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
position="6" | |||
name_size="11" | |||
qualifier="TRK"/> | |||
<resource_index id="8" | |||
kee=" one" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
position="7" | |||
name_size="11" | |||
qualifier="TRK"/> | |||
<resource_index id="9" | |||
kee="one" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
position="8" | |||
name_size="11" | |||
qualifier="TRK"/> | |||
<resource_index id="10" | |||
kee="project two" | |||
component_uuid="BCDE" | |||
root_component_uuid="BCDE" | |||
position="0" | |||
name_size="11" | |||
qualifier="TRK"/> | |||
<resource_index id="11" | |||
kee="roject two" | |||
component_uuid="BCDE" | |||
root_component_uuid="BCDE" | |||
position="1" | |||
name_size="11" | |||
qualifier="TRK"/> | |||
<resource_index id="12" | |||
kee="oject two" | |||
component_uuid="BCDE" | |||
root_component_uuid="BCDE" | |||
position="2" | |||
name_size="11" | |||
qualifier="TRK"/> | |||
<resource_index id="13" | |||
kee="ject two" | |||
component_uuid="BCDE" | |||
root_component_uuid="BCDE" | |||
position="3" | |||
name_size="11" | |||
qualifier="TRK"/> | |||
<resource_index id="14" | |||
kee="ect two" | |||
component_uuid="BCDE" | |||
root_component_uuid="BCDE" | |||
position="4" | |||
name_size="11" | |||
qualifier="TRK"/> | |||
<resource_index id="15" | |||
kee="ct two" | |||
component_uuid="BCDE" | |||
root_component_uuid="BCDE" | |||
position="5" | |||
name_size="11" | |||
qualifier="TRK"/> | |||
<resource_index id="16" | |||
kee="t two" | |||
component_uuid="BCDE" | |||
root_component_uuid="BCDE" | |||
position="6" | |||
name_size="11" | |||
qualifier="TRK"/> | |||
<resource_index id="17" | |||
kee="two" | |||
component_uuid="BCDE" | |||
root_component_uuid="BCDE" | |||
position="7" | |||
name_size="11" | |||
qualifier="TRK"/> | |||
</dataset> |
@@ -1,262 +0,0 @@ | |||
<dataset> | |||
<!-- project "struts" -> module "struts-core" -> package org.struts -> file "RequestContext" --> | |||
<projects organization_uuid="org1" | |||
long_name="[null]" | |||
id="1" | |||
scope="PRJ" | |||
qualifier="TRK" | |||
kee="org.struts:struts" | |||
name="Struts" | |||
uuid="ABCD" | |||
project_uuid="ABCD" | |||
module_uuid="[null]" | |||
module_uuid_path="." | |||
root_id="[null]" | |||
description="[null]" | |||
enabled="[true]" | |||
language="java" | |||
copy_resource_id="[null]" | |||
person_id="[null]"/> | |||
<projects organization_uuid="org1" | |||
long_name="[null]" | |||
id="2" | |||
scope="PRJ" | |||
qualifier="BRC" | |||
kee="org.struts:struts-core" | |||
name="Struts Core" | |||
uuid="BCDE" | |||
uuid_path="NOT_USED" | |||
project_uuid="ABCD" | |||
module_uuid="ABCD" | |||
module_uuid_path=".ABCD." | |||
root_id="1" | |||
description="[null]" | |||
enabled="[true]" | |||
language="java" | |||
copy_resource_id="[null]" | |||
person_id="[null]"/> | |||
<!-- note that the root_id of package/file is wrong. It references the module but not the root project --> | |||
<projects organization_uuid="org1" | |||
long_name="org.struts" | |||
id="3" | |||
scope="DIR" | |||
qualifier="DIR" | |||
kee="org.struts:struts-core:org.struts" | |||
uuid="CDEF" | |||
uuid_path="NOT_USED" | |||
project_uuid="ABCD" | |||
module_uuid="BCDE" | |||
module_uuid_path=".ABCD.BCDE" | |||
name="org.struts" | |||
root_id="2" | |||
description="[null]" | |||
enabled="[true]" | |||
language="java" | |||
copy_resource_id="[null]" | |||
person_id="[null]"/> | |||
<projects organization_uuid="org1" | |||
long_name="org.struts.RequestContext" | |||
id="4" | |||
scope="FIL" | |||
qualifier="FIL" | |||
uuid="DEFG" | |||
uuid_path="NOT_USED" | |||
project_uuid="ABCD" | |||
module_uuid="BCDE" | |||
module_uuid_path=".ABCD.BCDE" | |||
kee="org.struts:struts-core:org.struts.RequestContext" | |||
name="RequestContext" | |||
root_id="2" | |||
description="[null]" | |||
enabled="[true]" | |||
language="java" | |||
copy_resource_id="[null]" | |||
person_id="[null]"/> | |||
<snapshots purge_status="[null]" | |||
id="1" | |||
uuid="u1" | |||
islast="[true]" | |||
project_id="1"/> | |||
<snapshots purge_status="[null]" | |||
id="2" | |||
uuid="u2" | |||
islast="[true]" | |||
project_id="2"/> | |||
<snapshots purge_status="[null]" | |||
id="3" | |||
uuid="u3" | |||
islast="[true]" | |||
root_component_uuid="ABCD" | |||
project_id="3"/> | |||
<snapshots purge_status="[null]" | |||
id="4" | |||
uuid="u4" | |||
islast="[true]" | |||
root_component_uuid="ABCD" | |||
project_id="4"/> | |||
<!-- The major goal is to test root_project_id --> | |||
<!-- RequestContext --> | |||
<resource_index kee="requestcontext" | |||
position="0" | |||
name_size="14" | |||
component_uuid="DEFG" | |||
root_component_uuid="ABCD" | |||
qualifier="FIL"/> | |||
<resource_index kee="equestcontext" | |||
position="1" | |||
name_size="14" | |||
component_uuid="DEFG" | |||
root_component_uuid="ABCD" | |||
qualifier="FIL"/> | |||
<resource_index kee="questcontext" | |||
position="2" | |||
name_size="14" | |||
component_uuid="DEFG" | |||
root_component_uuid="ABCD" | |||
qualifier="FIL"/> | |||
<resource_index kee="uestcontext" | |||
position="3" | |||
name_size="14" | |||
component_uuid="DEFG" | |||
root_component_uuid="ABCD" | |||
qualifier="FIL"/> | |||
<resource_index kee="estcontext" | |||
position="4" | |||
name_size="14" | |||
component_uuid="DEFG" | |||
root_component_uuid="ABCD" | |||
qualifier="FIL"/> | |||
<resource_index kee="stcontext" | |||
position="5" | |||
name_size="14" | |||
component_uuid="DEFG" | |||
root_component_uuid="ABCD" | |||
qualifier="FIL"/> | |||
<resource_index kee="tcontext" | |||
position="6" | |||
name_size="14" | |||
component_uuid="DEFG" | |||
root_component_uuid="ABCD" | |||
qualifier="FIL"/> | |||
<resource_index kee="context" | |||
position="7" | |||
name_size="14" | |||
component_uuid="DEFG" | |||
root_component_uuid="ABCD" | |||
qualifier="FIL"/> | |||
<resource_index kee="ontext" | |||
position="8" | |||
name_size="14" | |||
component_uuid="DEFG" | |||
root_component_uuid="ABCD" | |||
qualifier="FIL"/> | |||
<resource_index kee="ntext" | |||
position="9" | |||
name_size="14" | |||
component_uuid="DEFG" | |||
root_component_uuid="ABCD" | |||
qualifier="FIL"/> | |||
<resource_index kee="text" | |||
position="10" | |||
name_size="14" | |||
component_uuid="DEFG" | |||
root_component_uuid="ABCD" | |||
qualifier="FIL"/> | |||
<resource_index kee="ext" | |||
position="11" | |||
name_size="14" | |||
component_uuid="DEFG" | |||
root_component_uuid="ABCD" | |||
qualifier="FIL"/> | |||
<!-- Struts --> | |||
<resource_index kee="struts" | |||
position="0" | |||
name_size="6" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
<resource_index kee="truts" | |||
position="1" | |||
name_size="6" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
<resource_index kee="ruts" | |||
position="2" | |||
name_size="6" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
<resource_index kee="uts" | |||
position="3" | |||
name_size="6" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
<!-- Struts Core --> | |||
<resource_index kee="struts core" | |||
position="0" | |||
name_size="11" | |||
component_uuid="BCDE" | |||
root_component_uuid="ABCD" | |||
qualifier="BRC"/> | |||
<resource_index kee="truts core" | |||
position="1" | |||
name_size="11" | |||
component_uuid="BCDE" | |||
root_component_uuid="ABCD" | |||
qualifier="BRC"/> | |||
<resource_index kee="ruts core" | |||
position="2" | |||
name_size="11" | |||
component_uuid="BCDE" | |||
root_component_uuid="ABCD" | |||
qualifier="BRC"/> | |||
<resource_index kee="uts core" | |||
position="3" | |||
name_size="11" | |||
component_uuid="BCDE" | |||
root_component_uuid="ABCD" | |||
qualifier="BRC"/> | |||
<resource_index kee="ts core" | |||
position="4" | |||
name_size="11" | |||
component_uuid="BCDE" | |||
root_component_uuid="ABCD" | |||
qualifier="BRC"/> | |||
<resource_index kee="s core" | |||
position="5" | |||
name_size="11" | |||
component_uuid="BCDE" | |||
root_component_uuid="ABCD" | |||
qualifier="BRC"/> | |||
<resource_index kee=" core" | |||
position="6" | |||
name_size="11" | |||
component_uuid="BCDE" | |||
root_component_uuid="ABCD" | |||
qualifier="BRC"/> | |||
<resource_index kee="core" | |||
position="7" | |||
name_size="11" | |||
component_uuid="BCDE" | |||
root_component_uuid="ABCD" | |||
qualifier="BRC"/> | |||
<resource_index kee="ore" | |||
position="8" | |||
name_size="11" | |||
component_uuid="BCDE" | |||
root_component_uuid="ABCD" | |||
qualifier="BRC"/> | |||
</dataset> |
@@ -1,93 +0,0 @@ | |||
<dataset> | |||
<!-- project "struts" -> module "struts-core" -> package org.struts -> file "RequestContext" --> | |||
<projects organization_uuid="org1" | |||
long_name="[null]" | |||
id="1" | |||
scope="PRJ" | |||
qualifier="TRK" | |||
kee="org.struts:struts" | |||
name="Struts" | |||
uuid="ABCD" | |||
uuid_path="NOT_USED" | |||
project_uuid="ABCD" | |||
module_uuid="[null]" | |||
module_uuid_path="." | |||
root_uuid="ABCD" | |||
description="[null]" | |||
enabled="[true]" | |||
language="java"/> | |||
<projects organization_uuid="org1" | |||
long_name="[null]" | |||
id="2" | |||
scope="PRJ" | |||
qualifier="BRC" | |||
kee="org.struts:struts-core" | |||
name="Struts Core" | |||
uuid="BCDE" | |||
uuid_path="NOT_USED" | |||
project_uuid="ABCD" | |||
module_uuid="ABCD" | |||
module_uuid_path=".ABCD." | |||
root_uuid="ABCD" | |||
description="[null]" | |||
enabled="[true]" | |||
language="java"/> | |||
<!-- note that the root_id of package/file is wrong. It references the module but not the root project --> | |||
<projects organization_uuid="org1" | |||
long_name="org.struts" | |||
id="3" | |||
scope="DIR" | |||
qualifier="DIR" | |||
kee="org.struts:struts-core:org.struts" | |||
uuid="CDEF" | |||
uuid_path="NOT_USED" | |||
project_uuid="ABCD" | |||
module_uuid="BCDE" | |||
module_uuid_path=".ABCD.BCDE" | |||
name="org.struts" | |||
root_uuid="BCDE" | |||
description="[null]" | |||
enabled="[true]" | |||
language="java"/> | |||
<projects organization_uuid="org1" | |||
long_name="org.struts.RequestContext" | |||
id="4" | |||
scope="FIL" | |||
qualifier="FIL" | |||
uuid="DEFG" | |||
uuid_path="NOT_USED" | |||
project_uuid="ABCD" | |||
module_uuid="BCDE" | |||
module_uuid_path=".ABCD.BCDE" | |||
kee="org.struts:struts-core:org.struts.RequestContext" | |||
name="RequestContext" | |||
root_uuid="BCDE" | |||
description="[null]" | |||
enabled="[true]" | |||
language="java"/> | |||
<snapshots purge_status="[null]" | |||
id="1" | |||
uuid="u1" | |||
islast="[true]" | |||
component_uuid="ABCD"/> | |||
<snapshots purge_status="[null]" | |||
id="2" | |||
uuid="u2" | |||
islast="[true]" | |||
component_uuid="BCDE"/> | |||
<snapshots purge_status="[null]" | |||
id="3" | |||
uuid="u3" | |||
islast="[true]" | |||
component_uuid="CDEF"/> | |||
<snapshots purge_status="[null]" | |||
id="4" | |||
uuid="u4" | |||
islast="[true]" | |||
component_uuid="DEFG"/> | |||
</dataset> |
@@ -1,169 +0,0 @@ | |||
<dataset> | |||
<!-- project --> | |||
<projects organization_uuid="org1" | |||
long_name="[null]" | |||
id="1" | |||
scope="PRJ" | |||
qualifier="TRK" | |||
kee="org.struts:struts" | |||
name="Struts" | |||
uuid="ABCD" | |||
project_uuid="ABCD" | |||
module_uuid="[null]" | |||
module_uuid_path="." | |||
root_id="[null]" | |||
description="[null]" | |||
enabled="[true]" | |||
language="java" | |||
copy_resource_id="[null]" | |||
person_id="[null]"/> | |||
<!-- directory --> | |||
<projects organization_uuid="org1" | |||
long_name="org.struts" | |||
id="2" | |||
scope="DIR" | |||
qualifier="PAC" | |||
kee="org.struts:struts:org.struts" | |||
uuid="BCDE" | |||
uuid_path="NOT_USED" | |||
project_uuid="ABCD" | |||
module_uuid="ABCD" | |||
module_uuid_path=".ABCD." | |||
name="org.struts" | |||
root_id="1" | |||
description="[null]" | |||
enabled="[true]" | |||
language="java" | |||
copy_resource_id="[null]" | |||
person_id="[null]"/> | |||
<!-- file --> | |||
<projects organization_uuid="org1" | |||
long_name="org.struts.RequestContext" | |||
id="3" | |||
scope="CLA" | |||
qualifier="CLA" | |||
uuid="CDEF" | |||
uuid_path="NOT_USED" | |||
project_uuid="ABCD" | |||
module_uuid="ABCD" | |||
module_uuid_path=".ABCD." | |||
kee="org.struts:struts:org.struts.RequestContext" | |||
name="RequestContext" | |||
root_id="1" | |||
description="[null]" | |||
enabled="[true]" | |||
language="java" | |||
copy_resource_id="[null]" | |||
person_id="[null]"/> | |||
<snapshots purge_status="[null]" | |||
id="1" | |||
uuid="u1" | |||
islast="[true]" | |||
/> | |||
<!-- RequestContext --> | |||
<resource_index kee="requestcontext" | |||
position="0" | |||
name_size="14" | |||
resource_id="3" | |||
root_project_id="1" | |||
qualifier="CLA"/> | |||
<resource_index kee="equestcontext" | |||
position="1" | |||
name_size="14" | |||
resource_id="3" | |||
root_project_id="1" | |||
qualifier="CLA"/> | |||
<resource_index kee="questcontext" | |||
position="2" | |||
name_size="14" | |||
resource_id="3" | |||
root_project_id="1" | |||
qualifier="CLA"/> | |||
<resource_index kee="uestcontext" | |||
position="3" | |||
name_size="14" | |||
resource_id="3" | |||
root_project_id="1" | |||
qualifier="CLA"/> | |||
<resource_index kee="estcontext" | |||
position="4" | |||
name_size="14" | |||
resource_id="3" | |||
root_project_id="1" | |||
qualifier="CLA"/> | |||
<resource_index kee="stcontext" | |||
position="5" | |||
name_size="14" | |||
resource_id="3" | |||
root_project_id="1" | |||
qualifier="CLA"/> | |||
<resource_index kee="tcontext" | |||
position="6" | |||
name_size="14" | |||
resource_id="3" | |||
root_project_id="1" | |||
qualifier="CLA"/> | |||
<resource_index kee="context" | |||
position="7" | |||
name_size="14" | |||
resource_id="3" | |||
root_project_id="1" | |||
qualifier="CLA"/> | |||
<resource_index kee="ontext" | |||
position="8" | |||
name_size="14" | |||
resource_id="3" | |||
root_project_id="1" | |||
qualifier="CLA"/> | |||
<resource_index kee="ntext" | |||
position="9" | |||
name_size="14" | |||
resource_id="3" | |||
root_project_id="1" | |||
qualifier="CLA"/> | |||
<resource_index kee="text" | |||
position="10" | |||
name_size="14" | |||
resource_id="3" | |||
root_project_id="1" | |||
qualifier="CLA"/> | |||
<resource_index kee="ext" | |||
position="11" | |||
name_size="14" | |||
resource_id="3" | |||
root_project_id="1" | |||
qualifier="CLA"/> | |||
<!-- Struts --> | |||
<resource_index kee="struts" | |||
position="0" | |||
name_size="6" | |||
resource_id="1" | |||
root_project_id="1" | |||
qualifier="TRK"/> | |||
<resource_index kee="truts" | |||
position="1" | |||
name_size="6" | |||
resource_id="1" | |||
root_project_id="1" | |||
qualifier="TRK"/> | |||
<resource_index kee="ruts" | |||
position="2" | |||
name_size="6" | |||
resource_id="1" | |||
root_project_id="1" | |||
qualifier="TRK"/> | |||
<resource_index kee="uts" | |||
position="3" | |||
name_size="6" | |||
resource_id="1" | |||
root_project_id="1" | |||
qualifier="TRK"/> | |||
</dataset> |
@@ -1,70 +0,0 @@ | |||
<dataset> | |||
<!-- project --> | |||
<projects organization_uuid="org1" | |||
long_name="[null]" | |||
id="1" | |||
scope="PRJ" | |||
qualifier="TRK" | |||
kee="org.struts:struts" | |||
name="Struts" | |||
uuid="ABCD" | |||
project_uuid="ABCD" | |||
module_uuid="[null]" | |||
module_uuid_path="." | |||
root_id="[null]" | |||
description="[null]" | |||
enabled="[true]" | |||
language="java" | |||
copy_resource_id="[null]" | |||
person_id="[null]"/> | |||
<!-- directory --> | |||
<projects organization_uuid="org1" | |||
long_name="org.struts" | |||
id="2" | |||
scope="DIR" | |||
qualifier="PAC" | |||
kee="org.struts:struts:org.struts" | |||
uuid="BCDE" | |||
uuid_path="NOT_USED" | |||
project_uuid="ABCD" | |||
module_uuid="ABCD" | |||
module_uuid_path=".ABCD." | |||
name="org.struts" | |||
root_id="1" | |||
description="[null]" | |||
enabled="[true]" | |||
language="java" | |||
copy_resource_id="[null]" | |||
person_id="[null]"/> | |||
<!-- file --> | |||
<projects organization_uuid="org1" | |||
long_name="org.struts.RequestContext" | |||
id="3" | |||
scope="FIL" | |||
qualifier="CLA" | |||
kee="org.struts:struts:org.struts.RequestContext" | |||
uuid="CDEF" | |||
uuid_path="NOT_USED" | |||
project_uuid="ABCD" | |||
module_uuid="ABCD" | |||
module_uuid_path=".ABCD." | |||
name="RequestContext" | |||
root_id="1" | |||
description="[null]" | |||
enabled="[true]" | |||
language="java" | |||
copy_resource_id="[null]" | |||
person_id="[null]"/> | |||
<snapshots purge_status="[null]" | |||
id="1" | |||
islast="[true]" | |||
root_project_id="1" | |||
project_id="1" | |||
scope="PRJ" | |||
qualifier="TRK"/> | |||
</dataset> |
@@ -1,8 +0,0 @@ | |||
<dataset> | |||
<resource_index kee="ziputils" position="0" name_size="8" component_uuid="cpt_uuid" root_component_uuid="ABCD" qualifier="FIL"/> | |||
<resource_index kee="iputils" position="1" name_size="8" component_uuid="cpt_uuid" root_component_uuid="ABCD" qualifier="FIL"/> | |||
<resource_index kee="putils" position="2" name_size="8" component_uuid="cpt_uuid" root_component_uuid="ABCD" qualifier="FIL"/> | |||
<resource_index kee="utils" position="3" name_size="8" component_uuid="cpt_uuid" root_component_uuid="ABCD" qualifier="FIL"/> | |||
<resource_index kee="tils" position="4" name_size="8" component_uuid="cpt_uuid" root_component_uuid="ABCD" qualifier="FIL"/> | |||
<resource_index kee="ils" position="5" name_size="8" component_uuid="cpt_uuid" root_component_uuid="ABCD" qualifier="FIL"/> | |||
</dataset> |
@@ -1 +0,0 @@ | |||
<dataset></dataset> |
@@ -1,3 +0,0 @@ | |||
<dataset> | |||
<resource_index kee="ab" position="0" name_size="2" component_uuid="cpt_uuid" root_component_uuid="ABCD" qualifier="TRK"/> | |||
</dataset> |
@@ -1 +0,0 @@ | |||
<dataset></dataset> |
@@ -1,75 +0,0 @@ | |||
<dataset> | |||
<!-- project --> | |||
<projects organization_uuid="org1" | |||
long_name="[null]" | |||
id="1" | |||
scope="PRJ" | |||
qualifier="TRK" | |||
kee="org.struts:struts" | |||
name="Struts" | |||
uuid="ABCD" | |||
uuid_path="NOT_USED" | |||
project_uuid="ABCD" | |||
module_uuid="[null]" | |||
module_uuid_path="." | |||
root_uuid="ABCD" | |||
description="[null]" | |||
enabled="[true]" | |||
language="java"/> | |||
<!-- directory --> | |||
<projects organization_uuid="org1" | |||
long_name="org.struts" | |||
id="2" | |||
scope="DIR" | |||
qualifier="DIR" | |||
kee="org.struts:struts:org.struts" | |||
uuid="BCDE" | |||
uuid_path="NOT_USED" | |||
project_uuid="ABCD" | |||
module_uuid="ABCD" | |||
module_uuid_path=".ABCD." | |||
name="org.struts" | |||
root_uuid="ABCD" | |||
description="[null]" | |||
enabled="[true]" | |||
language="java"/> | |||
<!-- file --> | |||
<projects organization_uuid="org1" | |||
long_name="org.struts.RequestContext" | |||
id="3" | |||
scope="FIL" | |||
qualifier="FIL" | |||
kee="org.struts:struts:org.struts.RequestContext" | |||
uuid="CDEF" | |||
uuid_path="NOT_USED" | |||
project_uuid="ABCD" | |||
module_uuid="ABCD" | |||
module_uuid_path=".ABCD." | |||
name="RequestContext" | |||
root_uuid="1" | |||
description="[null]" | |||
enabled="[true]" | |||
language="java"/> | |||
<snapshots purge_status="[null]" | |||
id="1" | |||
uuid="u1" | |||
islast="[true]" | |||
component_uuid="ABCD" | |||
/> | |||
<snapshots purge_status="[null]" | |||
id="2" | |||
uuid="u2" | |||
islast="[true]" | |||
component_uuid="BCDE" | |||
/> | |||
<snapshots purge_status="[null]" | |||
id="3" | |||
islast="[true]" | |||
uuid="u3" | |||
component_uuid="CDEF" | |||
/> | |||
</dataset> |
@@ -1,6 +0,0 @@ | |||
<dataset> | |||
<resource_index kee="struts" position="0" name_size="6" component_uuid="ABCD" root_component_uuid="ABCD" qualifier="TRK"/> | |||
<resource_index kee="truts" position="1" name_size="6" component_uuid="ABCD" root_component_uuid="ABCD" qualifier="TRK"/> | |||
<resource_index kee="ruts" position="2" name_size="6" component_uuid="ABCD" root_component_uuid="ABCD" qualifier="TRK"/> | |||
<resource_index kee="uts" position="3" name_size="6" component_uuid="ABCD" root_component_uuid="ABCD" qualifier="TRK"/> | |||
</dataset> |
@@ -1,6 +0,0 @@ | |||
<dataset> | |||
<resource_index id="1" kee="struts" position="0" name_size="6" component_uuid="ABCD" root_component_uuid="ABCD" qualifier="TRK"/> | |||
<resource_index id="2" kee="truts" position="1" name_size="6" component_uuid="ABCD" root_component_uuid="ABCD" qualifier="TRK"/> | |||
<resource_index id="3" kee="ruts" position="2" name_size="6" component_uuid="ABCD" root_component_uuid="ABCD" qualifier="TRK"/> | |||
<resource_index id="4" kee="uts" position="3" name_size="6" component_uuid="ABCD" root_component_uuid="ABCD" qualifier="TRK"/> | |||
</dataset> |
@@ -1,3 +0,0 @@ | |||
<dataset> | |||
<resource_index kee="as" position="0" name_size="2" component_uuid="ABCD" root_component_uuid="ABCD" qualifier="TRK"/> | |||
</dataset> |
@@ -1,57 +0,0 @@ | |||
<dataset> | |||
<projects organization_uuid="org1" | |||
long_name="[null]" | |||
id="1" | |||
scope="PRJ" | |||
qualifier="TRK" | |||
kee="org.struts:struts" | |||
name="AS" | |||
uuid="ABCD" | |||
uuid_path="NOT_USED" | |||
project_uuid="ABCD" | |||
module_uuid="[null]" | |||
module_uuid_path="." | |||
root_uuid="ABCD" | |||
description="[null]" | |||
enabled="[true]" | |||
language="java"/> | |||
<snapshots purge_status="[null]" | |||
id="1" | |||
uuid="u1" | |||
islast="[true]" | |||
component_uuid="ABCD" | |||
/> | |||
<!-- the index is on the old name "ST" but not on "AS" --> | |||
<resource_index id="1" | |||
kee="struts" | |||
position="0" | |||
name_size="6" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
<resource_index id="2" | |||
kee="truts" | |||
position="1" | |||
name_size="6" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
<resource_index id="3" | |||
kee="ruts" | |||
position="2" | |||
name_size="6" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
<resource_index id="4" | |||
kee="uts" | |||
position="3" | |||
name_size="6" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
</dataset> |
@@ -1,3 +0,0 @@ | |||
<dataset> | |||
<resource_index kee="as" position="0" name_size="2" component_uuid="ABCD" root_component_uuid="ABCD" qualifier="TRK"/> | |||
</dataset> |
@@ -1,36 +0,0 @@ | |||
<dataset> | |||
<projects organization_uuid="org1" | |||
long_name="[null]" | |||
id="1" | |||
scope="PRJ" | |||
qualifier="TRK" | |||
kee="org.struts:struts" | |||
name="AS" | |||
uuid="ABCD" | |||
uuid_path="NOT_USED" | |||
project_uuid="ABCD" | |||
module_uuid="[null]" | |||
module_uuid_path="." | |||
root_uuid="ABCD" | |||
description="[null]" | |||
enabled="[true]" | |||
language="java"/> | |||
<snapshots purge_status="[null]" | |||
id="1" | |||
uuid="u1" | |||
islast="[true]" | |||
component_uuid="ABCD" | |||
/> | |||
<!-- the index is on the old name "ST" but not on "AS" --> | |||
<resource_index id="1" | |||
kee="st" | |||
position="0" | |||
name_size="2" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
</dataset> |
@@ -1,95 +0,0 @@ | |||
<dataset> | |||
<projects organization_uuid="org1" | |||
long_name="[null]" | |||
id="1" | |||
scope="PRJ" | |||
qualifier="TRK" | |||
kee="org.struts:struts" | |||
name="Apache Struts" | |||
uuid="ABCD" | |||
uuid_path="NOT_USED" | |||
project_uuid="ABCD" | |||
module_uuid="[null]" | |||
module_uuid_path="." | |||
root_id="[null]" | |||
description="[null]" | |||
enabled="[true]" | |||
language="java" | |||
copy_resource_id="[null]" | |||
person_id="[null]"/> | |||
<snapshots purge_status="[null]" | |||
id="1" | |||
uuid="u1" | |||
islast="[true]" | |||
/> | |||
<resource_index kee="apache struts" | |||
position="0" | |||
name_size="13" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
<resource_index kee="pache struts" | |||
position="1" | |||
name_size="13" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
<resource_index kee="ache struts" | |||
position="2" | |||
name_size="13" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
<resource_index kee="che struts" | |||
position="3" | |||
name_size="13" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
<resource_index kee="he struts" | |||
position="4" | |||
name_size="13" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
<resource_index kee="e struts" | |||
position="5" | |||
name_size="13" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
<resource_index kee=" struts" | |||
position="6" | |||
name_size="13" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
<resource_index kee="struts" | |||
position="7" | |||
name_size="13" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
<resource_index kee="truts" | |||
position="8" | |||
name_size="13" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
<resource_index kee="ruts" | |||
position="9" | |||
name_size="13" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
<resource_index kee="uts" | |||
position="10" | |||
name_size="13" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
</dataset> |
@@ -1,57 +0,0 @@ | |||
<dataset> | |||
<projects organization_uuid="org1" | |||
long_name="[null]" | |||
id="1" | |||
scope="PRJ" | |||
qualifier="TRK" | |||
kee="org.struts:struts" | |||
name="Apache Struts" | |||
uuid="ABCD" | |||
uuid_path="NOT_USED" | |||
project_uuid="ABCD" | |||
module_uuid="[null]" | |||
module_uuid_path="." | |||
root_uuid="ABCD" | |||
description="[null]" | |||
enabled="[true]" | |||
language="java"/> | |||
<snapshots purge_status="[null]" | |||
id="1" | |||
uuid="u1" | |||
islast="[true]" | |||
component_uuid="ABCD" | |||
/> | |||
<!-- the index is on the old name "Struts" but not on "Apache Struts --> | |||
<resource_index id="1" | |||
kee="struts" | |||
position="0" | |||
name_size="6" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
<resource_index id="2" | |||
kee="truts" | |||
position="1" | |||
name_size="6" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
<resource_index id="3" | |||
kee="ruts" | |||
position="2" | |||
name_size="6" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
<resource_index id="4" | |||
kee="uts" | |||
position="3" | |||
name_size="6" | |||
component_uuid="ABCD" | |||
root_component_uuid="ABCD" | |||
qualifier="TRK"/> | |||
</dataset> |
@@ -1,10 +0,0 @@ | |||
<dataset> | |||
<resource_index kee="new struts" position="0" name_size="10" component_uuid="ABCD" root_component_uuid="ABCD" qualifier="TRK"/> | |||
<resource_index kee="ew struts" position="1" name_size="10" component_uuid="ABCD" root_component_uuid="ABCD" qualifier="TRK"/> | |||
<resource_index kee="w struts" position="2" name_size="10" component_uuid="ABCD" root_component_uuid="ABCD" qualifier="TRK"/> | |||
<resource_index kee=" struts" position="3" name_size="10" component_uuid="ABCD" root_component_uuid="ABCD" qualifier="TRK"/> | |||
<resource_index kee="struts" position="4" name_size="10" component_uuid="ABCD" root_component_uuid="ABCD" qualifier="TRK"/> | |||
<resource_index kee="truts" position="5" name_size="10" component_uuid="ABCD" root_component_uuid="ABCD" qualifier="TRK"/> | |||
<resource_index kee="ruts" position="6" name_size="10" component_uuid="ABCD" root_component_uuid="ABCD" qualifier="TRK"/> | |||
<resource_index kee="uts" position="7" name_size="10" component_uuid="ABCD" root_component_uuid="ABCD" qualifier="TRK"/> | |||
</dataset> |
@@ -1,6 +0,0 @@ | |||
<dataset> | |||
<resource_index id="1" kee="struts" position="0" name_size="6" component_uuid="ABCD" root_component_uuid="ABCD" qualifier="TRK"/> | |||
<resource_index id="2" kee="truts" position="1" name_size="6" component_uuid="ABCD" root_component_uuid="ABCD" qualifier="TRK"/> | |||
<resource_index id="3" kee="ruts" position="2" name_size="6" component_uuid="ABCD" root_component_uuid="ABCD" qualifier="TRK"/> | |||
<resource_index id="4" kee="uts" position="3" name_size="6" component_uuid="ABCD" root_component_uuid="ABCD" qualifier="TRK"/> | |||
</dataset> |
@@ -291,19 +291,4 @@ | |||
src_hash="123456" | |||
data_type="TEST"/> | |||
<resource_index id="1" | |||
kee="project one" | |||
component_uuid="P1" | |||
root_component_uuid="P1" | |||
position="0" | |||
name_size="11" | |||
qualifier="TRK"/> | |||
<resource_index id="2" | |||
kee="roject one" | |||
component_uuid="P1" | |||
root_component_uuid="P1" | |||
position="1" | |||
name_size="11" | |||
qualifier="TRK"/> | |||
</dataset> |