diff options
198 files changed, 13201 insertions, 4005 deletions
diff --git a/it/it-tests/src/test/java/it/sourceCode/ProjectCodeTest.java b/it/it-tests/src/test/java/it/sourceCode/ProjectCodeTest.java index c48b11d6380..7135aa77f30 100644 --- a/it/it-tests/src/test/java/it/sourceCode/ProjectCodeTest.java +++ b/it/it-tests/src/test/java/it/sourceCode/ProjectCodeTest.java @@ -20,7 +20,7 @@ package it.sourceCode; import com.sonar.orchestrator.Orchestrator; -import com.sonar.orchestrator.build.SonarRunner; +import com.sonar.orchestrator.build.SonarScanner; import com.sonar.orchestrator.selenium.Selenese; import it.Category1Suite; import org.junit.ClassRule; @@ -58,7 +58,7 @@ public class ProjectCodeTest { private void executeBuild(String projectLocation, String projectKey, String projectName) { orchestrator.executeBuild( - SonarRunner.create(projectDir(projectLocation)) + SonarScanner.create(projectDir(projectLocation)) .setProjectKey(projectKey) .setProjectName(projectName) ); 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 5af8eddb220..a6099d8d04c 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 @@ -185,9 +185,10 @@ public class ComponentService { String uuid = Uuids.create(); ComponentDto component = new ComponentDto() .setUuid(uuid) + .setUuidPath(ComponentDto.UUID_PATH_OF_ROOT) .setRootUuid(uuid) .setModuleUuid(null) - .setModuleUuidPath(ComponentDto.MODULE_UUID_PATH_SEP + uuid + ComponentDto.MODULE_UUID_PATH_SEP) + .setModuleUuidPath(ComponentDto.UUID_PATH_SEPARATOR + uuid + ComponentDto.UUID_PATH_SEPARATOR) .setProjectUuid(uuid) .setKey(keyWithBranch) .setDeprecatedKey(keyWithBranch) diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/ws/ShowAction.java b/server/sonar-server/src/main/java/org/sonar/server/component/ws/ShowAction.java index 6e8c9c09506..0aa142e7fbe 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/ws/ShowAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/ws/ShowAction.java @@ -28,7 +28,6 @@ import org.sonar.core.permission.GlobalPermissions; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.component.ComponentDto; -import org.sonar.db.component.SnapshotDto; import org.sonar.server.component.ComponentFinder; import org.sonar.server.component.ComponentFinder.ParamNames; import org.sonar.server.user.UserSession; @@ -37,7 +36,6 @@ import org.sonarqube.ws.client.component.ShowWsRequest; import static com.google.common.base.MoreObjects.firstNonNull; import static java.lang.String.format; -import static java.util.Collections.emptyList; import static org.sonar.core.util.Uuids.UUID_EXAMPLE_01; import static org.sonar.server.component.ws.ComponentDtoToWsComponent.componentDtoToWsComponent; import static org.sonar.server.user.AbstractUserSession.insufficientPrivilegesException; @@ -96,28 +94,21 @@ public class ShowAction implements ComponentsWsAction { DbSession dbSession = dbClient.openSession(false); try { ComponentDto component = getComponentByUuidOrKey(dbSession, request); - SnapshotDto lastSnapshot = dbClient.snapshotDao().selectLastSnapshotByComponentUuid(dbSession, component.uuid()); - List<ComponentDto> orderedAncestors = emptyList(); - if (lastSnapshot != null) { - ShowData.Builder showDataBuilder = ShowData.builder(lastSnapshot); - List<SnapshotDto> ancestorsSnapshots = dbClient.snapshotDao().selectByIds(dbSession, showDataBuilder.getOrderedSnapshotIds()); - showDataBuilder.withAncestorsSnapshots(ancestorsSnapshots); - List<ComponentDto> ancestorComponents = dbClient.componentDao().selectByUuids(dbSession, showDataBuilder.getOrderedComponentUuids()); - ShowData showData = showDataBuilder.andAncestorComponents(ancestorComponents); - orderedAncestors = showData.getComponents(); - } - - return buildResponse(component, orderedAncestors); + List<ComponentDto> ancestors = dbClient.componentDao().selectAncestors(dbSession, component); + return buildResponse(component, ancestors); } finally { dbClient.closeSession(dbSession); } } - private static ShowWsResponse buildResponse(ComponentDto component, List<ComponentDto> orderedAncestorComponents) { + private static ShowWsResponse buildResponse(ComponentDto component, List<ComponentDto> orderedAncestors) { ShowWsResponse.Builder response = ShowWsResponse.newBuilder(); response.setComponent(componentDtoToWsComponent(component)); - for (ComponentDto ancestor : orderedAncestorComponents) { + // ancestors are ordered from root to leaf, whereas it's the opposite + // in WS response + for (int i = orderedAncestors.size() - 1; i >= 0; i--) { + ComponentDto ancestor = orderedAncestors.get(i); response.addAncestors(componentDtoToWsComponent(ancestor)); } diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/ws/ShowData.java b/server/sonar-server/src/main/java/org/sonar/server/component/ws/ShowData.java deleted file mode 100644 index 9b090941d4a..00000000000 --- a/server/sonar-server/src/main/java/org/sonar/server/component/ws/ShowData.java +++ /dev/null @@ -1,104 +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.server.component.ws; - -import com.google.common.base.Function; -import com.google.common.base.Splitter; -import com.google.common.collect.Lists; -import com.google.common.collect.Ordering; -import java.util.Collections; -import java.util.List; -import javax.annotation.Nonnull; -import org.sonar.db.component.ComponentDto; -import org.sonar.db.component.ComponentDtoFunctions; -import org.sonar.db.component.SnapshotDto; -import org.sonar.db.component.SnapshotDtoFunctions; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; - -class ShowData { - private final List<ComponentDto> components; - - private ShowData(List<ComponentDto> components) { - this.components = components; - } - - static Builder builder(SnapshotDto snapshot) { - return new Builder(snapshot); - } - - List<ComponentDto> getComponents() { - return components; - } - - static class Builder { - private Ordering<SnapshotDto> snapshotOrdering; - private List<Long> orderedSnapshotIds; - private List<String> orderedComponentUuids; - - private Builder(SnapshotDto snapshot) { - List<String> orderedSnapshotIdsAsString = snapshot.getPath() == null ? Collections.<String>emptyList() : Splitter.on(".").omitEmptyStrings().splitToList(snapshot.getPath()); - orderedSnapshotIds = Lists.transform(orderedSnapshotIdsAsString, StringToLongFunction.INSTANCE); - snapshotOrdering = Ordering - .explicit(orderedSnapshotIds) - .onResultOf(SnapshotDtoFunctions.toId()) - .reverse(); - } - - Builder withAncestorsSnapshots(List<SnapshotDto> ancestorsSnapshots) { - checkNotNull(snapshotOrdering, "Snapshot must be set before the ancestors"); - checkState(orderedSnapshotIds.size() == ancestorsSnapshots.size(), "Missing ancestor"); - - orderedComponentUuids = Lists.transform( - snapshotOrdering.immutableSortedCopy(ancestorsSnapshots), - SnapshotDtoFunctions.toComponentUuid()); - - return this; - } - - ShowData andAncestorComponents(List<ComponentDto> ancestorComponents) { - checkNotNull(orderedComponentUuids, "Snapshot ancestors must be set before the component ancestors"); - checkState(orderedComponentUuids.size() == ancestorComponents.size(), "Missing ancestor"); - - return new ShowData(Ordering - .explicit(orderedComponentUuids) - .onResultOf(ComponentDtoFunctions.toUuid()) - .immutableSortedCopy(ancestorComponents)); - } - - List<Long> getOrderedSnapshotIds() { - return orderedSnapshotIds; - } - - List<String> getOrderedComponentUuids() { - return orderedComponentUuids; - } - } - - private enum StringToLongFunction implements Function<String, Long> { - INSTANCE; - - @Override - public Long apply(@Nonnull String input) { - return Long.parseLong(input); - } - } -} diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/ws/TreeAction.java b/server/sonar-server/src/main/java/org/sonar/server/component/ws/TreeAction.java index 41225d4d5c2..7e46b87b2b4 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/component/ws/TreeAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/component/ws/TreeAction.java @@ -23,7 +23,6 @@ import com.google.common.base.Predicates; import com.google.common.collect.ImmutableSortedSet; import com.google.common.collect.Sets; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Map; import java.util.Set; @@ -40,9 +39,7 @@ import org.sonar.core.permission.GlobalPermissions; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.component.ComponentDto; -import org.sonar.db.component.ComponentDtoWithSnapshotId; import org.sonar.db.component.ComponentTreeQuery; -import org.sonar.db.component.SnapshotDto; import org.sonar.server.component.ComponentFinder; import org.sonar.server.user.UserSession; import org.sonarqube.ws.WsComponents.TreeWsResponse; @@ -155,28 +152,24 @@ public class TreeAction implements ComponentsWsAction { try { ComponentDto baseComponent = componentFinder.getByUuidOrKey(dbSession, treeWsRequest.getBaseComponentId(), treeWsRequest.getBaseComponentKey(), BASE_COMPONENT_ID_AND_KEY); checkPermissions(baseComponent); - SnapshotDto baseSnapshot = dbClient.snapshotDao().selectLastSnapshotByComponentUuid(dbSession, baseComponent.uuid()); - if (baseSnapshot == null) { - return emptyResponse(baseComponent, treeWsRequest); - } - ComponentTreeQuery query = toComponentTreeQuery(treeWsRequest, baseSnapshot); - List<ComponentDtoWithSnapshotId> components; + ComponentTreeQuery query = toComponentTreeQuery(treeWsRequest, baseComponent); + List<ComponentDto> components; int total; switch (treeWsRequest.getStrategy()) { case CHILDREN_STRATEGY: - components = dbClient.componentDao().selectDirectChildren(dbSession, query); - total = dbClient.componentDao().countDirectChildren(dbSession, query); + components = dbClient.componentDao().selectChildren(dbSession, query); + total = dbClient.componentDao().countChildren(dbSession, query); break; case LEAVES_STRATEGY: case ALL_STRATEGY: - components = dbClient.componentDao().selectAllChildren(dbSession, query); - total = dbClient.componentDao().countAllChildren(dbSession, query); + components = dbClient.componentDao().selectDescendants(dbSession, query); + total = dbClient.componentDao().countDescendants(dbSession, query); break; default: throw new IllegalStateException("Unknown component tree strategy"); } - Map<String, ComponentDto> referenceComponentsByUuid = searchreferenceComponentsByUuid(dbSession, components); + Map<String, ComponentDto> referenceComponentsByUuid = searchReferenceComponentsByUuid(dbSession, components); return buildResponse(baseComponent, components, referenceComponentsByUuid, Paging.forPageIndex(query.getPage()).withPageSize(query.getPageSize()).andTotal(total)); @@ -185,10 +178,10 @@ public class TreeAction implements ComponentsWsAction { } } - private Map<String, ComponentDto> searchreferenceComponentsByUuid(DbSession dbSession, List<ComponentDtoWithSnapshotId> components) { + private Map<String, ComponentDto> searchReferenceComponentsByUuid(DbSession dbSession, List<ComponentDto> components) { List<String> referenceComponentIds = from(components) .transform(ComponentDto::getCopyResourceUuid) - .filter(Predicates.<String>notNull()) + .filter(Predicates.notNull()) .toList(); if (referenceComponentIds.isEmpty()) { return emptyMap(); @@ -207,7 +200,7 @@ public class TreeAction implements ComponentsWsAction { } } - private static TreeWsResponse buildResponse(ComponentDto baseComponent, List<ComponentDtoWithSnapshotId> components, + private static TreeWsResponse buildResponse(ComponentDto baseComponent, List<ComponentDto> components, Map<String, ComponentDto> referenceComponentsByUuid, Paging paging) { TreeWsResponse.Builder response = TreeWsResponse.newBuilder(); response.getPagingBuilder() @@ -224,22 +217,11 @@ public class TreeAction implements ComponentsWsAction { return response.build(); } - private static TreeWsResponse emptyResponse(ComponentDto baseComponent, TreeWsRequest request) { - TreeWsResponse.Builder response = TreeWsResponse.newBuilder(); - response.getPagingBuilder() - .setTotal(0) - .setPageIndex(request.getPage()) - .setPageSize(request.getPageSize()); - response.setBaseComponent(componentDtoToWsComponent(baseComponent, Collections.<String, ComponentDto>emptyMap())); - - return response.build(); - } - - private ComponentTreeQuery toComponentTreeQuery(TreeWsRequest request, SnapshotDto baseSnapshot) { - List<String> childrenQualifiers = childrenQualifiers(request, baseSnapshot.getQualifier()); + private ComponentTreeQuery toComponentTreeQuery(TreeWsRequest request, ComponentDto baseComponent) { + List<String> childrenQualifiers = childrenQualifiers(request, baseComponent.qualifier()); ComponentTreeQuery.Builder query = ComponentTreeQuery.builder() - .setBaseSnapshot(baseSnapshot) + .setBaseUuid(baseComponent.uuid()) .setPage(request.getPage()) .setPageSize(request.getPageSize()) .setSortFields(request.getSort()) diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/filemove/FileMoveDetectionStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/filemove/FileMoveDetectionStep.java index d0750fd8814..cafbab7ced6 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/filemove/FileMoveDetectionStep.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/filemove/FileMoveDetectionStep.java @@ -44,7 +44,6 @@ import org.sonar.core.util.CloseableIterator; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.component.ComponentTreeQuery; -import org.sonar.db.component.SnapshotDto; import org.sonar.db.source.FileSourceDto; import org.sonar.server.computation.analysis.AnalysisMetadataHolder; import org.sonar.server.computation.component.Component; @@ -101,7 +100,7 @@ public class FileMoveDetectionStep implements ComputationStep { return; } - Map<String, DbComponent> dbFilesByKey = getDbFilesByKey(baseProjectSnapshot); + Map<String, DbComponent> dbFilesByKey = getDbFilesByKey(); if (dbFilesByKey.isEmpty()) { LOG.debug("Previous snapshot has no file. Do nothing."); return; @@ -151,15 +150,13 @@ public class FileMoveDetectionStep implements ComputationStep { } } - private Map<String, DbComponent> getDbFilesByKey(Snapshot baseProjectSnapshot) { + private Map<String, DbComponent> getDbFilesByKey() { try (DbSession dbSession = dbClient.openSession(false)) { // FIXME no need to use such a complex query, joining on SNAPSHOTS and retrieving all column of table PROJECTS, replace with dedicated mapper method - return from(dbClient.componentDao().selectAllChildren( + return from(dbClient.componentDao().selectDescendants( dbSession, ComponentTreeQuery.builder() - .setBaseSnapshot(new SnapshotDto() - .setId(baseProjectSnapshot.getId()) - .setRootId(baseProjectSnapshot.getId())) + .setBaseUuid(rootHolder.getRoot().getUuid()) .setQualifiers(FILE_QUALIFIERS) .setSortFields(SORT_FIELDS) .setPageSize(Integer.MAX_VALUE) diff --git a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistComponentsStep.java b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistComponentsStep.java index 823361a13a8..5ea98a188db 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistComponentsStep.java +++ b/server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistComponentsStep.java @@ -42,7 +42,8 @@ import org.sonar.server.computation.component.PathAwareVisitorAdapter; import org.sonar.server.computation.component.TreeRootHolder; import static com.google.common.collect.FluentIterable.from; -import static org.sonar.db.component.ComponentDto.MODULE_UUID_PATH_SEP; +import static org.sonar.db.component.ComponentDto.UUID_PATH_SEPARATOR; +import static org.sonar.db.component.ComponentDto.formatUuidPathFromParent; import static org.sonar.db.component.ComponentDtoFunctions.toKey; import static org.sonar.server.computation.component.ComponentVisitor.Order.PRE_ORDER; @@ -193,7 +194,8 @@ public class PersistComponentsStep implements ComputationStep { res.setDescription(project.getDescription()); res.setProjectUuid(res.uuid()); res.setRootUuid(res.uuid()); - res.setModuleUuidPath(MODULE_UUID_PATH_SEP + res.uuid() + MODULE_UUID_PATH_SEP); + res.setUuidPath(ComponentDto.UUID_PATH_OF_ROOT); + res.setModuleUuidPath(UUID_PATH_SEPARATOR + res.uuid() + UUID_PATH_SEPARATOR); return res; } @@ -252,7 +254,8 @@ public class PersistComponentsStep implements ComputationStep { res.setLongName(res.name()); res.setProjectUuid(res.uuid()); res.setRootUuid(res.uuid()); - res.setModuleUuidPath(MODULE_UUID_PATH_SEP + res.uuid() + MODULE_UUID_PATH_SEP); + res.setUuidPath(ComponentDto.UUID_PATH_OF_ROOT); + res.setModuleUuidPath(UUID_PATH_SEPARATOR + res.uuid() + UUID_PATH_SEPARATOR); return res; } @@ -307,8 +310,9 @@ public class PersistComponentsStep implements ComputationStep { res.setProjectUuid(projectDto.uuid()); ComponentDto parentModule = path.parent().getDto(); + res.setUuidPath(formatUuidPathFromParent(parentModule)); res.setModuleUuid(parentModule.uuid()); - res.setModuleUuidPath(parentModule.moduleUuidPath() + res.uuid() + MODULE_UUID_PATH_SEP); + res.setModuleUuidPath(parentModule.moduleUuidPath() + res.uuid() + UUID_PATH_SEPARATOR); } /** @@ -320,6 +324,7 @@ public class PersistComponentsStep implements ComputationStep { .first() .get() .getElement().getDto(); + componentDto.setUuidPath(formatUuidPathFromParent(path.parent().getDto())); componentDto.setRootUuid(parentModule.uuid()); componentDto.setProjectUuid(parentModule.projectUuid()); componentDto.setModuleUuid(parentModule.uuid()); diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeData.java b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeData.java index 78e779e4ff3..7c88b41a155 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeData.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeData.java @@ -24,7 +24,6 @@ import java.util.List; import java.util.Map; import javax.annotation.CheckForNull; import org.sonar.db.component.ComponentDto; -import org.sonar.db.component.ComponentDtoWithSnapshotId; import org.sonar.db.measure.MeasureDto; import org.sonar.db.metric.MetricDto; import org.sonarqube.ws.WsMeasures; @@ -33,7 +32,7 @@ import static java.util.Objects.requireNonNull; class ComponentTreeData { private final ComponentDto baseComponent; - private final List<ComponentDtoWithSnapshotId> components; + private final List<ComponentDto> components; private final int componentCount; private final Map<String, ComponentDto> referenceComponentsByUuid; private final List<MetricDto> metrics; @@ -55,7 +54,7 @@ class ComponentTreeData { } @CheckForNull - List<ComponentDtoWithSnapshotId> getComponents() { + List<ComponentDto> getComponents() { return components; } @@ -90,7 +89,7 @@ class ComponentTreeData { static class Builder { private ComponentDto baseComponent; - private List<ComponentDtoWithSnapshotId> componentsFromDb; + private List<ComponentDto> componentsFromDb; private Map<String, ComponentDto> referenceComponentsByUuid; private int componentCount; private List<MetricDto> metrics; @@ -106,7 +105,7 @@ class ComponentTreeData { return this; } - public Builder setComponentsFromDb(List<ComponentDtoWithSnapshotId> componentsFromDbQuery) { + public Builder setComponentsFromDb(List<ComponentDto> componentsFromDbQuery) { this.componentsFromDb = componentsFromDbQuery; return this; } diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeDataLoader.java b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeDataLoader.java index 4063539a8d3..cfaa7c25271 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeDataLoader.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeDataLoader.java @@ -33,12 +33,12 @@ import com.google.common.collect.Sets; import com.google.common.collect.Table; import java.util.ArrayList; import java.util.Collections; -import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.stream.Collectors; import javax.annotation.CheckForNull; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -48,10 +48,10 @@ import org.sonar.api.web.UserRole; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.component.ComponentDto; -import org.sonar.db.component.ComponentDtoWithSnapshotId; import org.sonar.db.component.ComponentTreeQuery; import org.sonar.db.component.SnapshotDto; import org.sonar.db.measure.MeasureDto; +import org.sonar.db.measure.MeasureQuery; import org.sonar.db.metric.MetricDto; import org.sonar.db.metric.MetricDtoFunctions; import org.sonar.server.component.ComponentFinder; @@ -102,7 +102,7 @@ public class ComponentTreeDataLoader { try { ComponentDto baseComponent = componentFinder.getByUuidOrKey(dbSession, wsRequest.getBaseComponentId(), wsRequest.getBaseComponentKey(), BASE_COMPONENT_ID_AND_KEY); checkPermissions(baseComponent); - SnapshotDto baseSnapshot = dbClient.snapshotDao().selectLastSnapshotByComponentUuid(dbSession, baseComponent.uuid()); + SnapshotDto baseSnapshot = dbClient.snapshotDao().selectLastSnapshotByComponentUuid(dbSession, baseComponent.projectUuid()); if (baseSnapshot == null) { return ComponentTreeData.builder() .setBaseComponent(baseComponent) @@ -110,12 +110,12 @@ public class ComponentTreeDataLoader { } Long developerId = searchDeveloperId(dbSession, wsRequest); - ComponentTreeQuery dbQuery = toComponentTreeQuery(wsRequest, baseSnapshot); + ComponentTreeQuery dbQuery = toComponentTreeQuery(wsRequest, baseComponent); ComponentDtosAndTotal componentDtosAndTotal = searchComponents(dbSession, dbQuery, wsRequest); - List<ComponentDtoWithSnapshotId> components = componentDtosAndTotal.componentDtos; + List<ComponentDto> components = componentDtosAndTotal.componentDtos; List<MetricDto> metrics = searchMetrics(dbSession, wsRequest); List<WsMeasures.Period> periods = snapshotToWsPeriods(baseSnapshot); - Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric = searchMeasuresByComponentUuidAndMetric(dbSession, baseComponent, baseSnapshot, components, metrics, + Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric = searchMeasuresByComponentUuidAndMetric(dbSession, baseComponent, components, metrics, periods, developerId); components = filterComponents(components, measuresByComponentUuidAndMetric, metrics, wsRequest); @@ -138,7 +138,7 @@ public class ComponentTreeDataLoader { } } - private static int computeComponentCount(int dbComponentCount, List<ComponentDtoWithSnapshotId> components, boolean returnOnlyComponentsWithMeasures) { + private static int computeComponentCount(int dbComponentCount, List<ComponentDto> components, boolean returnOnlyComponentsWithMeasures) { return returnOnlyComponentsWithMeasures ? components.size() : dbComponentCount; } @@ -151,7 +151,7 @@ public class ComponentTreeDataLoader { return componentFinder.getByUuidOrKey(dbSession, wsRequest.getDeveloperId(), wsRequest.getDeveloperKey(), DEVELOPER_ID_AND_KEY).getId(); } - private Map<String, ComponentDto> searchReferenceComponentsById(DbSession dbSession, List<ComponentDtoWithSnapshotId> components) { + private Map<String, ComponentDto> searchReferenceComponentsById(DbSession dbSession, List<ComponentDto> components) { List<String> referenceComponentUUids = from(components) .transform(ComponentDto::getCopyResourceUuid) .filter(Predicates.<String>notNull()) @@ -166,19 +166,19 @@ public class ComponentTreeDataLoader { private ComponentDtosAndTotal searchComponents(DbSession dbSession, ComponentTreeQuery dbQuery, ComponentTreeWsRequest wsRequest) { if (dbQuery.getQualifiers() != null && dbQuery.getQualifiers().isEmpty()) { - return new ComponentDtosAndTotal(Collections.<ComponentDtoWithSnapshotId>emptyList(), 0); + return new ComponentDtosAndTotal(Collections.emptyList(), 0); } String strategy = requireNonNull(wsRequest.getStrategy()); switch (strategy) { case CHILDREN_STRATEGY: return new ComponentDtosAndTotal( - dbClient.componentDao().selectDirectChildren(dbSession, dbQuery), - dbClient.componentDao().countDirectChildren(dbSession, dbQuery)); + dbClient.componentDao().selectChildren(dbSession, dbQuery), + dbClient.componentDao().countChildren(dbSession, dbQuery)); case LEAVES_STRATEGY: case ALL_STRATEGY: return new ComponentDtosAndTotal( - dbClient.componentDao().selectAllChildren(dbSession, dbQuery), - dbClient.componentDao().countAllChildren(dbSession, dbQuery)); + dbClient.componentDao().selectDescendants(dbSession, dbQuery), + dbClient.componentDao().countDescendants(dbSession, dbQuery)); default: throw new IllegalStateException("Unknown component tree strategy"); } @@ -199,25 +199,25 @@ public class ComponentTreeDataLoader { return metrics; } - private Table<String, MetricDto, MeasureDto> searchMeasuresByComponentUuidAndMetric(DbSession dbSession, ComponentDto baseComponent, SnapshotDto baseSnapshot, - List<ComponentDtoWithSnapshotId> components, List<MetricDto> metrics, + private Table<String, MetricDto, MeasureDto> searchMeasuresByComponentUuidAndMetric(DbSession dbSession, ComponentDto baseComponent, + List<ComponentDto> components, List<MetricDto> metrics, List<WsMeasures.Period> periods, @Nullable Long developerId) { - Map<Long, ComponentDto> componentsBySnapshotId = new HashMap<>(); - componentsBySnapshotId.put(baseSnapshot.getId(), baseComponent); - for (ComponentDtoWithSnapshotId component : components) { - componentsBySnapshotId.put(component.getSnapshotId(), component); - } + List<String> componentUuids = new ArrayList<>(); + componentUuids.add(baseComponent.uuid()); + components.stream().forEach(c -> componentUuids.add(c.uuid())); Map<Integer, MetricDto> metricsById = Maps.uniqueIndex(metrics, MetricDtoFunctions.toId()); - List<MeasureDto> measureDtos = dbClient.measureDao().selectByDeveloperAndSnapshotIdsAndMetricIds(dbSession, - developerId, - new ArrayList<>(componentsBySnapshotId.keySet()), - new ArrayList<>(metricsById.keySet())); + MeasureQuery measureQuery = new MeasureQuery.Builder() + .setPersonId(developerId) + .setComponentUuids(componentUuids) + .setMetricIds(metricsById.keySet()) + .build(); + List<MeasureDto> measureDtos = dbClient.measureDao().selectByQuery(dbSession, measureQuery); Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric = HashBasedTable.create(components.size(), metrics.size()); for (MeasureDto measureDto : measureDtos) { measuresByComponentUuidAndMetric.put( - componentsBySnapshotId.get(measureDto.getSnapshotId()).uuid(), + measureDto.getComponentUuid(), metricsById.get(measureDto.getMetricId()), measureDto); } @@ -234,7 +234,7 @@ public class ComponentTreeDataLoader { * <li>metric is optimized for best value</li> * </ul> */ - private static void addBestValuesToMeasures(Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric, List<ComponentDtoWithSnapshotId> components, + private static void addBestValuesToMeasures(Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric, List<ComponentDto> components, List<MetricDto> metrics, List<WsMeasures.Period> periods) { List<MetricDtoWithBestValue> metricDtosWithBestValueMeasure = from(metrics) .filter(MetricDtoFunctions.isOptimizedForBestValue()) @@ -244,8 +244,8 @@ public class ComponentTreeDataLoader { return; } - List<ComponentDtoWithSnapshotId> componentsEligibleForBestValue = from(components).filter(IsFileComponent.INSTANCE).toList(); - for (ComponentDtoWithSnapshotId component : componentsEligibleForBestValue) { + List<ComponentDto> componentsEligibleForBestValue = from(components).filter(IsFileComponent.INSTANCE).toList(); + for (ComponentDto component : componentsEligibleForBestValue) { for (MetricDtoWithBestValue metricWithBestValue : metricDtosWithBestValueMeasure) { if (measuresByComponentUuidAndMetric.get(component.uuid(), metricWithBestValue.getMetric()) == null) { measuresByComponentUuidAndMetric.put(component.uuid(), metricWithBestValue.getMetric(), metricWithBestValue.getBestValue()); @@ -254,7 +254,7 @@ public class ComponentTreeDataLoader { } } - private static List<ComponentDtoWithSnapshotId> filterComponents(List<ComponentDtoWithSnapshotId> components, + private static List<ComponentDto> filterComponents(List<ComponentDto> components, Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric, List<MetricDto> metrics, ComponentTreeWsRequest wsRequest) { if (!componentWithMeasuresOnly(wsRequest)) { return components; @@ -264,16 +264,17 @@ public class ComponentTreeDataLoader { Optional<MetricDto> metricToSort = from(metrics).firstMatch(new MatchMetricKey(metricKeyToSort)); checkState(metricToSort.isPresent(), "Metric '%s' not found", metricKeyToSort, wsRequest.getMetricKeys()); - return from(components) + return components + .stream() .filter(new HasMeasure(measuresByComponentUuidAndMetric, metricToSort.get(), wsRequest)) - .toList(); + .collect(Collectors.toList()); } private static boolean componentWithMeasuresOnly(ComponentTreeWsRequest wsRequest) { return WITH_MEASURES_ONLY_METRIC_SORT_FILTER.equals(wsRequest.getMetricSortFilter()); } - private static List<ComponentDtoWithSnapshotId> sortComponents(List<ComponentDtoWithSnapshotId> components, ComponentTreeWsRequest wsRequest, List<MetricDto> metrics, + private static List<ComponentDto> sortComponents(List<ComponentDto> components, ComponentTreeWsRequest wsRequest, List<MetricDto> metrics, Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric) { if (!isSortByMetric(wsRequest)) { return components; @@ -282,7 +283,7 @@ public class ComponentTreeDataLoader { return ComponentTreeSort.sortComponents(components, wsRequest, metrics, measuresByComponentUuidAndMetric); } - private static List<ComponentDtoWithSnapshotId> paginateComponents(List<ComponentDtoWithSnapshotId> components, ComponentTreeWsRequest wsRequest) { + private static List<ComponentDto> paginateComponents(List<ComponentDto> components, ComponentTreeWsRequest wsRequest) { if (!isSortByMetric(wsRequest)) { return components; } @@ -319,14 +320,14 @@ public class ComponentTreeDataLoader { return new ArrayList<>(qualifiersIntersection); } - private ComponentTreeQuery toComponentTreeQuery(ComponentTreeWsRequest wsRequest, SnapshotDto baseSnapshot) { - List<String> childrenQualifiers = childrenQualifiers(wsRequest, baseSnapshot.getQualifier()); + private ComponentTreeQuery toComponentTreeQuery(ComponentTreeWsRequest wsRequest, ComponentDto baseComponent) { + List<String> childrenQualifiers = childrenQualifiers(wsRequest, baseComponent.qualifier()); List<String> sortsWithoutMetricSort = newArrayList(Iterables.filter(wsRequest.getSort(), IsNotMetricSort.INSTANCE)); sortsWithoutMetricSort = sortsWithoutMetricSort.isEmpty() ? singletonList(NAME_SORT) : sortsWithoutMetricSort; ComponentTreeQuery.Builder dbQuery = ComponentTreeQuery.builder() - .setBaseSnapshot(baseSnapshot) + .setBaseUuid(baseComponent.uuid()) .setPage(wsRequest.getPage()) .setPageSize(wsRequest.getPageSize()) .setSortFields(sortsWithoutMetricSort) @@ -356,20 +357,20 @@ public class ComponentTreeDataLoader { } private static class ComponentDtosAndTotal { - private final List<ComponentDtoWithSnapshotId> componentDtos; + private final List<ComponentDto> componentDtos; private final int total; - private ComponentDtosAndTotal(List<ComponentDtoWithSnapshotId> componentDtos, int total) { + private ComponentDtosAndTotal(List<ComponentDto> componentDtos, int total) { this.componentDtos = componentDtos; this.total = total; } } - private enum IsFileComponent implements Predicate<ComponentDtoWithSnapshotId> { + private enum IsFileComponent implements Predicate<ComponentDto> { INSTANCE; @Override - public boolean apply(@Nonnull ComponentDtoWithSnapshotId input) { + public boolean apply(@Nonnull ComponentDto input) { return QUALIFIERS_ELIGIBLE_FOR_BEST_VALUE.contains(input.qualifier()); } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeSort.java b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeSort.java index 8b2d4c831fe..a833af62fed 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeSort.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/ComponentTreeSort.java @@ -32,7 +32,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.sonar.api.measures.Metric; import org.sonar.api.measures.Metric.ValueType; -import org.sonar.db.component.ComponentDtoWithSnapshotId; +import org.sonar.db.component.ComponentDto; import org.sonar.db.measure.MeasureDto; import org.sonar.db.metric.MetricDto; import org.sonar.db.metric.MetricDtoFunctions; @@ -66,14 +66,14 @@ class ComponentTreeSort { // static method only } - static List<ComponentDtoWithSnapshotId> sortComponents(List<ComponentDtoWithSnapshotId> components, ComponentTreeWsRequest wsRequest, List<MetricDto> metrics, + static List<ComponentDto> sortComponents(List<ComponentDto> components, ComponentTreeWsRequest wsRequest, List<MetricDto> metrics, Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric) { List<String> sortParameters = wsRequest.getSort(); if (sortParameters == null || sortParameters.isEmpty()) { return components; } boolean isAscending = wsRequest.getAsc(); - Map<String, Ordering<ComponentDtoWithSnapshotId>> orderingsBySortField = ImmutableMap.<String, Ordering<ComponentDtoWithSnapshotId>>builder() + Map<String, Ordering<ComponentDto>> orderingsBySortField = ImmutableMap.<String, Ordering<ComponentDto>>builder() .put(NAME_SORT, componentNameOrdering(isAscending)) .put(QUALIFIER_SORT, componentQualifierOrdering(isAscending)) .put(PATH_SORT, componentPathOrdering(isAscending)) @@ -82,11 +82,11 @@ class ComponentTreeSort { .build(); String firstSortParameter = sortParameters.get(0); - Ordering<ComponentDtoWithSnapshotId> primaryOrdering = orderingsBySortField.get(firstSortParameter); + Ordering<ComponentDto> primaryOrdering = orderingsBySortField.get(firstSortParameter); if (sortParameters.size() > 1) { for (int i = 1; i < sortParameters.size(); i++) { String secondarySortParameter = sortParameters.get(i); - Ordering<ComponentDtoWithSnapshotId> secondaryOrdering = orderingsBySortField.get(secondarySortParameter); + Ordering<ComponentDto> secondaryOrdering = orderingsBySortField.get(secondarySortParameter); primaryOrdering = primaryOrdering.compound(secondaryOrdering); } } @@ -94,19 +94,19 @@ class ComponentTreeSort { return primaryOrdering.immutableSortedCopy(components); } - private static Ordering<ComponentDtoWithSnapshotId> componentNameOrdering(boolean isAscending) { - return stringOrdering(isAscending, ComponentDtoWithSnapshotIdToName.INSTANCE); + private static Ordering<ComponentDto> componentNameOrdering(boolean isAscending) { + return stringOrdering(isAscending, ComponentDtoToName.INSTANCE); } - private static Ordering<ComponentDtoWithSnapshotId> componentQualifierOrdering(boolean isAscending) { - return stringOrdering(isAscending, ComponentDtoWithSnapshotIdToQualifier.INSTANCE); + private static Ordering<ComponentDto> componentQualifierOrdering(boolean isAscending) { + return stringOrdering(isAscending, ComponentDtoToQualifier.INSTANCE); } - private static Ordering<ComponentDtoWithSnapshotId> componentPathOrdering(boolean isAscending) { - return stringOrdering(isAscending, ComponentDtoWithSnapshotIdToPath.INSTANCE); + private static Ordering<ComponentDto> componentPathOrdering(boolean isAscending) { + return stringOrdering(isAscending, ComponentDtoToPath.INSTANCE); } - private static Ordering<ComponentDtoWithSnapshotId> stringOrdering(boolean isAscending, Function<ComponentDtoWithSnapshotId, String> function) { + private static Ordering<ComponentDto> stringOrdering(boolean isAscending, Function<ComponentDto, String> function) { Ordering<String> ordering = Ordering.from(CASE_INSENSITIVE_ORDER); if (!isAscending) { ordering = ordering.reverse(); @@ -115,7 +115,7 @@ class ComponentTreeSort { return ordering.nullsLast().onResultOf(function); } - private static Ordering<ComponentDtoWithSnapshotId> metricValueOrdering(ComponentTreeWsRequest wsRequest, List<MetricDto> metrics, + private static Ordering<ComponentDto> metricValueOrdering(ComponentTreeWsRequest wsRequest, List<MetricDto> metrics, Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric) { if (wsRequest.getMetricSort() == null) { return componentNameOrdering(wsRequest.getAsc()); @@ -128,7 +128,7 @@ class ComponentTreeSort { if (NUMERIC_VALUE_TYPES.contains(metricValueType)) { return numericalMetricOrdering(isAscending, metric, measuresByComponentUuidAndMetric); } else if (TEXTUAL_VALUE_TYPES.contains(metricValueType)) { - return stringOrdering(isAscending, new ComponentDtoWithSnapshotIdToTextualMeasureValue(metric, measuresByComponentUuidAndMetric)); + return stringOrdering(isAscending, new ComponentDtoToTextualMeasureValue(metric, measuresByComponentUuidAndMetric)); } else if (ValueType.LEVEL.equals(ValueType.valueOf(metric.getValueType()))) { return levelMetricOrdering(isAscending, metric, measuresByComponentUuidAndMetric); } @@ -136,7 +136,7 @@ class ComponentTreeSort { throw new IllegalStateException("Unrecognized metric value type: " + metric.getValueType()); } - private static Ordering<ComponentDtoWithSnapshotId> metricPeriodOrdering(ComponentTreeWsRequest wsRequest, List<MetricDto> metrics, + private static Ordering<ComponentDto> metricPeriodOrdering(ComponentTreeWsRequest wsRequest, List<MetricDto> metrics, Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric) { if (wsRequest.getMetricSort() == null || wsRequest.getMetricPeriodSort() == null) { return componentNameOrdering(wsRequest.getAsc()); @@ -152,7 +152,7 @@ class ComponentTreeSort { throw new BadRequestException(format("Impossible to sort metric '%s' by measure period.", metric.getKey())); } - private static Ordering<ComponentDtoWithSnapshotId> numericalMetricOrdering(boolean isAscending, @Nullable MetricDto metric, + private static Ordering<ComponentDto> numericalMetricOrdering(boolean isAscending, @Nullable MetricDto metric, Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric) { Ordering<Double> ordering = Ordering.natural(); @@ -160,10 +160,10 @@ class ComponentTreeSort { ordering = ordering.reverse(); } - return ordering.nullsLast().onResultOf(new ComponentDtoWithSnapshotIdToNumericalMeasureValue(metric, measuresByComponentUuidAndMetric)); + return ordering.nullsLast().onResultOf(new ComponentDtoToNumericalMeasureValue(metric, measuresByComponentUuidAndMetric)); } - private static Ordering<ComponentDtoWithSnapshotId> numericalMetricPeriodOrdering(ComponentTreeWsRequest request, @Nullable MetricDto metric, + private static Ordering<ComponentDto> numericalMetricPeriodOrdering(ComponentTreeWsRequest request, @Nullable MetricDto metric, Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric) { Ordering<Double> ordering = Ordering.natural(); @@ -171,10 +171,10 @@ class ComponentTreeSort { ordering = ordering.reverse(); } - return ordering.nullsLast().onResultOf(new ComponentDtoWithSnapshotIdToMeasureVariationValue(metric, measuresByComponentUuidAndMetric, request.getMetricPeriodSort())); + return ordering.nullsLast().onResultOf(new ComponentDtoToMeasureVariationValue(metric, measuresByComponentUuidAndMetric, request.getMetricPeriodSort())); } - private static Ordering<ComponentDtoWithSnapshotId> levelMetricOrdering(boolean isAscending, @Nullable MetricDto metric, + private static Ordering<ComponentDto> levelMetricOrdering(boolean isAscending, @Nullable MetricDto metric, Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric) { Ordering<Integer> ordering = Ordering.natural(); @@ -183,21 +183,21 @@ class ComponentTreeSort { ordering = ordering.reverse(); } - return ordering.nullsLast().onResultOf(new ComponentDtoWithSnapshotIdToLevelIndex(metric, measuresByComponentUuidAndMetric)); + return ordering.nullsLast().onResultOf(new ComponentDtoToLevelIndex(metric, measuresByComponentUuidAndMetric)); } - private static class ComponentDtoWithSnapshotIdToNumericalMeasureValue implements Function<ComponentDtoWithSnapshotId, Double> { + private static class ComponentDtoToNumericalMeasureValue implements Function<ComponentDto, Double> { private final MetricDto metric; private final Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric; - private ComponentDtoWithSnapshotIdToNumericalMeasureValue(@Nullable MetricDto metric, + private ComponentDtoToNumericalMeasureValue(@Nullable MetricDto metric, Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric) { this.metric = metric; this.measuresByComponentUuidAndMetric = measuresByComponentUuidAndMetric; } @Override - public Double apply(@Nonnull ComponentDtoWithSnapshotId input) { + public Double apply(@Nonnull ComponentDto input) { MeasureDto measure = measuresByComponentUuidAndMetric.get(input.uuid(), metric); if (measure == null || measure.getValue() == null) { return null; @@ -207,18 +207,18 @@ class ComponentTreeSort { } } - private static class ComponentDtoWithSnapshotIdToLevelIndex implements Function<ComponentDtoWithSnapshotId, Integer> { + private static class ComponentDtoToLevelIndex implements Function<ComponentDto, Integer> { private final MetricDto metric; private final Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric; - private ComponentDtoWithSnapshotIdToLevelIndex(@Nullable MetricDto metric, + private ComponentDtoToLevelIndex(@Nullable MetricDto metric, Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric) { this.metric = metric; this.measuresByComponentUuidAndMetric = measuresByComponentUuidAndMetric; } @Override - public Integer apply(@Nonnull ComponentDtoWithSnapshotId input) { + public Integer apply(@Nonnull ComponentDto input) { MeasureDto measure = measuresByComponentUuidAndMetric.get(input.uuid(), metric); if (measure == null || measure.getData() == null) { return null; @@ -228,12 +228,12 @@ class ComponentTreeSort { } } - private static class ComponentDtoWithSnapshotIdToMeasureVariationValue implements Function<ComponentDtoWithSnapshotId, Double> { + private static class ComponentDtoToMeasureVariationValue implements Function<ComponentDto, Double> { private final MetricDto metric; private final Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric; private final int variationIndex; - private ComponentDtoWithSnapshotIdToMeasureVariationValue(@Nullable MetricDto metric, + private ComponentDtoToMeasureVariationValue(@Nullable MetricDto metric, Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric, int variationIndex) { this.metric = metric; this.measuresByComponentUuidAndMetric = measuresByComponentUuidAndMetric; @@ -241,7 +241,7 @@ class ComponentTreeSort { } @Override - public Double apply(@Nonnull ComponentDtoWithSnapshotId input) { + public Double apply(@Nonnull ComponentDto input) { MeasureDto measure = measuresByComponentUuidAndMetric.get(input.uuid(), metric); if (measure == null || measure.getVariation(variationIndex) == null) { return null; @@ -251,18 +251,18 @@ class ComponentTreeSort { } } - private static class ComponentDtoWithSnapshotIdToTextualMeasureValue implements Function<ComponentDtoWithSnapshotId, String> { + private static class ComponentDtoToTextualMeasureValue implements Function<ComponentDto, String> { private final MetricDto metric; private final Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric; - private ComponentDtoWithSnapshotIdToTextualMeasureValue(@Nullable MetricDto metric, + private ComponentDtoToTextualMeasureValue(@Nullable MetricDto metric, Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric) { this.metric = metric; this.measuresByComponentUuidAndMetric = measuresByComponentUuidAndMetric; } @Override - public String apply(@Nonnull ComponentDtoWithSnapshotId input) { + public String apply(@Nonnull ComponentDto input) { MeasureDto measure = measuresByComponentUuidAndMetric.get(input.uuid(), metric); if (measure == null || measure.getData() == null) { return null; @@ -272,29 +272,29 @@ class ComponentTreeSort { } } - private enum ComponentDtoWithSnapshotIdToName implements Function<ComponentDtoWithSnapshotId, String> { + private enum ComponentDtoToName implements Function<ComponentDto, String> { INSTANCE; @Override - public String apply(@Nonnull ComponentDtoWithSnapshotId input) { + public String apply(@Nonnull ComponentDto input) { return input.name(); } } - private enum ComponentDtoWithSnapshotIdToQualifier implements Function<ComponentDtoWithSnapshotId, String> { + private enum ComponentDtoToQualifier implements Function<ComponentDto, String> { INSTANCE; @Override - public String apply(@Nonnull ComponentDtoWithSnapshotId input) { + public String apply(@Nonnull ComponentDto input) { return input.qualifier(); } } - private enum ComponentDtoWithSnapshotIdToPath implements Function<ComponentDtoWithSnapshotId, String> { + private enum ComponentDtoToPath implements Function<ComponentDto, String> { INSTANCE; @Override - public String apply(@Nonnull ComponentDtoWithSnapshotId input) { + public String apply(@Nonnull ComponentDto input) { return input.path(); } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/HasMeasure.java b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/HasMeasure.java index ed029069d00..55638bdc746 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/measure/ws/HasMeasure.java +++ b/server/sonar-server/src/main/java/org/sonar/server/measure/ws/HasMeasure.java @@ -20,59 +20,59 @@ package org.sonar.server.measure.ws; -import com.google.common.base.Predicate; import com.google.common.collect.Table; +import java.util.function.Predicate; import javax.annotation.Nonnull; -import org.sonar.db.component.ComponentDtoWithSnapshotId; +import org.sonar.db.component.ComponentDto; import org.sonar.db.measure.MeasureDto; import org.sonar.db.metric.MetricDto; import org.sonarqube.ws.client.measure.ComponentTreeWsRequest; -class HasMeasure implements Predicate<ComponentDtoWithSnapshotId> { - private final Predicate<ComponentDtoWithSnapshotId> predicate; +class HasMeasure implements Predicate<ComponentDto> { + private final Predicate<ComponentDto> predicate; - HasMeasure(Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric, MetricDto metric, ComponentTreeWsRequest request) { + HasMeasure(Table<String, MetricDto, MeasureDto> table, MetricDto metric, ComponentTreeWsRequest request) { Integer periodIndex = request.getMetricPeriodSort(); this.predicate = periodIndex == null - ? new HasAbsoluteValue(measuresByComponentUuidAndMetric, metric) - : new HasValueOnPeriod(periodIndex, measuresByComponentUuidAndMetric, metric); + ? new HasAbsoluteValue(table, metric) + : new HasValueOnPeriod(periodIndex, table, metric); } @Override - public boolean apply(@Nonnull ComponentDtoWithSnapshotId input) { - return predicate.apply(input); + public boolean test(@Nonnull ComponentDto input) { + return predicate.test(input); } - private static class HasAbsoluteValue implements Predicate<ComponentDtoWithSnapshotId> { - private final Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric; + private static class HasAbsoluteValue implements Predicate<ComponentDto> { + private final Table<String, MetricDto, MeasureDto> table; private final MetricDto metric; - private HasAbsoluteValue(Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric, MetricDto metric) { - this.measuresByComponentUuidAndMetric = measuresByComponentUuidAndMetric; + private HasAbsoluteValue(Table<String, MetricDto, MeasureDto> table, MetricDto metric) { + this.table = table; this.metric = metric; } @Override - public boolean apply(@Nonnull ComponentDtoWithSnapshotId input) { - MeasureDto measure = measuresByComponentUuidAndMetric.get(input.uuid(), metric); + public boolean test(@Nonnull ComponentDto input) { + MeasureDto measure = table.get(input.uuid(), metric); return measure != null && (measure.getValue() != null || measure.getData() != null); } } - private static class HasValueOnPeriod implements Predicate<ComponentDtoWithSnapshotId> { + private static class HasValueOnPeriod implements Predicate<ComponentDto> { private final int periodIndex; - private final Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric; + private final Table<String, MetricDto, MeasureDto> table; private final MetricDto metric; - private HasValueOnPeriod(int periodIndex, Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric, MetricDto metric) { + private HasValueOnPeriod(int periodIndex, Table<String, MetricDto, MeasureDto> table, MetricDto metric) { this.periodIndex = periodIndex; - this.measuresByComponentUuidAndMetric = measuresByComponentUuidAndMetric; + this.table = table; this.metric = metric; } @Override - public boolean apply(@Nonnull ComponentDtoWithSnapshotId input) { - MeasureDto measure = measuresByComponentUuidAndMetric.get(input.uuid(), metric); + public boolean test(@Nonnull ComponentDto input) { + MeasureDto measure = table.get(input.uuid(), metric); return measure != null && measure.getVariation(periodIndex) != null; } } diff --git a/server/sonar-server/src/test/java/org/sonar/ce/queue/CeQueueImplTest.java b/server/sonar-server/src/test/java/org/sonar/ce/queue/CeQueueImplTest.java index 96b87788136..cc75f377a9d 100644 --- a/server/sonar-server/src/test/java/org/sonar/ce/queue/CeQueueImplTest.java +++ b/server/sonar-server/src/test/java/org/sonar/ce/queue/CeQueueImplTest.java @@ -35,6 +35,7 @@ import org.sonar.db.ce.CeActivityDto; import org.sonar.db.ce.CeQueueDto; import org.sonar.db.ce.CeTaskTypes; import org.sonar.db.component.ComponentDto; +import org.sonar.db.component.ComponentTesting; import static java.util.Arrays.asList; import static org.assertj.core.api.Assertions.assertThat; @@ -69,7 +70,7 @@ public class CeQueueImplTest { @Test public void submit_populates_component_name_and_key_of_CeTask_if_component_exists() { - ComponentDto componentDto = insertComponent(newComponentDto("PROJECT_1")); + ComponentDto componentDto = insertComponent(ComponentTesting.newProjectDto("PROJECT_1")); CeTaskSubmit taskSubmit = createTaskSubmit(CeTaskTypes.REPORT, componentDto.uuid(), null); CeTask task = underTest.submit(taskSubmit); @@ -112,7 +113,7 @@ public class CeQueueImplTest { @Test public void massSubmit_populates_component_name_and_key_of_CeTask_if_component_exists() { - ComponentDto componentDto1 = insertComponent(newComponentDto("PROJECT_1")); + ComponentDto componentDto1 = insertComponent(ComponentTesting.newProjectDto("PROJECT_1")); CeTaskSubmit taskSubmit1 = createTaskSubmit(CeTaskTypes.REPORT, componentDto1.uuid(), null); CeTaskSubmit taskSubmit2 = createTaskSubmit("something", "non existing component uuid", null); @@ -206,10 +207,6 @@ public class CeQueueImplTest { assertThat(queueDto.get().getCreatedAt()).isEqualTo(1_450_000_000_000L); } - private static ComponentDto newComponentDto(String uuid) { - return new ComponentDto().setUuid(uuid).setRootUuid(uuid).setName("name_" + uuid).setKey("key_" + uuid); - } - private CeTask submit(String reportType, String componentUuid) { return underTest.submit(createTaskSubmit(reportType, componentUuid, null)); } diff --git a/server/sonar-server/src/test/java/org/sonar/server/batch/ProjectDataLoaderTest.java b/server/sonar-server/src/test/java/org/sonar/server/batch/ProjectDataLoaderTest.java index 7ff44abc27d..25322f643e9 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/batch/ProjectDataLoaderTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/batch/ProjectDataLoaderTest.java @@ -98,7 +98,13 @@ public class ProjectDataLoaderTest { String qualifier = scopeAndQualifier[1]; String key = "theKey_" + scope + "_" + qualifier; String uuid = "uuid_" + uuidCounter++; - dbClient.componentDao().insert(dbSession, new ComponentDto().setUuid(uuid).setRootUuid(uuid).setScope(scope).setQualifier(qualifier).setKey(key)); + dbClient.componentDao().insert(dbSession, new ComponentDto() + .setUuid(uuid) + .setUuidPath(uuid + ".") + .setRootUuid(uuid) + .setScope(scope) + .setQualifier(qualifier) + .setKey(key)); dbSession.commit(); try { diff --git a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskFormatterTest.java b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskFormatterTest.java index a5a71be90a2..0ed28fb9c58 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskFormatterTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/ce/ws/TaskFormatterTest.java @@ -26,7 +26,6 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.mockito.Mockito; -import org.sonar.api.resources.Qualifiers; import org.sonar.api.utils.DateUtils; import org.sonar.api.utils.System2; import org.sonar.ce.log.CeLogging; @@ -35,7 +34,7 @@ import org.sonar.db.DbTester; import org.sonar.db.ce.CeActivityDto; import org.sonar.db.ce.CeQueueDto; import org.sonar.db.ce.CeTaskTypes; -import org.sonar.db.component.ComponentDto; +import org.sonar.db.component.ComponentTesting; import org.sonarqube.ws.WsCe; import static java.util.Arrays.asList; @@ -86,8 +85,8 @@ public class TaskFormatterTest { public void formatQueue_with_component_and_other_fields() throws IOException { when(ceLogging.getFile(any(LogFileRef.class))).thenReturn(Optional.of(temp.newFile())); String uuid = "COMPONENT_UUID"; - db.getDbClient().componentDao().insert(db.getSession(), new ComponentDto() - .setUuid(uuid).setRootUuid(uuid).setKey("COMPONENT_KEY").setName("Component Name").setQualifier(Qualifiers.PROJECT)); + db.getDbClient().componentDao().insert(db.getSession(), + ComponentTesting.newProjectDto(uuid).setKey("COMPONENT_KEY").setName("Component Name")); CeQueueDto dto = new CeQueueDto(); dto.setUuid("UUID"); diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/ComponentServiceTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/ComponentServiceTest.java index 054cd0c1b59..0aa8c3d09b8 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/ComponentServiceTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/ComponentServiceTest.java @@ -81,33 +81,33 @@ public class ComponentServiceTest { @Test public void get_by_key() { - ComponentDto project = createProject("sample:root"); + ComponentDto project = createProject(); assertThat(service.getByKey(project.getKey())).isNotNull(); } @Test public void get_nullable_by_key() { - ComponentDto project = createProject("sample:root"); + ComponentDto project = createProject(); assertThat(service.getNullableByKey(project.getKey())).isNotNull(); assertThat(service.getNullableByKey("unknown")).isNull(); } @Test public void get_by_uuid() { - ComponentDto project = createProject("sample:root"); + ComponentDto project = createProject(); assertThat(service.getNonNullByUuid(project.uuid())).isNotNull(); } @Test public void get_nullable_by_uuid() { - ComponentDto project = createProject("sample:root"); + ComponentDto project = createProject(); assertThat(service.getByUuid(project.uuid())).isPresent(); assertThat(service.getByUuid("unknown")).isAbsent(); } @Test public void update_project_key() { - ComponentDto project = createProject("sample:root"); + ComponentDto project = createProject(); ComponentDto file = ComponentTesting.newFileDto(project).setKey("sample:root:src/File.xoo"); dbClient.componentDao().insert(session, file); @@ -128,7 +128,7 @@ public class ComponentServiceTest { @Test public void update_module_key() { - ComponentDto project = createProject("sample:root"); + ComponentDto project = createProject(); ComponentDto module = ComponentTesting.newModuleDto(project).setKey("sample:root:module"); dbClient.componentDao().insert(session, module); @@ -171,14 +171,14 @@ public class ComponentServiceTest { @Test(expected = ForbiddenException.class) public void fail_to_update_project_key_without_admin_permission() { - ComponentDto project = createProject("sample:root"); + ComponentDto project = createProject(); userSessionRule.login("john").addProjectUuidPermissions(UserRole.USER, project.uuid()); service.updateKey(project.key(), "sample2:root"); } @Test public void check_module_keys_before_renaming() { - ComponentDto project = createProject("sample:root"); + ComponentDto project = createProject(); ComponentDto module = ComponentTesting.newModuleDto(project).setKey("sample:root:module"); dbClient.componentDao().insert(session, module); @@ -197,7 +197,7 @@ public class ComponentServiceTest { @Test public void check_module_keys_before_renaming_return_duplicate_key() { - ComponentDto project = createProject("sample:root"); + ComponentDto project = createProject(); ComponentDto module = ComponentTesting.newModuleDto(project).setKey("sample:root:module"); dbClient.componentDao().insert(session, module); @@ -216,14 +216,14 @@ public class ComponentServiceTest { @Test(expected = ForbiddenException.class) public void fail_to_check_module_keys_before_renaming_without_admin_permission() { - ComponentDto project = createProject("sample:root"); + ComponentDto project = createProject(); userSessionRule.login("john").addProjectUuidPermissions(UserRole.USER, project.uuid()); service.checkModuleKeysBeforeRenaming(project.key(), "sample", "sample2"); } @Test public void bulk_update_project_key() { - ComponentDto project = createProject("sample:root"); + ComponentDto project = createProject(); ComponentDto module = ComponentTesting.newModuleDto(project).setKey("sample:root:module"); dbClient.componentDao().insert(session, module); @@ -267,7 +267,7 @@ public class ComponentServiceTest { @Test(expected = ForbiddenException.class) public void fail_to_bulk_update_project_key_without_admin_permission() { - ComponentDto project = createProject("sample:root"); + ComponentDto project = createProject(); userSessionRule.login("john").addProjectPermissions(UserRole.USER, project.key()); service.bulkUpdateKey("sample:root", "sample", "sample2"); } @@ -425,7 +425,7 @@ public class ComponentServiceTest { @Test public void should_return_project_uuids() { - ComponentDto project = createProject("sample:root"); + ComponentDto project = createProject(); String moduleKey = "sample:root:module"; ComponentDto module = ComponentTesting.newModuleDto(project).setKey(moduleKey); dbClient.componentDao().insert(session, module); @@ -460,7 +460,7 @@ public class ComponentServiceTest { assertThat(service.componentUuids(session, Arrays.asList(moduleKey, fileKey), true)).isEmpty(); } - private ComponentDto createProject(String key) { + private ComponentDto createProject() { ComponentDto project = ComponentTesting.newProjectDto().setKey("sample:root"); dbClient.componentDao().insert(session, project); session.commit(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/ws/ShowDataTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/ws/ShowDataTest.java deleted file mode 100644 index 3de3853872e..00000000000 --- a/server/sonar-server/src/test/java/org/sonar/server/component/ws/ShowDataTest.java +++ /dev/null @@ -1,81 +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.server.component.ws; - -import java.util.Collections; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.sonar.db.component.ComponentDto; -import org.sonar.db.component.SnapshotDto; - -import static com.google.common.collect.Lists.newArrayList; -import static org.assertj.core.api.Assertions.assertThat; -import static org.sonar.db.component.ComponentTesting.newProjectDto; -import static org.sonar.db.component.SnapshotTesting.newSnapshotForProject; - -public class ShowDataTest { - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - ComponentDto project = newProjectDto().setId(42L); - - ShowData underTest; - - @Test - public void no_ancestors() { - underTest = ShowData.builder( - newSnapshotForProject(project).setPath(null)) - .withAncestorsSnapshots(Collections.<SnapshotDto>emptyList()) - .andAncestorComponents(Collections.<ComponentDto>emptyList()); - - assertThat(underTest.getComponents()).isEmpty(); - } - - @Test - public void fail_when_inconsistent_snapshot_ancestors_data() { - expectedException.expect(IllegalStateException.class); - expectedException.expectMessage("Missing ancestor"); - - underTest = ShowData.builder( - newSnapshotForProject(project).setPath("1.2.3.")) - .withAncestorsSnapshots(newArrayList( - newSnapshotForProject(project).setId(1L), - newSnapshotForProject(project).setId(2L))) - // missing snapshot with id = 3 - .andAncestorComponents(Collections.<ComponentDto>emptyList()); - } - - @Test - public void fail_when_inconsistent_component_ancestors_data() { - expectedException.expect(IllegalStateException.class); - expectedException.expectMessage("Missing ancestor"); - - underTest = ShowData.builder( - newSnapshotForProject(project).setPath("1.2.3.")) - .withAncestorsSnapshots(newArrayList( - newSnapshotForProject(project).setId(1L), - newSnapshotForProject(project).setId(2L), - newSnapshotForProject(project).setId(3L))) - .andAncestorComponents(Collections.<ComponentDto>emptyList()); - } -} diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/ws/TreeActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/ws/TreeActionTest.java index 80b67c4c27f..01917262771 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/component/ws/TreeActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/component/ws/TreeActionTest.java @@ -106,17 +106,18 @@ public class TreeActionTest { } @Test - public void direct_children() throws IOException { - userSession.anonymous().login().addProjectUuidPermissions(UserRole.ADMIN, "project-uuid"); + public void return_children() throws IOException { ComponentDto project = newProjectDto("project-uuid"); SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project); - SnapshotDto moduleSnapshot = componentDb.insertComponentAndSnapshot(newModuleDto("module-uuid-1", project), projectSnapshot); + ComponentDto module = newModuleDto("module-uuid-1", project); + SnapshotDto moduleSnapshot = componentDb.insertComponentAndSnapshot(module, projectSnapshot); componentDb.insertComponentAndSnapshot(newFileDto(project, 1), projectSnapshot); for (int i = 2; i <= 9; i++) { - componentDb.insertComponentAndSnapshot(newFileDto(project, i), moduleSnapshot); + componentDb.insertComponentAndSnapshot(newFileDto(module, i), moduleSnapshot); } - SnapshotDto directorySnapshot = componentDb.insertComponentAndSnapshot(newDirectory(project, "directory-path-1"), moduleSnapshot); - componentDb.insertComponentAndSnapshot(newFileDto(project, 10), directorySnapshot); + ComponentDto directory = newDirectory(module, "directory-path-1"); + SnapshotDto directorySnapshot = componentDb.insertComponentAndSnapshot(directory, moduleSnapshot); + componentDb.insertComponentAndSnapshot(newFileDto(directory, 10), directorySnapshot); db.commit(); componentDb.indexAllComponents(); @@ -135,19 +136,18 @@ public class TreeActionTest { } @Test - public void all_children() throws IOException { - userSession.anonymous().login() - .addProjectUuidPermissions(UserRole.USER, "project-uuid"); - + public void return_descendants() throws IOException { ComponentDto project = newProjectDto("project-uuid"); SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project); - SnapshotDto moduleSnapshot = componentDb.insertComponentAndSnapshot(newModuleDto("module-uuid-1", project), projectSnapshot); + ComponentDto module = newModuleDto("module-uuid-1", project); + SnapshotDto moduleSnapshot = componentDb.insertComponentAndSnapshot(module, projectSnapshot); componentDb.insertComponentAndSnapshot(newFileDto(project, 10), projectSnapshot); for (int i = 2; i <= 9; i++) { - componentDb.insertComponentAndSnapshot(newFileDto(project, i), moduleSnapshot); + componentDb.insertComponentAndSnapshot(newFileDto(module, i), moduleSnapshot); } - SnapshotDto directorySnapshot = componentDb.insertComponentAndSnapshot(newDirectory(project, "directory-path-1"), moduleSnapshot); - componentDb.insertComponentAndSnapshot(newFileDto(project, 1), directorySnapshot); + ComponentDto directory = newDirectory(module, "directory-path-1"); + SnapshotDto directorySnapshot = componentDb.insertComponentAndSnapshot(directory, moduleSnapshot); + componentDb.insertComponentAndSnapshot(newFileDto(directory, 1), directorySnapshot); db.commit(); componentDb.indexAllComponents(); @@ -166,51 +166,53 @@ public class TreeActionTest { } @Test - public void leaves_children() throws IOException { - ComponentDto project = newProjectDto().setUuid("project-uuid"); + public void filter_descendants_by_qualifier() throws IOException { + ComponentDto project = newProjectDto("project-uuid"); SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project); - SnapshotDto moduleSnapshot = componentDb.insertComponentAndSnapshot(newModuleDto("module-uuid-1", project), projectSnapshot); componentDb.insertComponentAndSnapshot(newFileDto(project, 1), projectSnapshot); - componentDb.insertComponentAndSnapshot(newFileDto(project, 2), moduleSnapshot); - SnapshotDto directorySnapshot = componentDb.insertComponentAndSnapshot(newDirectory(project, "directory-path-1"), moduleSnapshot); - componentDb.insertComponentAndSnapshot(newFileDto(project, 3), directorySnapshot); + componentDb.insertComponentAndSnapshot(newFileDto(project, 2), projectSnapshot); + componentDb.insertComponentAndSnapshot(newModuleDto("module-uuid-1", project), projectSnapshot); db.commit(); componentDb.indexAllComponents(); TreeWsResponse response = call(ws.newRequest() - .setParam(PARAM_STRATEGY, "leaves") - .setParam(PARAM_BASE_COMPONENT_ID, "project-uuid") - .setParam(PARAM_QUALIFIERS, Qualifiers.FILE)); + .setParam(PARAM_STRATEGY, "all") + .setParam(PARAM_QUALIFIERS, Qualifiers.FILE) + .setParam(PARAM_BASE_COMPONENT_ID, "project-uuid")); - assertThat(response.getComponentsCount()).isEqualTo(3); - assertThat(response.getPaging().getTotal()).isEqualTo(3); - assertThat(response.getComponentsList()).extracting("id").containsExactly("file-uuid-1", "file-uuid-2", "file-uuid-3"); + assertThat(response.getComponentsList()).extracting("id").containsExactly("file-uuid-1", "file-uuid-2"); } @Test - public void all_children_by_file_qualifier() throws IOException { - ComponentDto project = newProjectDto().setUuid("project-uuid"); + public void return_leaves() throws IOException { + ComponentDto project = newProjectDto("project-uuid"); SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project); + ComponentDto module = newModuleDto("module-uuid-1", project); + SnapshotDto moduleSnapshot = componentDb.insertComponentAndSnapshot(module, projectSnapshot); componentDb.insertComponentAndSnapshot(newFileDto(project, 1), projectSnapshot); - componentDb.insertComponentAndSnapshot(newFileDto(project, 2), projectSnapshot); - componentDb.insertComponentAndSnapshot(newModuleDto("module-uuid-1", project), projectSnapshot); + componentDb.insertComponentAndSnapshot(newFileDto(module, 2), moduleSnapshot); + ComponentDto directory = newDirectory(project, "directory-path-1"); + SnapshotDto directorySnapshot = componentDb.insertComponentAndSnapshot(directory, moduleSnapshot); + componentDb.insertComponentAndSnapshot(newFileDto(directory, 3), directorySnapshot); db.commit(); componentDb.indexAllComponents(); TreeWsResponse response = call(ws.newRequest() - .setParam(PARAM_STRATEGY, "all") - .setParam(PARAM_QUALIFIERS, Qualifiers.FILE) - .setParam(PARAM_BASE_COMPONENT_ID, "project-uuid")); + .setParam(PARAM_STRATEGY, "leaves") + .setParam(PARAM_BASE_COMPONENT_ID, "project-uuid") + .setParam(PARAM_QUALIFIERS, Qualifiers.FILE)); - assertThat(response.getComponentsList()).extracting("id").containsExactly("file-uuid-1", "file-uuid-2"); + assertThat(response.getComponentsCount()).isEqualTo(3); + assertThat(response.getPaging().getTotal()).isEqualTo(3); + assertThat(response.getComponentsList()).extracting("id").containsExactly("file-uuid-1", "file-uuid-2", "file-uuid-3"); } @Test - public void all_children_sort_by_qualifier() throws IOException { - ComponentDto project = newProjectDto().setUuid("project-uuid"); + public void sort_descendants_by_qualifier() throws IOException { + ComponentDto project = newProjectDto("project-uuid"); SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project); - componentDb.insertComponentAndSnapshot(newFileDto(project, 2), projectSnapshot); componentDb.insertComponentAndSnapshot(newFileDto(project, 1), projectSnapshot); + componentDb.insertComponentAndSnapshot(newFileDto(project, 2), projectSnapshot); ComponentDto module = newModuleDto("module-uuid-1", project); componentDb.insertComponentAndSnapshot(module, projectSnapshot); componentDb.insertComponentAndSnapshot(newDirectory(project, "path/directory/", "directory-uuid-1"), projectSnapshot); @@ -226,7 +228,7 @@ public class TreeActionTest { } @Test - public void direct_children_of_a_view() { + public void return_children_of_a_view() { ComponentDto view = newView("view-uuid"); SnapshotDto viewSnapshot = componentDb.insertViewAndSnapshot(view); ComponentDto project = newProjectDto("project-uuid-1").setName("project-name").setKey("project-key-1"); @@ -247,7 +249,7 @@ public class TreeActionTest { } @Test - public void empty_response_for_provisioned_project() { + public void response_is_empty_on_provisioned_projects() { componentDb.insertComponent(newProjectDto("project-uuid")); TreeWsResponse response = call(ws.newRequest() @@ -261,12 +263,13 @@ public class TreeActionTest { } @Test - public void developer_projects() { + public void return_developers() { ComponentDto project = newProjectDto("project-uuid"); componentDb.insertProjectAndSnapshot(project); ComponentDto developer = newDeveloper("developer-name"); SnapshotDto developerSnapshot = componentDb.insertDeveloperAndSnapshot(developer); componentDb.insertComponentAndSnapshot(newDevProjectCopy("project-copy-uuid", project, developer), developerSnapshot); + db.commit(); TreeWsResponse response = call(ws.newRequest().setParam(PARAM_BASE_COMPONENT_ID, developer.uuid())); @@ -277,7 +280,7 @@ public class TreeActionTest { } @Test - public void view_projects() { + public void return_projects_composing_a_view() { ComponentDto project = newProjectDto("project-uuid"); componentDb.insertProjectAndSnapshot(project); ComponentDto view = newView("view-uuid"); @@ -400,14 +403,12 @@ public class TreeActionTest { JsonArray components = jsonTree.getAsJsonObject().getAsJsonArray("components"); for (JsonElement componentAsJsonElement : components) { JsonObject componentAsJsonObject = componentAsJsonElement.getAsJsonObject(); - componentDb.insertComponentAndSnapshot(new ComponentDto() - .setUuid(getJsonField(componentAsJsonObject, "id")) - .setRootUuid("root_uuid") + String uuid = getJsonField(componentAsJsonObject, "id"); + componentDb.insertComponentAndSnapshot(ComponentTesting.newChildComponent(uuid, project) .setKey(getJsonField(componentAsJsonObject, "key")) .setName(getJsonField(componentAsJsonObject, "name")) .setLanguage(getJsonField(componentAsJsonObject, "language")) .setPath(getJsonField(componentAsJsonObject, "path")) - .setProjectUuid(project.projectUuid()) .setQualifier(getJsonField(componentAsJsonObject, "qualifier")) .setDescription(getJsonField(componentAsJsonObject, "description")) .setEnabled(true) diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/filemove/FileMoveDetectionStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/filemove/FileMoveDetectionStepTest.java index 3d2b80830f5..0cf21b266ae 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/filemove/FileMoveDetectionStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/filemove/FileMoveDetectionStepTest.java @@ -32,13 +32,14 @@ import org.sonar.core.hash.SourceLinesHashesComputer; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.component.ComponentDao; -import org.sonar.db.component.ComponentDtoWithSnapshotId; +import org.sonar.db.component.ComponentDto; import org.sonar.db.component.ComponentTreeQuery; import org.sonar.db.source.FileSourceDao; import org.sonar.db.source.FileSourceDto; import org.sonar.server.computation.analysis.AnalysisMetadataHolderRule; import org.sonar.server.computation.batch.TreeRootHolderRule; import org.sonar.server.computation.component.Component; +import org.sonar.server.computation.component.ReportComponent; import org.sonar.server.computation.snapshot.Snapshot; import org.sonar.server.computation.source.SourceLinesRepositoryRule; @@ -55,6 +56,7 @@ import static org.sonar.api.resources.Qualifiers.UNIT_TEST_FILE; import static org.sonar.server.computation.component.ReportComponent.builder; public class FileMoveDetectionStepTest { + private static final long SNAPSHOT_ID = 98765; private static final Snapshot SNAPSHOT = new Snapshot.Builder() .setId(SNAPSHOT_ID) @@ -65,6 +67,7 @@ public class FileMoveDetectionStepTest { private static final int FILE_1_REF = 2; private static final int FILE_2_REF = 3; private static final int FILE_3_REF = 4; + private static final ReportComponent PROJECT = builder(Component.Type.PROJECT, ROOT_REF).build(); private static final Component FILE_1 = fileComponent(FILE_1_REF); private static final Component FILE_2 = fileComponent(FILE_2_REF); private static final Component FILE_3 = fileComponent(FILE_3_REF); @@ -83,7 +86,7 @@ public class FileMoveDetectionStepTest { "public class Foo {", "}" }; - public static final String[] CONTENT_EMPTY = { + private static final String[] CONTENT_EMPTY = { "" }; private static final String[] CONTENT2 = { @@ -228,6 +231,7 @@ public class FileMoveDetectionStepTest { when(dbClient.openSession(false)).thenReturn(dbSession); when(dbClient.componentDao()).thenReturn(componentDao); when(dbClient.fileSourceDao()).thenReturn(fileSourceDao); + treeRootHolder.setRoot(PROJECT); } @Test @@ -236,7 +240,7 @@ public class FileMoveDetectionStepTest { } @Test - public void execute_detects_no_move_if_baseProjectSnaphost_is_null() { + public void execute_detects_no_move_if_baseProjectSnapshot_is_null() { analysisMetadataHolder.setBaseProjectSnapshot(null); underTest.execute(); @@ -267,14 +271,13 @@ public class FileMoveDetectionStepTest { public void execute_retrieves_only_file_and_unit_tests_from_last_snapshot() { analysisMetadataHolder.setBaseProjectSnapshot(SNAPSHOT); ArgumentCaptor<ComponentTreeQuery> captor = ArgumentCaptor.forClass(ComponentTreeQuery.class); - when(componentDao.selectAllChildren(eq(dbSession), captor.capture())) - .thenReturn(Collections.<ComponentDtoWithSnapshotId>emptyList()); + when(componentDao.selectDescendants(eq(dbSession), captor.capture())) + .thenReturn(Collections.emptyList()); underTest.execute(); ComponentTreeQuery query = captor.getValue(); - assertThat(query.getBaseSnapshot().getId()).isEqualTo(SNAPSHOT_ID); - assertThat(query.getBaseSnapshot().getRootId()).isEqualTo(SNAPSHOT_ID); + assertThat(query.getBaseUuid()).isEqualTo(PROJECT.getUuid()); assertThat(query.getPage()).isEqualTo(1); assertThat(query.getPageSize()).isEqualTo(Integer.MAX_VALUE); assertThat(query.getSqlSort()).isEqualTo("LOWER(p.name) ASC, p.name ASC"); @@ -284,7 +287,7 @@ public class FileMoveDetectionStepTest { @Test public void execute_detects_no_move_if_there_is_no_file_in_report() { analysisMetadataHolder.setBaseProjectSnapshot(SNAPSHOT); - mockComponentsForSnapshot(1); + mockComponents( /* no components */); setFilesInReport(); underTest.execute(); @@ -295,7 +298,7 @@ public class FileMoveDetectionStepTest { @Test public void execute_detects_no_move_if_file_key_exists_in_both_DB_and_report() { analysisMetadataHolder.setBaseProjectSnapshot(SNAPSHOT); - mockComponentsForSnapshot(FILE_1.getKey(), FILE_2.getKey()); + mockComponents(FILE_1.getKey(), FILE_2.getKey()); setFilesInReport(FILE_2, FILE_1); underTest.execute(); @@ -306,7 +309,7 @@ public class FileMoveDetectionStepTest { @Test public void execute_detects_move_if_content_of_file_is_same_in_DB_and_report() { analysisMetadataHolder.setBaseProjectSnapshot(SNAPSHOT); - ComponentDtoWithSnapshotId[] dtos = mockComponentsForSnapshot(FILE_1.getKey()); + ComponentDto[] dtos = mockComponents(FILE_1.getKey()); mockContentOfFileIdDb(FILE_1.getKey(), CONTENT1); setFilesInReport(FILE_2); setFileContentInReport(FILE_2_REF, CONTENT1); @@ -323,7 +326,7 @@ public class FileMoveDetectionStepTest { @Test public void execute_detects_no_move_if_content_of_file_is_not_similar_enough() { analysisMetadataHolder.setBaseProjectSnapshot(SNAPSHOT); - mockComponentsForSnapshot(FILE_1.getKey()); + mockComponents(FILE_1.getKey()); mockContentOfFileIdDb(FILE_1.getKey(), CONTENT1); setFilesInReport(FILE_2); setFileContentInReport(FILE_2_REF, LESS_CONTENT1); @@ -336,7 +339,7 @@ public class FileMoveDetectionStepTest { @Test public void execute_detects_no_move_if_content_of_file_is_empty_in_DB() { analysisMetadataHolder.setBaseProjectSnapshot(SNAPSHOT); - mockComponentsForSnapshot(FILE_1.getKey()); + mockComponents(FILE_1.getKey()); mockContentOfFileIdDb(FILE_1.getKey(), CONTENT_EMPTY); setFilesInReport(FILE_2); setFileContentInReport(FILE_2_REF, CONTENT1); @@ -349,7 +352,7 @@ public class FileMoveDetectionStepTest { @Test public void execute_detects_no_move_if_content_of_file_is_empty_in_report() { analysisMetadataHolder.setBaseProjectSnapshot(SNAPSHOT); - mockComponentsForSnapshot(FILE_1.getKey()); + mockComponents(FILE_1.getKey()); mockContentOfFileIdDb(FILE_1.getKey(), CONTENT1); setFilesInReport(FILE_2); setFileContentInReport(FILE_2_REF, CONTENT_EMPTY); @@ -362,7 +365,7 @@ public class FileMoveDetectionStepTest { @Test public void execute_detects_no_move_if_two_added_files_have_same_content_as_the_one_in_db() { analysisMetadataHolder.setBaseProjectSnapshot(SNAPSHOT); - mockComponentsForSnapshot(FILE_1.getKey()); + mockComponents(FILE_1.getKey()); mockContentOfFileIdDb(FILE_1.getKey(), CONTENT1); setFilesInReport(FILE_2, FILE_3); setFileContentInReport(FILE_2_REF, CONTENT1); @@ -376,7 +379,7 @@ public class FileMoveDetectionStepTest { @Test public void execute_detects_no_move_if_two_deleted_files_have_same_content_as_the_one_added() { analysisMetadataHolder.setBaseProjectSnapshot(SNAPSHOT); - mockComponentsForSnapshot(FILE_1.getKey(), FILE_2.getKey()); + mockComponents(FILE_1.getKey(), FILE_2.getKey()); mockContentOfFileIdDb(FILE_1.getKey(), CONTENT1); mockContentOfFileIdDb(FILE_2.getKey(), CONTENT1); setFilesInReport(FILE_3); @@ -398,7 +401,7 @@ public class FileMoveDetectionStepTest { Component file4 = fileComponent(5); Component file5 = fileComponent(6); Component file6 = fileComponent(7); - ComponentDtoWithSnapshotId[] dtos = mockComponentsForSnapshot(FILE_1.getKey(), FILE_2.getKey(), file4.getKey(), file5.getKey()); + ComponentDto[] dtos = mockComponents(FILE_1.getKey(), FILE_2.getKey(), file4.getKey(), file5.getKey()); mockContentOfFileIdDb(FILE_1.getKey(), CONTENT1); mockContentOfFileIdDb(FILE_2.getKey(), LESS_CONTENT1); mockContentOfFileIdDb(file4.getKey(), new String[] {"e", "f", "g", "h", "i"}); @@ -447,22 +450,18 @@ public class FileMoveDetectionStepTest { .build()); } - private ComponentDtoWithSnapshotId[] mockComponentsForSnapshot(String... componentKeys) { - return mockComponentsForSnapshot(SNAPSHOT_ID, componentKeys); - } - - private ComponentDtoWithSnapshotId[] mockComponentsForSnapshot(long snapshotId, String... componentKeys) { - List<ComponentDtoWithSnapshotId> componentDtoWithSnapshotIds = stream(componentKeys) - .map(key -> newComponentDto(snapshotId, key)) + private ComponentDto[] mockComponents(String... componentKeys) { + List<ComponentDto> componentDtos = stream(componentKeys) + .map(key -> newComponentDto(key)) .collect(toList()); - when(componentDao.selectAllChildren(eq(dbSession), any(ComponentTreeQuery.class))) - .thenReturn(componentDtoWithSnapshotIds); - return componentDtoWithSnapshotIds.toArray(new ComponentDtoWithSnapshotId[componentDtoWithSnapshotIds.size()]); + when(componentDao.selectDescendants(eq(dbSession), any(ComponentTreeQuery.class))) + .thenReturn(componentDtos); + return componentDtos.toArray(new ComponentDto[componentDtos.size()]); } - private ComponentDtoWithSnapshotId newComponentDto(long snapshotId, String key) { - ComponentDtoWithSnapshotId res = new ComponentDtoWithSnapshotId(); - res.setSnapshotId(snapshotId) + private ComponentDto newComponentDto(String key) { + ComponentDto res = new ComponentDto(); + res .setId(dbIdGenerator) .setKey(key) .setUuid(componentUuidOf(key)) diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/queue/InternalCeQueueImplTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/queue/InternalCeQueueImplTest.java index 66ad196524d..0512c1097e1 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/queue/InternalCeQueueImplTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/queue/InternalCeQueueImplTest.java @@ -40,6 +40,7 @@ import org.sonar.db.ce.CeActivityDto; import org.sonar.db.ce.CeQueueDto; import org.sonar.db.ce.CeTaskTypes; import org.sonar.db.component.ComponentDto; +import org.sonar.db.component.ComponentTesting; import org.sonar.server.computation.monitoring.CEQueueStatusImpl; import static java.util.Arrays.asList; @@ -308,7 +309,7 @@ public class InternalCeQueueImplTest { } private static ComponentDto newComponentDto(String uuid) { - return new ComponentDto().setUuid(uuid).setRootUuid(uuid).setName("name_" + uuid).setKey("key_" + uuid); + return ComponentTesting.newProjectDto(uuid).setName("name_" + uuid).setKey("key_" + uuid); } private CeTask submit(String reportType, String componentUuid) { diff --git a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistMeasuresStepTest.java b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistMeasuresStepTest.java index 68e97a0758c..2a823ba206f 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistMeasuresStepTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistMeasuresStepTest.java @@ -391,7 +391,11 @@ public class PersistMeasuresStepTest extends BaseStepTest { } private ComponentDto addComponent(String key, String uuid) { - ComponentDto componentDto = new ComponentDto().setKey(key).setUuid(uuid).setRootUuid(uuid); + ComponentDto componentDto = new ComponentDto() + .setKey(key) + .setUuid(uuid) + .setUuidPath(uuid + ".") + .setRootUuid(uuid); dbClient.componentDao().insert(dbTester.getSession(), componentDto); return componentDto; } diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentActionTest.java index 343ad0613b6..da2f180239d 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentActionTest.java @@ -153,8 +153,8 @@ public class ComponentActionTest { SnapshotDto fileSnapshot = componentDb.insertComponentAndSnapshot(file, projectSnapshot); MetricDto ncloc = insertNclocMetric(); dbClient.measureDao().insert(dbSession, - newMeasureDto(ncloc, fileSnapshot.getId()).setValue(42.0d).setDeveloperId(null), - newMeasureDto(ncloc, fileSnapshot.getId()).setValue(1984.0d).setDeveloperId(developer.getId())); + newMeasureDto(ncloc, fileSnapshot).setValue(42.0d).setDeveloperId(null), + newMeasureDto(ncloc, fileSnapshot).setValue(1984.0d).setDeveloperId(developer.getId())); db.commit(); ComponentWsResponse result = call(ws.newRequest() @@ -176,8 +176,8 @@ public class ComponentActionTest { SnapshotDto fileSnapshot = componentDb.insertComponentAndSnapshot(file, projectSnapshot); MetricDto ncloc = insertNclocMetric(); dbClient.measureDao().insert(dbSession, - newMeasureDto(ncloc, fileSnapshot.getId()).setValue(42.0d).setDeveloperId(null), - newMeasureDto(ncloc, fileSnapshot.getId()).setValue(1984.0d).setDeveloperId(developer.getId())); + newMeasureDto(ncloc, fileSnapshot).setValue(42.0d).setDeveloperId(null), + newMeasureDto(ncloc, fileSnapshot).setValue(1984.0d).setDeveloperId(developer.getId())); db.commit(); ComponentWsResponse result = call(ws.newRequest() @@ -334,7 +334,7 @@ public class ComponentActionTest { MetricDto complexity = insertComplexityMetric(); dbClient.measureDao().insert(dbSession, - newMeasureDto(complexity, fileSnapshot.getId()) + newMeasureDto(complexity, fileSnapshot) .setValue(12.0d) .setVariation(1, 2.0d) .setVariation(2, 0.0d) @@ -342,7 +342,7 @@ public class ComponentActionTest { MetricDto ncloc = insertNclocMetric(); dbClient.measureDao().insert(dbSession, - newMeasureDto(ncloc, fileSnapshot.getId()) + newMeasureDto(ncloc, fileSnapshot) .setValue(114.0d) .setVariation(1, 3.0d) .setVariation(2, -5.0d) @@ -350,7 +350,7 @@ public class ComponentActionTest { MetricDto newViolations = insertNewViolationMetric(); dbClient.measureDao().insert(dbSession, - newMeasureDto(newViolations, fileSnapshot.getId()) + newMeasureDto(newViolations, fileSnapshot) .setVariation(1, 25.0d) .setVariation(2, 0.0d) .setVariation(3, 25.0d)); diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeActionTest.java index ca4506a38cb..258671f05d5 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeActionTest.java @@ -155,9 +155,9 @@ public class ComponentTreeActionTest { MetricDto ncloc = insertNclocMetric(); MetricDto coverage = insertCoverageMetric(); dbClient.measureDao().insert(dbSession, - newMeasureDto(ncloc, fileSnapshot.getId()).setValue(5.0d).setVariation(1, 4.0d), - newMeasureDto(coverage, fileSnapshot.getId()).setValue(15.5d).setVariation(3, 2.0d), - newMeasureDto(coverage, directorySnapshot.getId()).setValue(15.0d)); + newMeasureDto(ncloc, fileSnapshot).setValue(5.0d).setVariation(1, 4.0d), + newMeasureDto(coverage, fileSnapshot).setValue(15.5d).setVariation(3, 2.0d), + newMeasureDto(coverage, directorySnapshot).setValue(15.0d)); db.commit(); ComponentTreeWsResponse response = call(ws.newRequest() @@ -194,8 +194,8 @@ public class ComponentTreeActionTest { .setBestValue(1984.0d) .setValueType(ValueType.INT.name())); dbClient.measureDao().insert(dbSession, - newMeasureDto(coverage, fileSnapshot.getId()).setValue(15.5d), - newMeasureDto(coverage, directorySnapshot.getId()).setValue(42.0d)); + newMeasureDto(coverage, fileSnapshot).setValue(15.5d), + newMeasureDto(coverage, directorySnapshot).setValue(42.0d)); db.commit(); ComponentTreeWsResponse response = call(ws.newRequest() @@ -230,15 +230,15 @@ public class ComponentTreeActionTest { SnapshotDto fileSnapshot1 = componentDb.insertComponentAndSnapshot(newFileDto(projectDto, "file-uuid-1").setName("file-1"), projectSnapshot); MetricDto coverage = insertCoverageMetric(); dbClient.measureDao().insert(dbSession, - newMeasureDto(coverage, fileSnapshot1.getId()).setValue(1.0d), - newMeasureDto(coverage, fileSnapshot2.getId()).setValue(2.0d), - newMeasureDto(coverage, fileSnapshot3.getId()).setValue(3.0d), - newMeasureDto(coverage, fileSnapshot4.getId()).setValue(4.0d), - newMeasureDto(coverage, fileSnapshot5.getId()).setValue(5.0d), - newMeasureDto(coverage, fileSnapshot6.getId()).setValue(6.0d), - newMeasureDto(coverage, fileSnapshot7.getId()).setValue(7.0d), - newMeasureDto(coverage, fileSnapshot8.getId()).setValue(8.0d), - newMeasureDto(coverage, fileSnapshot9.getId()).setValue(9.0d)); + newMeasureDto(coverage, fileSnapshot1).setValue(1.0d), + newMeasureDto(coverage, fileSnapshot2).setValue(2.0d), + newMeasureDto(coverage, fileSnapshot3).setValue(3.0d), + newMeasureDto(coverage, fileSnapshot4).setValue(4.0d), + newMeasureDto(coverage, fileSnapshot5).setValue(5.0d), + newMeasureDto(coverage, fileSnapshot6).setValue(6.0d), + newMeasureDto(coverage, fileSnapshot7).setValue(7.0d), + newMeasureDto(coverage, fileSnapshot8).setValue(8.0d), + newMeasureDto(coverage, fileSnapshot9).setValue(9.0d)); db.commit(); ComponentTreeWsResponse response = call(ws.newRequest() @@ -265,9 +265,9 @@ public class ComponentTreeActionTest { MetricDto ncloc = newMetricDtoWithoutOptimization().setKey("ncloc").setValueType(ValueType.INT.name()).setDirection(1); dbClient.metricDao().insert(dbSession, ncloc); dbClient.measureDao().insert(dbSession, - newMeasureDto(ncloc, fileSnapshot1.getId()).setValue(1.0d), - newMeasureDto(ncloc, fileSnapshot2.getId()).setValue(2.0d), - newMeasureDto(ncloc, fileSnapshot3.getId()).setValue(3.0d)); + newMeasureDto(ncloc, fileSnapshot1).setValue(1.0d), + newMeasureDto(ncloc, fileSnapshot2).setValue(2.0d), + newMeasureDto(ncloc, fileSnapshot3).setValue(3.0d)); db.commit(); ComponentTreeWsResponse response = call(ws.newRequest() @@ -282,32 +282,36 @@ public class ComponentTreeActionTest { @Test public void remove_components_without_measure_on_the_metric_sort() { - ComponentDto projectDto = newProjectDto("project-uuid"); - SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(projectDto); - SnapshotDto fileSnapshot4 = componentDb.insertComponentAndSnapshot(newFileDto(projectDto, "file-uuid-4"), projectSnapshot); - SnapshotDto fileSnapshot3 = componentDb.insertComponentAndSnapshot(newFileDto(projectDto, "file-uuid-3"), projectSnapshot); - SnapshotDto fileSnapshot2 = componentDb.insertComponentAndSnapshot(newFileDto(projectDto, "file-uuid-2"), projectSnapshot); - SnapshotDto fileSnapshot1 = componentDb.insertComponentAndSnapshot(newFileDto(projectDto, "file-uuid-1"), projectSnapshot); + ComponentDto project = newProjectDto("project-uuid"); + SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project); + ComponentDto file1 = newFileDto(project, "file-uuid-1"); + ComponentDto file2 = newFileDto(project, "file-uuid-2"); + ComponentDto file3 = newFileDto(project, "file-uuid-3"); + ComponentDto file4 = newFileDto(project, "file-uuid-4"); + SnapshotDto fileSnapshot1 = componentDb.insertComponentAndSnapshot(file1, projectSnapshot); + SnapshotDto fileSnapshot2 = componentDb.insertComponentAndSnapshot(file2, projectSnapshot); + SnapshotDto fileSnapshot3 = componentDb.insertComponentAndSnapshot(file3, projectSnapshot); + SnapshotDto fileSnapshot4 = componentDb.insertComponentAndSnapshot(file4, projectSnapshot); MetricDto ncloc = newMetricDtoWithoutOptimization().setKey("ncloc").setValueType(ValueType.INT.name()).setDirection(1); dbClient.metricDao().insert(dbSession, ncloc); dbClient.measureDao().insert(dbSession, - newMeasureDto(ncloc, fileSnapshot1.getId()).setValue(1.0d), - newMeasureDto(ncloc, fileSnapshot2.getId()).setValue(2.0d), - newMeasureDto(ncloc, fileSnapshot3.getId()).setValue(3.0d), + newMeasureDto(ncloc, fileSnapshot1).setValue(1.0d), + newMeasureDto(ncloc, fileSnapshot2).setValue(2.0d), + newMeasureDto(ncloc, fileSnapshot3).setValue(3.0d), // measure on period 1 - newMeasureDto(ncloc, fileSnapshot4.getId()).setVariation(1, 4.0d)); + newMeasureDto(ncloc, fileSnapshot4).setVariation(1, 4.0d)); db.commit(); ComponentTreeWsResponse response = call(ws.newRequest() - .setParam(PARAM_BASE_COMPONENT_ID, "project-uuid") + .setParam(PARAM_BASE_COMPONENT_ID, project.uuid()) .setParam(Param.SORT, METRIC_SORT) .setParam(PARAM_METRIC_SORT, "ncloc") .setParam(PARAM_METRIC_KEYS, "ncloc") .setParam(PARAM_METRIC_SORT_FILTER, WITH_MEASURES_ONLY_METRIC_SORT_FILTER)); assertThat(response.getComponentsList()).extracting("id") - .containsExactly("file-uuid-1", "file-uuid-2", "file-uuid-3") - .doesNotContain("file-uuid-4"); + .containsExactly(file1.uuid(), file2.uuid(), file3.uuid()) + .doesNotContain(file4.uuid()); assertThat(response.getPaging().getTotal()).isEqualTo(3); } @@ -321,9 +325,9 @@ public class ComponentTreeActionTest { MetricDto ncloc = newMetricDtoWithoutOptimization().setKey("ncloc").setValueType(ValueType.INT.name()).setDirection(1); dbClient.metricDao().insert(dbSession, ncloc); dbClient.measureDao().insert(dbSession, - newMeasureDto(ncloc, fileSnapshot1.getId()).setVariation(1, 1.0d), - newMeasureDto(ncloc, fileSnapshot2.getId()).setVariation(1, 2.0d), - newMeasureDto(ncloc, fileSnapshot3.getId()).setVariation(1, 3.0d)); + newMeasureDto(ncloc, fileSnapshot1).setVariation(1, 1.0d), + newMeasureDto(ncloc, fileSnapshot2).setVariation(1, 2.0d), + newMeasureDto(ncloc, fileSnapshot3).setVariation(1, 3.0d)); db.commit(); ComponentTreeWsResponse response = call(ws.newRequest() @@ -347,11 +351,11 @@ public class ComponentTreeActionTest { MetricDto ncloc = newMetricDtoWithoutOptimization().setKey("new_ncloc").setValueType(ValueType.INT.name()).setDirection(1); dbClient.metricDao().insert(dbSession, ncloc); dbClient.measureDao().insert(dbSession, - newMeasureDto(ncloc, fileSnapshot1.getId()).setVariation(1, 1.0d), - newMeasureDto(ncloc, fileSnapshot2.getId()).setVariation(1, 2.0d), - newMeasureDto(ncloc, fileSnapshot3.getId()).setVariation(1, 3.0d), + newMeasureDto(ncloc, fileSnapshot1).setVariation(1, 1.0d), + newMeasureDto(ncloc, fileSnapshot2).setVariation(1, 2.0d), + newMeasureDto(ncloc, fileSnapshot3).setVariation(1, 3.0d), // file 4 measure is on absolute value and period 2 - newMeasureDto(ncloc, fileSnapshot4.getId()) + newMeasureDto(ncloc, fileSnapshot4) .setValue(4.0d) .setVariation(2, 4.0d)); db.commit(); @@ -371,15 +375,16 @@ public class ComponentTreeActionTest { @Test public void load_developer_descendants() { - ComponentDto developer = newDeveloper("developer").setUuid("developer-uuid"); ComponentDto project = newProjectDto("project-uuid").setKey("project-key"); - SnapshotDto developerSnapshot = componentDb.insertDeveloperAndSnapshot(developer); componentDb.insertProjectAndSnapshot(project); + ComponentDto developer = newDeveloper("developer", "developer-uuid"); + SnapshotDto developerSnapshot = componentDb.insertDeveloperAndSnapshot(developer); componentDb.insertComponentAndSnapshot(newDevProjectCopy("project-uuid-copy", project, developer), developerSnapshot); insertNclocMetric(); + db.commit(); ComponentTreeWsResponse response = call(ws.newRequest() - .setParam(PARAM_BASE_COMPONENT_ID, "developer-uuid") + .setParam(PARAM_BASE_COMPONENT_ID, developer.uuid()) .setParam(PARAM_METRIC_KEYS, "ncloc")); assertThat(response.getComponentsCount()).isEqualTo(1); @@ -391,7 +396,7 @@ public class ComponentTreeActionTest { @Test public void load_developer_measures_by_developer_uuid() { - ComponentDto developer = newDeveloper("developer").setUuid("developer-uuid"); + ComponentDto developer = newDeveloper("developer", "developer-uuid"); ComponentDto project = newProjectDto("project-uuid").setKey("project-key"); SnapshotDto developerSnapshot = componentDb.insertDeveloperAndSnapshot(developer); SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project); @@ -400,13 +405,13 @@ public class ComponentTreeActionTest { componentDb.insertComponentAndSnapshot(newDevProjectCopy("project-uuid-copy", project, developer), developerSnapshot); MetricDto ncloc = insertNclocMetric(); dbClient.measureDao().insert(dbSession, - newMeasureDto(ncloc, projectSnapshot.getId()).setDeveloperId(developer.getId()), - newMeasureDto(ncloc, file1Snapshot.getId()) + newMeasureDto(ncloc, projectSnapshot).setDeveloperId(developer.getId()), + newMeasureDto(ncloc, file1Snapshot) .setValue(3d) .setDeveloperId(developer.getId()), // measures are not specific to the developer - newMeasureDto(ncloc, file1Snapshot.getId()).setDeveloperId(null), - newMeasureDto(ncloc, file2Snapshot.getId()).setDeveloperId(null)); + newMeasureDto(ncloc, file1Snapshot).setDeveloperId(null), + newMeasureDto(ncloc, file2Snapshot).setDeveloperId(null)); db.commit(); ComponentTreeWsResponse response = call(ws.newRequest() @@ -424,7 +429,7 @@ public class ComponentTreeActionTest { @Test public void load_developer_measures_by_developer_key() { - ComponentDto developer = newDeveloper("developer").setUuid("developer-uuid"); + ComponentDto developer = newDeveloper("developer", "developer-uuid"); ComponentDto project = newProjectDto("project-uuid").setKey("project-key"); SnapshotDto developerSnapshot = componentDb.insertDeveloperAndSnapshot(developer); SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project); @@ -432,7 +437,7 @@ public class ComponentTreeActionTest { componentDb.insertComponentAndSnapshot(newDevProjectCopy("project-uuid-copy", project, developer), developerSnapshot); MetricDto ncloc = insertNclocMetric(); dbClient.measureDao().insert(dbSession, - newMeasureDto(ncloc, file1Snapshot.getId()) + newMeasureDto(ncloc, file1Snapshot) .setValue(3d) .setDeveloperId(developer.getId())); db.commit(); @@ -471,7 +476,7 @@ public class ComponentTreeActionTest { public void fail_when_developer_is_unknown() { expectedException.expect(NotFoundException.class); - ComponentDto developer = newDeveloper("developer").setUuid("developer-uuid"); + ComponentDto developer = newDeveloper("developer", "developer-uuid"); ComponentDto project = newProjectDto("project-uuid").setKey("project-key"); SnapshotDto developerSnapshot = componentDb.insertDeveloperAndSnapshot(developer); SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project); @@ -479,7 +484,7 @@ public class ComponentTreeActionTest { componentDb.insertComponentAndSnapshot(newDevProjectCopy("project-uuid-copy", project, developer), developerSnapshot); MetricDto ncloc = insertNclocMetric(); dbClient.measureDao().insert(dbSession, - newMeasureDto(ncloc, file1Snapshot.getId()) + newMeasureDto(ncloc, file1Snapshot) .setValue(3d) .setDeveloperId(developer.getId())); db.commit(); @@ -666,35 +671,35 @@ public class ComponentTreeActionTest { MetricDto complexity = insertComplexityMetric(); dbClient.measureDao().insert(dbSession, - newMeasureDto(complexity, file1Snapshot.getId()) + newMeasureDto(complexity, file1Snapshot) .setValue(12.0d), - newMeasureDto(complexity, directorySnapshot.getId()) + newMeasureDto(complexity, directorySnapshot) .setValue(35.0d) .setVariation(2, 0.0d), - newMeasureDto(complexity, projectSnapshot.getId()) + newMeasureDto(complexity, projectSnapshot) .setValue(42.0d)); MetricDto ncloc = insertNclocMetric(); dbClient.measureDao().insert(dbSession, - newMeasureDto(ncloc, file1Snapshot.getId()) + newMeasureDto(ncloc, file1Snapshot) .setValue(114.0d), - newMeasureDto(ncloc, directorySnapshot.getId()) + newMeasureDto(ncloc, directorySnapshot) .setValue(217.0d) .setVariation(2, 0.0d), - newMeasureDto(ncloc, projectSnapshot.getId()) + newMeasureDto(ncloc, projectSnapshot) .setValue(1984.0d)); MetricDto newViolations = insertNewViolationsMetric(); dbClient.measureDao().insert(dbSession, - newMeasureDto(newViolations, file1Snapshot.getId()) + newMeasureDto(newViolations, file1Snapshot) .setVariation(1, 25.0d) .setVariation(2, 0.0d) .setVariation(3, 25.0d), - newMeasureDto(newViolations, directorySnapshot.getId()) + newMeasureDto(newViolations, directorySnapshot) .setVariation(1, 25.0d) .setVariation(2, 0.0d) .setVariation(3, 25.0d), - newMeasureDto(newViolations, projectSnapshot.getId()) + newMeasureDto(newViolations, projectSnapshot) .setVariation(1, 255.0d) .setVariation(2, 0.0d) .setVariation(3, 255.0d)); diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeSortTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeSortTest.java index af5da066369..85164209aca 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeSortTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/ComponentTreeSortTest.java @@ -29,7 +29,7 @@ import org.sonar.api.measures.CoreMetrics; import org.sonar.api.measures.Metric.ValueType; import org.sonar.api.resources.Qualifiers; import org.sonar.core.util.Uuids; -import org.sonar.db.component.ComponentDtoWithSnapshotId; +import org.sonar.db.component.ComponentDto; import org.sonar.db.measure.MeasureDto; import org.sonar.db.metric.MetricDto; import org.sonarqube.ws.client.measure.ComponentTreeWsRequest; @@ -50,7 +50,7 @@ public class ComponentTreeSortTest { private List<MetricDto> metrics; private Table<String, MetricDto, MeasureDto> measuresByComponentUuidAndMetric; - private List<ComponentDtoWithSnapshotId> components; + private List<ComponentDto> components; @Before public void setUp() { @@ -77,7 +77,7 @@ public class ComponentTreeSortTest { measuresByComponentUuidAndMetric = HashBasedTable.create(components.size(), 2); // same number than path field double currentValue = 9; - for (ComponentDtoWithSnapshotId component : components) { + for (ComponentDto component : components) { measuresByComponentUuidAndMetric.put(component.uuid(), violationsMetric, new MeasureDto().setValue(currentValue) .setVariation(1, -currentValue) .setVariation(5, currentValue)); @@ -89,7 +89,7 @@ public class ComponentTreeSortTest { @Test public void sort_by_names() { ComponentTreeWsRequest wsRequest = newRequest(singletonList(NAME_SORT), true, null); - List<ComponentDtoWithSnapshotId> result = sortComponents(wsRequest); + List<ComponentDto> result = sortComponents(wsRequest); assertThat(result).extracting("name") .containsExactly("name-1", "name-2", "name-3", "name-4", "name-5", "name-6", "name-7", "name-8", "name-9"); @@ -99,7 +99,7 @@ public class ComponentTreeSortTest { public void sort_by_qualifier() { ComponentTreeWsRequest wsRequest = newRequest(singletonList(QUALIFIER_SORT), false, null); - List<ComponentDtoWithSnapshotId> result = sortComponents(wsRequest); + List<ComponentDto> result = sortComponents(wsRequest); assertThat(result).extracting("qualifier") .containsExactly("qualifier-9", "qualifier-8", "qualifier-7", "qualifier-6", "qualifier-5", "qualifier-4", "qualifier-3", "qualifier-2", "qualifier-1"); @@ -109,7 +109,7 @@ public class ComponentTreeSortTest { public void sort_by_path() { ComponentTreeWsRequest wsRequest = newRequest(singletonList(PATH_SORT), true, null); - List<ComponentDtoWithSnapshotId> result = sortComponents(wsRequest); + List<ComponentDto> result = sortComponents(wsRequest); assertThat(result).extracting("path") .containsExactly("path-1", "path-2", "path-3", "path-4", "path-5", "path-6", "path-7", "path-8", "path-9"); @@ -120,7 +120,7 @@ public class ComponentTreeSortTest { components.add(newComponentWithoutSnapshotId("name-without-measure", "qualifier-without-measure", "path-without-measure")); ComponentTreeWsRequest wsRequest = newRequest(singletonList(METRIC_SORT), true, NUM_METRIC_KEY); - List<ComponentDtoWithSnapshotId> result = sortComponents(wsRequest); + List<ComponentDto> result = sortComponents(wsRequest); assertThat(result).extracting("path") .containsExactly("path-1", "path-2", "path-3", "path-4", "path-5", "path-6", "path-7", "path-8", "path-9", "path-without-measure"); @@ -131,7 +131,7 @@ public class ComponentTreeSortTest { components.add(newComponentWithoutSnapshotId("name-without-measure", "qualifier-without-measure", "path-without-measure")); ComponentTreeWsRequest wsRequest = newRequest(singletonList(METRIC_SORT), false, NUM_METRIC_KEY); - List<ComponentDtoWithSnapshotId> result = sortComponents(wsRequest); + List<ComponentDto> result = sortComponents(wsRequest); assertThat(result).extracting("path") .containsExactly("path-9", "path-8", "path-7", "path-6", "path-5", "path-4", "path-3", "path-2", "path-1", "path-without-measure"); @@ -152,13 +152,13 @@ public class ComponentTreeSortTest { measuresByComponentUuidAndMetric = HashBasedTable.create(); List<String> statuses = newArrayList("OK", "WARN", "ERROR"); for (int i = 0; i < components.size(); i++) { - ComponentDtoWithSnapshotId component = components.get(i); + ComponentDto component = components.get(i); String alertStatus = statuses.get(i % 3); measuresByComponentUuidAndMetric.put(component.uuid(), metrics.get(0), new MeasureDto().setData(alertStatus)); } ComponentTreeWsRequest wsRequest = newRequest(newArrayList(METRIC_SORT, NAME_SORT), true, CoreMetrics.ALERT_STATUS_KEY); - List<ComponentDtoWithSnapshotId> result = sortComponents(wsRequest); + List<ComponentDto> result = sortComponents(wsRequest); assertThat(result).extracting("name").containsExactly( "PROJECT ERROR 1", "PROJECT ERROR 2", @@ -171,7 +171,7 @@ public class ComponentTreeSortTest { components.add(newComponentWithoutSnapshotId("name-without-measure", "qualifier-without-measure", "path-without-measure")); ComponentTreeWsRequest wsRequest = newRequest(singletonList(METRIC_PERIOD_SORT), true, NUM_METRIC_KEY).setMetricPeriodSort(1); - List<ComponentDtoWithSnapshotId> result = sortComponents(wsRequest); + List<ComponentDto> result = sortComponents(wsRequest); assertThat(result).extracting("path") .containsExactly("path-9", "path-8", "path-7", "path-6", "path-5", "path-4", "path-3", "path-2", "path-1", "path-without-measure"); @@ -182,7 +182,7 @@ public class ComponentTreeSortTest { components.add(newComponentWithoutSnapshotId("name-without-measure", "qualifier-without-measure", "path-without-measure")); ComponentTreeWsRequest wsRequest = newRequest(singletonList(METRIC_PERIOD_SORT), false, NUM_METRIC_KEY).setMetricPeriodSort(1); - List<ComponentDtoWithSnapshotId> result = sortComponents(wsRequest); + List<ComponentDto> result = sortComponents(wsRequest); assertThat(result).extracting("path") .containsExactly("path-1", "path-2", "path-3", "path-4", "path-5", "path-6", "path-7", "path-8", "path-9", "path-without-measure"); @@ -193,7 +193,7 @@ public class ComponentTreeSortTest { components.add(newComponentWithoutSnapshotId("name-without-measure", "qualifier-without-measure", "path-without-measure")); ComponentTreeWsRequest wsRequest = newRequest(singletonList(METRIC_SORT), false, NUM_METRIC_KEY).setMetricPeriodSort(5); - List<ComponentDtoWithSnapshotId> result = sortComponents(wsRequest); + List<ComponentDto> result = sortComponents(wsRequest); assertThat(result).extracting("path") .containsExactly("path-9", "path-8", "path-7", "path-6", "path-5", "path-4", "path-3", "path-2", "path-1", "path-without-measure"); @@ -204,7 +204,7 @@ public class ComponentTreeSortTest { components.add(newComponentWithoutSnapshotId("name-without-measure", "qualifier-without-measure", "path-without-measure")); ComponentTreeWsRequest wsRequest = newRequest(singletonList(METRIC_SORT), true, TEXT_METRIC_KEY); - List<ComponentDtoWithSnapshotId> result = sortComponents(wsRequest); + List<ComponentDto> result = sortComponents(wsRequest); assertThat(result).extracting("path") .containsExactly("path-1", "path-2", "path-3", "path-4", "path-5", "path-6", "path-7", "path-8", "path-9", "path-without-measure"); @@ -215,7 +215,7 @@ public class ComponentTreeSortTest { components.add(newComponentWithoutSnapshotId("name-without-measure", "qualifier-without-measure", "path-without-measure")); ComponentTreeWsRequest wsRequest = newRequest(singletonList(METRIC_SORT), false, TEXT_METRIC_KEY); - List<ComponentDtoWithSnapshotId> result = sortComponents(wsRequest); + List<ComponentDto> result = sortComponents(wsRequest); assertThat(result).extracting("path") .containsExactly("path-9", "path-8", "path-7", "path-6", "path-5", "path-4", "path-3", "path-2", "path-1", "path-without-measure"); @@ -229,18 +229,18 @@ public class ComponentTreeSortTest { newComponentWithoutSnapshotId("name-1", "qualifier-1", "path-1")); ComponentTreeWsRequest wsRequest = newRequest(newArrayList(NAME_SORT, QUALIFIER_SORT, PATH_SORT), true, null); - List<ComponentDtoWithSnapshotId> result = sortComponents(wsRequest); + List<ComponentDto> result = sortComponents(wsRequest); assertThat(result).extracting("path") .containsExactly("path-1", "path-2", "path-3"); } - private List<ComponentDtoWithSnapshotId> sortComponents(ComponentTreeWsRequest wsRequest) { + private List<ComponentDto> sortComponents(ComponentTreeWsRequest wsRequest) { return ComponentTreeSort.sortComponents(components, wsRequest, metrics, measuresByComponentUuidAndMetric); } - private static ComponentDtoWithSnapshotId newComponentWithoutSnapshotId(String name, String qualifier, String path) { - return (ComponentDtoWithSnapshotId) new ComponentDtoWithSnapshotId() + private static ComponentDto newComponentWithoutSnapshotId(String name, String qualifier, String path) { + return (ComponentDto) new ComponentDto() .setUuid(Uuids.createFast()) .setName(name) .setQualifier(qualifier) diff --git a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/MeasureDtoToWsMeasureTest.java b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/MeasureDtoToWsMeasureTest.java index 5b29ea233bf..48fcb3ac84c 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/measure/ws/MeasureDtoToWsMeasureTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/measure/ws/MeasureDtoToWsMeasureTest.java @@ -23,6 +23,7 @@ package org.sonar.server.measure.ws; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; +import org.sonar.db.component.SnapshotDto; import org.sonar.db.metric.MetricDto; import static org.assertj.core.api.Assertions.assertThat; @@ -43,7 +44,7 @@ public class MeasureDtoToWsMeasureTest { expectedException.expect(IllegalStateException.class); expectedException.expectMessage("Error while mapping a measure of metric key 'metric-key' and parameters "); - MeasureDtoToWsMeasure.measureDtoToWsMeasure(metric, newMeasureDto(metric, 1L).setValue(5.5d).setData("data")); + MeasureDtoToWsMeasure.measureDtoToWsMeasure(metric, newMeasureDto(metric, new SnapshotDto().setId(1L).setComponentUuid("U1")).setValue(5.5d).setData("data")); } @Test diff --git a/server/sonar-server/src/test/java/org/sonar/server/project/ws/SearchMyProjectsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/project/ws/SearchMyProjectsActionTest.java index 3eccf26baaa..86b5f6aa934 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/project/ws/SearchMyProjectsActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/project/ws/SearchMyProjectsActionTest.java @@ -111,8 +111,8 @@ public class SearchMyProjectsActionTest { long anotherTime = DateUtils.parseDateTime("2016-06-11T14:25:53+0000").getTime(); SnapshotDto jdk7Snapshot = dbClient.snapshotDao().insert(dbSession, newSnapshotForProject(jdk7).setCreatedAt(oneTime)); SnapshotDto cLangSnapshot = dbClient.snapshotDao().insert(dbSession, newSnapshotForProject(cLang).setCreatedAt(anotherTime)); - dbClient.measureDao().insert(dbSession, newMeasureDto(alertStatusMetric, jdk7Snapshot.getId()).setData(Level.ERROR.name())); - dbClient.measureDao().insert(dbSession, newMeasureDto(alertStatusMetric, cLangSnapshot.getId()).setData(Level.OK.name())); + dbClient.measureDao().insert(dbSession, newMeasureDto(alertStatusMetric, jdk7Snapshot).setData(Level.ERROR.name())); + dbClient.measureDao().insert(dbSession, newMeasureDto(alertStatusMetric, cLangSnapshot).setData(Level.OK.name())); insertUserPermission(UserRole.ADMIN, user.getId(), jdk7.getId()); insertUserPermission(UserRole.ADMIN, user.getId(), cLang.getId()); db.commit(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/ProjectStatusActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/ProjectStatusActionTest.java index a3dd6d52aeb..56259b4fce4 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/ProjectStatusActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualitygate/ws/ProjectStatusActionTest.java @@ -99,7 +99,7 @@ public class ProjectStatusActionTest { .setEnabled(true) .setKey(CoreMetrics.QUALITY_GATE_DETAILS_KEY)); dbClient.measureDao().insert(dbSession, - newMeasureDto(metric, snapshot.getId()) + newMeasureDto(metric, snapshot) .setData(IOUtils.toString(getClass().getResource("ProjectStatusActionTest/measure_data.json")))); dbSession.commit(); @@ -128,7 +128,7 @@ public class ProjectStatusActionTest { .setEnabled(true) .setKey(CoreMetrics.QUALITY_GATE_DETAILS_KEY)); dbClient.measureDao().insert(dbSession, - newMeasureDto(metric, snapshot.getId()) + newMeasureDto(metric, snapshot) .setData(IOUtils.toString(getClass().getResource("ProjectStatusActionTest/measure_data.json")))); dbSession.commit(); @@ -157,7 +157,7 @@ public class ProjectStatusActionTest { .setEnabled(true) .setKey(CoreMetrics.QUALITY_GATE_DETAILS_KEY)); dbClient.measureDao().insert(dbSession, - newMeasureDto(metric, snapshot.getId()) + newMeasureDto(metric, snapshot) .setData(IOUtils.toString(getClass().getResource("ProjectStatusActionTest/measure_data.json")))); dbSession.commit(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileFactoryMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileFactoryMediumTest.java index 27c29402afc..80e26aff327 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileFactoryMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileFactoryMediumTest.java @@ -32,6 +32,7 @@ import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.RowNotFoundException; import org.sonar.db.component.ComponentDto; +import org.sonar.db.component.ComponentTesting; import org.sonar.db.qualityprofile.QualityProfileDto; import org.sonar.db.rule.RuleDto; import org.sonar.db.rule.RuleParamDto; @@ -333,16 +334,9 @@ public class QProfileFactoryMediumTest { @Test public void get_profile_by_project_and_language() { - ComponentDto project = new ComponentDto() + ComponentDto project = ComponentTesting.newProjectDto("ABCD") .setId(1L) - .setUuid("ABCD") - .setRootUuid("ABCD") - .setKey("org.codehaus.sonar:sonar") - .setName("SonarQube") - .setLongName("SonarQube") - .setQualifier("TRK") - .setScope("TRK") - .setEnabled(true); + .setKey("org.codehaus.sonar:sonar"); db.componentDao().insert(dbSession, project); QualityProfileDto profileDto = QProfileTesting.newXooP1(); diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileProjectOperationsMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileProjectOperationsMediumTest.java index ef9d3011859..51d14f4e597 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileProjectOperationsMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileProjectOperationsMediumTest.java @@ -29,6 +29,7 @@ import org.sonar.core.permission.GlobalPermissions; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.component.ComponentDto; +import org.sonar.db.component.ComponentTesting; import org.sonar.db.permission.PermissionRepository; import org.sonar.db.qualityprofile.QualityProfileDto; import org.sonar.db.user.UserDto; @@ -66,15 +67,10 @@ public class QProfileProjectOperationsMediumTest { factory = tester.get(QProfileFactory.class); projectOperations = tester.get(QProfileProjectOperations.class); - project = new ComponentDto() - .setUuid(PROJECT_UUID) - .setRootUuid(PROJECT_UUID) + project = ComponentTesting.newProjectDto(PROJECT_UUID) .setKey(PROJECT_KEY) .setName("SonarQube") - .setLongName("SonarQube") - .setQualifier("TRK") - .setScope("PRJ") - .setEnabled(true); + .setLongName("SonarQube"); db.componentDao().insert(dbSession, project); profile = QProfileTesting.newXooP1(); @@ -122,24 +118,14 @@ public class QProfileProjectOperationsMediumTest { @Test public void remove_all_projects() { - ComponentDto project1 = new ComponentDto() - .setUuid("BCDE") - .setRootUuid("BCDE") + ComponentDto project1 = ComponentTesting.newProjectDto("BCDE") .setKey("project1") .setName("project1") - .setLongName("project1") - .setQualifier("TRK") - .setScope("PRJ") - .setEnabled(true); - ComponentDto project2 = new ComponentDto() - .setUuid("CDEF") - .setRootUuid("CDEF") + .setLongName("project1"); + ComponentDto project2 = ComponentTesting.newProjectDto("CDEF") .setKey("project2") .setName("project2") - .setLongName("project2") - .setQualifier("TRK") - .setScope("PRJ") - .setEnabled(true); + .setLongName("project2"); db.componentDao().insert(dbSession, project1); db.componentDao().insert(dbSession, project2); diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsMediumTest.java index d58e2c97b48..82dd715b4b1 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsMediumTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/ws/QProfilesWsMediumTest.java @@ -34,6 +34,7 @@ import org.sonar.core.permission.GlobalPermissions; import org.sonar.db.DbClient; import org.sonar.db.DbSession; import org.sonar.db.component.ComponentDto; +import org.sonar.db.component.ComponentTesting; import org.sonar.db.qualityprofile.ActiveRuleDao; import org.sonar.db.qualityprofile.ActiveRuleDto; import org.sonar.db.qualityprofile.ActiveRuleKey; @@ -441,16 +442,7 @@ public class QProfilesWsMediumTest { @Test public void add_project_with_key_and_uuid() throws Exception { - ComponentDto project = new ComponentDto() - .setId(1L) - .setUuid("ABCD") - .setRootUuid("ABCD") - .setKey("org.codehaus.sonar:sonar") - .setName("SonarQube") - .setLongName("SonarQube") - .setQualifier("TRK") - .setScope("TRK") - .setEnabled(true); + ComponentDto project = ComponentTesting.newProjectDto("ABCD").setId(1L); db.componentDao().insert(session, project); QualityProfileDto profile = QProfileTesting.newXooP1(); db.qualityProfileDao().insert(session, profile); @@ -471,16 +463,7 @@ public class QProfilesWsMediumTest { @Test public void change_project_association_with_key_and_uuid() throws Exception { - ComponentDto project = new ComponentDto() - .setId(1L) - .setUuid("ABCD") - .setRootUuid("ABCD") - .setKey("org.codehaus.sonar:sonar") - .setName("SonarQube") - .setLongName("SonarQube") - .setQualifier("TRK") - .setScope("TRK") - .setEnabled(true); + ComponentDto project = ComponentTesting.newProjectDto("ABCD").setId(1L); db.componentDao().insert(session, project); QualityProfileDto profile1 = QProfileTesting.newXooP1(); QualityProfileDto profile2 = QProfileTesting.newXooP2(); @@ -497,16 +480,7 @@ public class QProfilesWsMediumTest { @Test public void add_project_with_name_language_and_key() throws Exception { - ComponentDto project = new ComponentDto() - .setId(1L) - .setUuid("ABCD") - .setRootUuid("ABCD") - .setKey("org.codehaus.sonar:sonar") - .setName("SonarQube") - .setLongName("SonarQube") - .setQualifier("TRK") - .setScope("TRK") - .setEnabled(true); + ComponentDto project = ComponentTesting.newProjectDto("ABCD").setId(1L); db.componentDao().insert(session, project); QualityProfileDto profile = QProfileTesting.newXooP1(); db.qualityProfileDao().insert(session, profile); @@ -563,16 +537,7 @@ public class QProfilesWsMediumTest { @Test public void remove_project_with_key_and_uuid() throws Exception { - ComponentDto project = new ComponentDto() - .setId(1L) - .setUuid("ABCD") - .setRootUuid("ABCD") - .setKey("org.codehaus.sonar:sonar") - .setName("SonarQube") - .setLongName("SonarQube") - .setQualifier("TRK") - .setScope("TRK") - .setEnabled(true); + ComponentDto project = ComponentTesting.newProjectDto("ABCD").setId(1L); db.componentDao().insert(session, project); QualityProfileDto profile = QProfileTesting.newXooP1(); db.qualityProfileDao().insert(session, profile); @@ -588,16 +553,7 @@ public class QProfilesWsMediumTest { @Test public void remove_project_with_name_language_and_key() throws Exception { - ComponentDto project = new ComponentDto() - .setId(1L) - .setUuid("ABCD") - .setRootUuid("ABCD") - .setKey("org.codehaus.sonar:sonar") - .setName("SonarQube") - .setLongName("SonarQube") - .setQualifier("TRK") - .setScope("TRK") - .setEnabled(true); + ComponentDto project = ComponentTesting.newProjectDto("ABCD").setId(1L); db.componentDao().insert(session, project); QualityProfileDto profile = QProfileTesting.newXooP1(); db.qualityProfileDao().insert(session, profile); diff --git a/server/sonar-server/src/test/java/org/sonar/server/test/ws/ListActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/test/ws/ListActionTest.java index 6ba9fc08daf..71c738b5a7a 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/test/ws/ListActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/test/ws/ListActionTest.java @@ -116,6 +116,7 @@ public class ListActionTest { TestFile2.dto(), new ComponentDto() .setUuid(mainFileUuid) + .setUuidPath(TestFile1.PROJECT_UUID + "." + mainFileUuid + ".") .setRootUuid(TestFile1.PROJECT_UUID) .setProjectUuid(TestFile1.PROJECT_UUID)); db.getSession().commit(); @@ -141,6 +142,7 @@ public class ListActionTest { TestFile2.dto(), new ComponentDto() .setUuid(sourceFileUuid) + .setUuidPath(TestFile1.PROJECT_UUID + "." + sourceFileUuid + ".") .setRootUuid(TestFile1.PROJECT_UUID) .setKey(sourceFileKey) .setProjectUuid(TestFile1.PROJECT_UUID)); @@ -194,7 +196,11 @@ public class ListActionTest { public void fail_when_no_sufficient_privilege_on_main_file_uuid() throws Exception { userSessionRule.addProjectUuidPermissions(UserRole.USER, TestFile1.PROJECT_UUID); String mainFileUuid = "MAIN-FILE-UUID"; - dbClient.componentDao().insert(db.getSession(), new ComponentDto().setUuid(mainFileUuid).setRootUuid(TestFile1.PROJECT_UUID).setProjectUuid(TestFile1.PROJECT_UUID)); + dbClient.componentDao().insert(db.getSession(), new ComponentDto() + .setUuid(mainFileUuid) + .setUuidPath(TestFile1.PROJECT_UUID + "." + mainFileUuid + ".") + .setRootUuid(TestFile1.PROJECT_UUID) + .setProjectUuid(TestFile1.PROJECT_UUID)); db.getSession().commit(); ws.newGetRequest("api/tests", "list") @@ -216,6 +222,7 @@ public class ListActionTest { private static final class TestFile1 { public static final String UUID = "TEST-UUID-1"; public static final String FILE_UUID = "ABCD"; + public static final String FILE_UUID_PATH = "PROJECT-UUID.ABCD."; public static final String PROJECT_UUID = "PROJECT-UUID"; public static final String NAME = "test1"; public static final String STATUS = "OK"; @@ -229,6 +236,7 @@ public class ListActionTest { public static ComponentDto dto() { return new ComponentDto() .setUuid(TestFile1.FILE_UUID) + .setUuidPath(TestFile1.FILE_UUID_PATH) .setRootUuid(TestFile1.PROJECT_UUID) .setLongName(TestFile1.LONG_NAME) .setProjectUuid(TestFile1.PROJECT_UUID) @@ -256,6 +264,7 @@ public class ListActionTest { private static final class TestFile2 { public static final String UUID = "TEST-UUID-2"; public static final String FILE_UUID = "BCDE"; + public static final String FILE_UUID_PATH = "PROJECT-UUID.BCDE."; public static final String PROJECT_UUID = "PROJECT-UUID"; public static final String NAME = "test2"; public static final String STATUS = "ERROR"; @@ -268,7 +277,8 @@ public class ListActionTest { public static ComponentDto dto() { return new ComponentDto() - .setUuid(TestFile2.FILE_UUID) + .setUuid(FILE_UUID) + .setUuidPath(FILE_UUID_PATH) .setRootUuid(TestFile2.PROJECT_UUID) .setLongName(TestFile2.LONG_NAME) .setProjectUuid(TestFile2.PROJECT_UUID) 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 0c271cedf2d..530071f7ec9 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 @@ -1,30 +1,109 @@ <dataset> <!-- Only struts is authorized for all user --> - <group_roles id="1" group_id="[null]" resource_id="100" role="user"/> + <group_roles id="1" + group_id="[null]" + resource_id="100" + role="user"/> <!-- View --> - <projects id="11" uuid="EFGH" root_uuid="EFGH" project_uuid="EFGH" module_uuid="[null]" module_uuid_path="." copy_component_uuid="[null]" enabled="[true]" - kee="LANGUAGE_VIEW" scope="PRJ" qualifier="VW" name="By Language" path="[null]"/> + <projects uuid="EFGH" + uuid_path="NOT_USED" + root_uuid="EFGH" + project_uuid="EFGH" + module_uuid="[null]" + module_uuid_path="." + copy_component_uuid="[null]" + enabled="[true]" + kee="LANGUAGE_VIEW" + scope="PRJ" + qualifier="VW" + name="By Language" + path="[null]" + id="11"/> - <projects id="112" uuid="GHIJ" root_uuid="EFGH" project_uuid="EFGH" module_uuid="EFGH" module_uuid_path=".EFGH." copy_component_uuid="KLMN" enabled="[true]" - kee="VIEW2org.elasticsearch:elasticsearch" scope="FIL" qualifier="TRK" name="Elasticsearch" path="[null]"/> + <projects uuid="GHIJ" + uuid_path="NOT_USED" + root_uuid="EFGH" + project_uuid="EFGH" + module_uuid="EFGH" + module_uuid_path=".EFGH." + copy_component_uuid="KLMN" + enabled="[true]" + kee="VIEW2org.elasticsearch:elasticsearch" + scope="FIL" + qualifier="TRK" + name="Elasticsearch" + path="[null]" + id="112"/> - <projects id="113" uuid="HIJK" root_uuid="EFGH" project_uuid="EFGH" module_uuid="EFGH" module_uuid_path=".EFGH." copy_component_uuid="JKLM" enabled="[true]" - kee="VIEW2org.struts:struts" scope="FIL" qualifier="TRK" name="Struts" path="[null]"/> + <projects uuid="HIJK" + uuid_path="NOT_USED" + root_uuid="EFGH" + project_uuid="EFGH" + module_uuid="EFGH" + module_uuid_path=".EFGH." + copy_component_uuid="JKLM" + enabled="[true]" + kee="VIEW2org.struts:struts" + scope="FIL" + qualifier="TRK" + name="Struts" + path="[null]" + id="113"/> <!-- Real projects --> - <projects id="100" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - uuid="JKLM" root_uuid="JKLM" root_project_uuid="JKLM" module_uuid="[null]" module_uuid_path="." - enabled="[true]" copy_component_uuid="[null]" path="[null]"/> + <projects uuid="JKLM" + uuid_path="NOT_USED" + root_uuid="JKLM" + root_project_uuid="JKLM" + module_uuid="[null]" + module_uuid_path="." + enabled="[true]" + copy_component_uuid="[null]" + path="[null]" + id="100" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts"/> - <projects id="101" scope="PRJ" qualifier="TRK" kee="org.elasticsearch:elasticsearch" name="Elasticsearch" - uuid="KLMN" root_uuid="KLMN" project_uuid="KLMN" module_uuid="[null]" module_uuid_path="." - enabled="[true]" copy_component_uuid="[null]" path="[null]"/> + <projects uuid="KLMN" + uuid_path="NOT_USED" + root_uuid="KLMN" + project_uuid="KLMN" + module_uuid="[null]" + module_uuid_path="." + enabled="[true]" + copy_component_uuid="[null]" + path="[null]" + id="101" + scope="PRJ" + qualifier="TRK" + kee="org.elasticsearch:elasticsearch" + name="Elasticsearch"/> - <resource_index id="1" kee="struts" component_uuid="JKLM" root_component_uuid="JKLM" position="0" name_size="6" qualifier="TRK"/> - <resource_index id="2" kee="elasticsearch" component_uuid="KLMN" root_component_uuid="KLMN" position="0" name_size="13" qualifier="TRK"/> - <resource_index id="3" kee="sticsearch" component_uuid="KLMN" root_component_uuid="KLMN" position="1" name_size="13" qualifier="TRK"/> + <resource_index id="1" + kee="struts" + component_uuid="JKLM" + root_component_uuid="JKLM" + position="0" + name_size="6" + qualifier="TRK"/> + <resource_index id="2" + kee="elasticsearch" + component_uuid="KLMN" + root_component_uuid="KLMN" + position="0" + name_size="13" + qualifier="TRK"/> + <resource_index id="3" + kee="sticsearch" + component_uuid="KLMN" + root_component_uuid="KLMN" + position="1" + name_size="13" + qualifier="TRK"/> </dataset> 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 989b7def85e..88002ac3173 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 @@ -1,35 +1,129 @@ <dataset> <!-- Projects is authorized for all user --> - <group_roles id="1" group_id="[null]" resource_id="100" role="user"/> - <group_roles id="2" group_id="[null]" resource_id="101" role="user"/> + <group_roles id="1" + group_id="[null]" + resource_id="100" + role="user"/> + <group_roles id="2" + group_id="[null]" + resource_id="101" + role="user"/> <!-- View with sub view --> - <projects id="11" uuid="EFGH" root_uuid="EFGH" project_uuid="EFGH" module_uuid="[null]" module_uuid_path="." copy_component_uuid="[null]" enabled="[true]" - kee="LANGUAGE_VIEW" scope="PRJ" qualifier="VW" name="By Language" path="[null]"/> + <projects uuid="EFGH" + uuid_path="NOT_USED" + root_uuid="EFGH" + project_uuid="EFGH" + module_uuid="[null]" + module_uuid_path="." + copy_component_uuid="[null]" + enabled="[true]" + kee="LANGUAGE_VIEW" + scope="PRJ" + qualifier="VW" + name="By Language" + path="[null]" + id="11"/> - <projects id="112" uuid="GHIJ" root_uuid="EFGH" project_uuid="EFGH" module_uuid="EFGH" module_uuid_path=".EFGH." copy_component_uuid="KLMN" enabled="[true]" - kee="VIEW2org.elasticsearch:elasticsearch" scope="FIL" qualifier="TRK" name="Elasticsearch" path="[null]"/> + <projects uuid="GHIJ" + uuid_path="NOT_USED" + root_uuid="EFGH" + project_uuid="EFGH" + module_uuid="EFGH" + module_uuid_path=".EFGH." + copy_component_uuid="KLMN" + enabled="[true]" + kee="VIEW2org.elasticsearch:elasticsearch" + scope="FIL" + qualifier="TRK" + name="Elasticsearch" + path="[null]" + id="112"/> <!-- Sub view --> - <projects id="13" uuid="FGHI" root_uuid="EFGH" project_uuid="EFGH" module_uuid="EFGH" module_uuid_path=".EFGH." copy_component_uuid="[null]" enabled="[true]" - kee="JAVA_PROJECTS" scope="PRJ" qualifier="SVW" name="Java projects" path="[null]"/> + <projects uuid="FGHI" + uuid_path="NOT_USED" + root_uuid="EFGH" + project_uuid="EFGH" + module_uuid="EFGH" + module_uuid_path=".EFGH." + copy_component_uuid="[null]" + enabled="[true]" + kee="JAVA_PROJECTS" + scope="PRJ" + qualifier="SVW" + name="Java projects" + path="[null]" + id="13"/> - <projects id="113" uuid="HIJK" root_uuid="EFGH" project_uuid="EFGH" module_uuid="FGHI" module_uuid_path=".EFGH.FGHI." copy_component_uuid="JKLM" enabled="[true]" - kee="VIEW2org.struts:struts" scope="FIL" qualifier="TRK" name="Struts" path="[null]"/> + <projects uuid="HIJK" + uuid_path="NOT_USED" + root_uuid="EFGH" + project_uuid="EFGH" + module_uuid="FGHI" + module_uuid_path=".EFGH.FGHI." + copy_component_uuid="JKLM" + enabled="[true]" + kee="VIEW2org.struts:struts" + scope="FIL" + qualifier="TRK" + name="Struts" + path="[null]" + id="113"/> <!-- Real projects --> - <projects id="100" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - uuid="JKLM" root_uuid="JKLM" project_uuid="JKLM" module_uuid="[null]" module_uuid_path="." - enabled="[true]" copy_component_uuid="[null]" path="[null]"/> + <projects uuid="JKLM" + uuid_path="NOT_USED" + root_uuid="JKLM" + project_uuid="JKLM" + module_uuid="[null]" + module_uuid_path="." + enabled="[true]" + copy_component_uuid="[null]" + path="[null]" + id="100" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts"/> - <projects id="101" scope="PRJ" qualifier="TRK" kee="org.elasticsearch:elasticsearch" name="Elasticsearch" - uuid="KLMN" root_uuid="KLMN" project_uuid="KLMN" module_uuid="[null]" module_uuid_path="." - enabled="[true]" copy_component_uuid="[null]" path="[null]"/> + <projects uuid="KLMN" + uuid_path="NOT_USED" + root_uuid="KLMN" + project_uuid="KLMN" + module_uuid="[null]" + module_uuid_path="." + enabled="[true]" + copy_component_uuid="[null]" + path="[null]" + id="101" + scope="PRJ" + qualifier="TRK" + kee="org.elasticsearch:elasticsearch" + name="Elasticsearch"/> - <resource_index id="1" kee="struts" component_uuid="JKLM" root_component_uuid="JKLM" position="0" name_size="6" qualifier="TRK"/> - <resource_index id="2" kee="elasticsearch" component_uuid="KLMN" root_component_uuid="KLMN" position="0" name_size="13" qualifier="TRK"/> - <resource_index id="3" kee="sticsearch" component_uuid="KLMN" root_component_uuid="KLMN" position="1" name_size="13" qualifier="TRK"/> + <resource_index id="1" + kee="struts" + component_uuid="JKLM" + root_component_uuid="JKLM" + position="0" + name_size="6" + qualifier="TRK"/> + <resource_index id="2" + kee="elasticsearch" + component_uuid="KLMN" + root_component_uuid="KLMN" + position="0" + name_size="13" + qualifier="TRK"/> + <resource_index id="3" + kee="sticsearch" + component_uuid="KLMN" + root_component_uuid="KLMN" + position="1" + name_size="13" + qualifier="TRK"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/activity/ActivityManagerTest/shared.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/activity/ActivityManagerTest/shared.xml index 3e4fda90137..01bd67a20ee 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/computation/activity/ActivityManagerTest/shared.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/computation/activity/ActivityManagerTest/shared.xml @@ -1,13 +1,40 @@ <dataset> - <projects id="10" kee="P1" qualifier="TRK" uuid="ABCD" name="Project 1"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + name="Project 1" + id="10" + kee="P1" + qualifier="TRK"/> <snapshots - id="110" - uuid="u110" - project_id="10" parent_snapshot_id="[null]" root_project_id="10" root_snapshot_id="[null]" - purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" - period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" - period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" - scope="PRJ" qualifier="TRK" created_at="1225544280000" build_date="1225544280000" version="[null]" path="" - status="P" islast="[false]" depth="0"/> + id="110" + uuid="u110" + project_id="10" + parent_snapshot_id="[null]" + root_project_id="10" + root_snapshot_id="[null]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1225544280000" + build_date="1225544280000" + version="[null]" + path="" + status="P" + islast="[false]" + depth="0"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/measure/MeasureRepositoryImplTest/shared.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/measure/MeasureRepositoryImplTest/shared.xml index 6b25fb48b90..5815c0a7318 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/computation/measure/MeasureRepositoryImplTest/shared.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/computation/measure/MeasureRepositoryImplTest/shared.xml @@ -1,11 +1,22 @@ <dataset> - <projects id="567" uuid="uuid_1" root_uuid="uuid_1" kee="file cpt key" enabled="[true]"/> + <projects uuid="uuid_1" + uuid_path="NOT_USED" + root_uuid="uuid_1" + kee="file cpt key" + enabled="[true]" + id="567"/> <snapshots id="123" uuid="u123" - component_uuid="uuid_1" root_component_uuid="uuid_1" islast="[true]"/> + component_uuid="uuid_1" + root_component_uuid="uuid_1" + islast="[true]"/> <snapshots id="369" uuid="u369" - component_uuid="uuid_1" root_component_uuid="uuid_1" islast="[false]"/> - <metrics id="1" name="metric 1"/> - <metrics id="2" name="metric 2"/> + component_uuid="uuid_1" + root_component_uuid="uuid_1" + islast="[false]"/> + <metrics id="1" + name="metric 1"/> + <metrics id="2" + name="metric 2"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FillMeasuresWithVariationsStepTest/shared.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FillMeasuresWithVariationsStepTest/shared.xml index cbe40829665..289d321734a 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FillMeasuresWithVariationsStepTest/shared.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/FillMeasuresWithVariationsStepTest/shared.xml @@ -1,55 +1,123 @@ <dataset> - <metrics id="1" name="ncloc" short_name="ncloc" VAL_TYPE="INT" enabled="true"/> - <metrics id="2" name="coverage" short_name="coverage" VAL_TYPE="PERCENT" enabled="true"/> - <metrics id="3" name="file_complexity" short_name="file_complexity" VAL_TYPE="FLOAT" enabled="true"/> - <metrics id="4" name="test_execution_time" short_name="test_execution_time" VAL_TYPE="MILLISEC" enabled="true"/> + <metrics id="1" + name="ncloc" + short_name="ncloc" + VAL_TYPE="INT" + enabled="true"/> + <metrics id="2" + name="coverage" + short_name="coverage" + VAL_TYPE="PERCENT" + enabled="true"/> + <metrics id="3" + name="file_complexity" + short_name="file_complexity" + VAL_TYPE="FLOAT" + enabled="true"/> + <metrics id="4" + name="test_execution_time" + short_name="test_execution_time" + VAL_TYPE="MILLISEC" + enabled="true"/> - <rules id="30" name="Check Header" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" - plugin_config_key="Checker/Treewalker/HeaderCheck" plugin_name="checkstyle"/> + <rules id="30" + name="Check Header" + plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" + plugin_config_key="Checker/Treewalker/HeaderCheck" + plugin_name="checkstyle"/> - <rules id="31" name="Equals Avoid Null" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck" - plugin_config_key="Checker/TreeWalker/EqualsAvoidNull" plugin_name="checkstyle"/> + <rules id="31" + name="Equals Avoid Null" + plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck" + plugin_config_key="Checker/TreeWalker/EqualsAvoidNull" + plugin_name="checkstyle"/> <!-- project --> - <projects id="1" scope="PRJ" qualifier="TRK" kee="PROJECT_KEY" name="project" - root_id="[null]" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD." - enabled="true"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path=".ABCD." + enabled="true" + id="1" + scope="PRJ" + qualifier="TRK" + kee="PROJECT_KEY" + name="project" + root_id="[null]"/> <!-- directory --> - <projects id="2" scope="DIR" qualifier="PAC" kee="DIRECTORY_KEY" name="org.foo" - root_id="1" uuid="BCDE" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path=".ABCD." - enabled="true"/> + <projects uuid="BCDE" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="ABCD" + module_uuid_path=".ABCD." + enabled="true" + id="2" + scope="DIR" + qualifier="PAC" + kee="DIRECTORY_KEY" + name="org.foo" + root_id="1"/> <!-- snapshots --> <snapshots id="1000" uuid="u1000" - project_id="1" root_project_id="1" root_snapshot_id="[null]" - scope="PRJ" qualifier="TRK" created_at="1225544280000" build_date="1225544280000" - status="P" islast="false"/> + project_id="1" + root_project_id="1" + root_snapshot_id="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1225544280000" + build_date="1225544280000" + status="P" + islast="false"/> <snapshots id="1001" uuid="u1001" - project_id="2" root_project_id="1" root_snapshot_id="1000" - scope="DIR" qualifier="PAC" created_at="1225544280000" build_date="1225544280000" - status="P" islast="false"/> + project_id="2" + root_project_id="1" + root_snapshot_id="1000" + scope="DIR" + qualifier="PAC" + created_at="1225544280000" + build_date="1225544280000" + status="P" + islast="false"/> <!-- project measures --> - <project_measures id="1" VALUE="60" METRIC_ID="1" SNAPSHOT_ID="1000" - text_value="[null]" project_id="[null]" + <project_measures id="1" + VALUE="60" + METRIC_ID="1" + SNAPSHOT_ID="1000" + text_value="[null]" + project_id="[null]" person_id="[null]"/> - <project_measures id="2" VALUE="80" METRIC_ID="2" SNAPSHOT_ID="1000" - text_value="[null]" project_id="[null]" + <project_measures id="2" + VALUE="80" + METRIC_ID="2" + SNAPSHOT_ID="1000" + text_value="[null]" + project_id="[null]" person_id="[null]"/> <!-- package measures --> - <project_measures id="3" VALUE="20" METRIC_ID="1" SNAPSHOT_ID="1001" - text_value="[null]" project_id="[null]" + <project_measures id="3" + VALUE="20" + METRIC_ID="1" + SNAPSHOT_ID="1001" + text_value="[null]" + project_id="[null]" person_id="[null]"/> - <project_measures id="4" VALUE="70" METRIC_ID="2" SNAPSHOT_ID="1001" - text_value="[null]" project_id="[null]" + <project_measures id="4" + VALUE="70" + METRIC_ID="2" + SNAPSHOT_ID="1001" + text_value="[null]" + project_id="[null]" person_id="[null]"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/empty.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/empty.xml index a01559680bc..0cbdd6ccc10 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/empty.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/empty.xml @@ -1,5 +1,9 @@ <dataset> - <projects id="1" root_uuid="ABCD" kee="ROOT_KEY" uuid="ABCD"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + id="1" + root_uuid="ABCD" + kee="ROOT_KEY"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/no_previous_version.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/no_previous_version.xml index ee0040b86c3..ac942bded85 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/no_previous_version.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/no_previous_version.xml @@ -1,58 +1,180 @@ <dataset> - <projects id="1" kee="ROOT_KEY" name="project" uuid="ABCD" root_uuid="ABCD"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + root_uuid="ABCD" + id="1" + kee="ROOT_KEY" + name="project"/> <!-- 2008-11-11 --> <!-- Version 0.9 --> <snapshots id="1000" uuid="u1000" - purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" - period5_param="[null]" period5_date="[null]" - component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - scope="PRJ" qualifier="TRK" created_at="1226379600000" build_date="1226379600000" version="0.9" path="" - status="P" islast="[false]" depth="0"/> + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1226379600000" + build_date="1226379600000" + version="0.9" + path="" + status="P" + islast="[false]" + depth="0"/> <!-- 2008-11-12 --> <!-- Version 1.0 --> <snapshots id="1001" uuid="u1001" - purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" - period5_param="[null]" period5_date="[null]" component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - scope="PRJ" qualifier="TRK" created_at="1226494680000" build_date="1226494680000" version="1.0" path="" - status="P" islast="[false]" depth="0"/> + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1226494680000" + build_date="1226494680000" + version="1.0" + path="" + status="P" + islast="[false]" + depth="0"/> <!-- 2008-11-20 --> <!-- First version 1.1 --> <snapshots id="1002" uuid="u1002" - purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" - period5_param="[null]" period5_date="[null]" - component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - scope="PRJ" qualifier="TRK" created_at="1227157200000" build_date="1227157200000" version="1.1" path="" - status="P" islast="[false]" depth="0"/> + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1227157200000" + build_date="1227157200000" + version="1.1" + path="" + status="P" + islast="[false]" + depth="0"/> <!-- 2008-11-22 --> <snapshots id="1003" uuid="u1003" - purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" - period5_param="[null]" period5_date="[null]" - component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - scope="PRJ" qualifier="TRK" created_at="1227358680000" build_date="1227358680000" version="1.1" path="" - status="P" islast="[false]" depth="0"/> + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1227358680000" + build_date="1227358680000" + version="1.1" + path="" + status="P" + islast="[false]" + depth="0"/> <!-- 2008-11-29 --> <!-- Last version 1.1 --> <snapshots id="1004" uuid="u1004" - purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" - period5_param="[null]" period5_date="[null]" component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - scope="PRJ" qualifier="TRK" created_at="1227934800000" build_date="1227934800000" version="1.1" path="" - status="P" islast="[true]" depth="0"/> + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1227934800000" + build_date="1227934800000" + version="1.1" + path="" + status="P" + islast="[true]" + depth="0"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/previous_version_deleted.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/previous_version_deleted.xml index 73af5e041c0..d726b7c810f 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/previous_version_deleted.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/previous_version_deleted.xml @@ -3,6 +3,7 @@ <projects id="1" kee="ROOT_KEY" uuid="ABCD" + uuid_path="NOT_USED" root_uuid="ABCD"/> <!-- 2008-11-11 --> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/previous_version_is_last_one.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/previous_version_is_last_one.xml index 3b718bf9810..ddf898c43b5 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/previous_version_is_last_one.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/previous_version_is_last_one.xml @@ -1,18 +1,44 @@ <dataset> - <projects id="1" kee="ROOT_KEY" name="project" uuid="ABCD" root_uuid="ABCD"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + root_uuid="ABCD" + id="1" + kee="ROOT_KEY" + name="project"/> <!-- 2008-11-11 --> <!-- Version 0.9 --> <snapshots id="1000" uuid="u1000" - purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" - period4_param="[null]" period4_date="[null]" period5_mode="[null]" - period5_param="[null]" period5_date="[null]" - component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - scope="PRJ" qualifier="TRK" created_at="1226379600000" build_date="1226379600000" version="0.9" path="" - status="P" islast="[true]" depth="0"/> + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1226379600000" + build_date="1226379600000" + version="0.9" + path="" + status="P" + islast="[true]" + depth="0"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/shared.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/shared.xml index ceaa3476468..dde047d1844 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/shared.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/shared.xml @@ -4,6 +4,7 @@ kee="ROOT_KEY" name="project" uuid="ABCD" + uuid_path="NOT_USED" root_uuid="ABCD"/> <!-- 2008-11-11 --> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/unprocessed_snapshots.xml b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/unprocessed_snapshots.xml index 75bb4dd7815..05c39dd9eb3 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/unprocessed_snapshots.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/computation/step/LoadPeriodsStepTest/unprocessed_snapshots.xml @@ -1,17 +1,52 @@ <dataset> - <projects id="1" root_uuid="ABCD" scope="PRJ" qualifier="TRK" kee="PROJECT_KEY" name="project" long_name="[null]" description="[null]" - uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD." - enabled="[true]" language="java" /> + <projects uuid="ABCD" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path=".ABCD." + enabled="[true]" + language="java" + id="1" + root_uuid="ABCD" + scope="PRJ" + qualifier="TRK" + kee="PROJECT_KEY" + name="project" + long_name="[null]" + description="[null]"/> <!-- Unprocessed snapshot --> <snapshots id="1000" uuid="u1000" - purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" - period5_param="[null]" period5_date="[null]" - component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - scope="PRJ" qualifier="TRK" created_at="1226379600000" build_date="1226379600000" version="0.9" path="" - status="U" islast="[false]" depth="0"/> + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1226379600000" + build_date="1226379600000" + version="0.9" + path="" + status="U" + islast="[false]" + depth="0"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/ServerIssueStorageTest/load_component_id_from_db.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/ServerIssueStorageTest/load_component_id_from_db.xml index 60d27b9ae4b..bfb676b510a 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/ServerIssueStorageTest/load_component_id_from_db.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/ServerIssueStorageTest/load_component_id_from_db.xml @@ -1,11 +1,29 @@ <dataset> - <projects id="10" scope="PRJ" qualifier="TRK" kee="struts" name="Struts" uuid="ABCD" root_uuid="ABCD"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + root_uuid="ABCD" + id="10" + scope="PRJ" + qualifier="TRK" + kee="struts" + name="Struts"/> <snapshots id="10" uuid="u10" - component_uuid="ABCD" root_component_uuid="ABCD" islast="[true]"/> + component_uuid="ABCD" + root_component_uuid="ABCD" + islast="[true]"/> - <projects id="100" scope="FIL" qualifier="CLA" kee="struts:Action" name="Action" uuid="BCDE" root_uuid="ABCD"/> + <projects uuid="BCDE" + uuid_path="NOT_USED" + root_uuid="ABCD" + id="100" + scope="FIL" + qualifier="CLA" + kee="struts:Action" + name="Action"/> <snapshots id="100" uuid="u100" - component_uuid="BCDE" root_component_uuid="ABCD" islast="[true]"/> + component_uuid="BCDE" + root_component_uuid="ABCD" + islast="[true]"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/ServerIssueStorageTest/load_project_id_from_db.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/ServerIssueStorageTest/load_project_id_from_db.xml index a8b95ef4769..493de474817 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/ServerIssueStorageTest/load_project_id_from_db.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/ServerIssueStorageTest/load_project_id_from_db.xml @@ -1,11 +1,27 @@ <dataset> - <projects id="1" kee="struts" root_uuid="ABCD" uuid="ABCD"/> - <projects id="2" kee="struts:Action.java" root_uuid="ABCD" uuid="BCDE"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + id="1" + kee="struts" + root_uuid="ABCD"/> + <projects uuid="BCDE" + uuid_path="NOT_USED" + id="2" + kee="struts:Action.java" + root_uuid="ABCD"/> <snapshots id="1" uuid="u1" - component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" islast="[true]" /> + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + islast="[true]"/> <snapshots id="2" uuid="u2" - component_uuid="BCDE" parent_snapshot_id="1" root_component_uuid="ABCD" root_snapshot_id="1" islast="[true]" /> + component_uuid="BCDE" + parent_snapshot_id="1" + root_component_uuid="ABCD" + root_snapshot_id="1" + islast="[true]"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/ServerIssueStorageTest/should_insert_new_issues.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/ServerIssueStorageTest/should_insert_new_issues.xml index 60d27b9ae4b..bfb676b510a 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/ServerIssueStorageTest/should_insert_new_issues.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/ServerIssueStorageTest/should_insert_new_issues.xml @@ -1,11 +1,29 @@ <dataset> - <projects id="10" scope="PRJ" qualifier="TRK" kee="struts" name="Struts" uuid="ABCD" root_uuid="ABCD"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + root_uuid="ABCD" + id="10" + scope="PRJ" + qualifier="TRK" + kee="struts" + name="Struts"/> <snapshots id="10" uuid="u10" - component_uuid="ABCD" root_component_uuid="ABCD" islast="[true]"/> + component_uuid="ABCD" + root_component_uuid="ABCD" + islast="[true]"/> - <projects id="100" scope="FIL" qualifier="CLA" kee="struts:Action" name="Action" uuid="BCDE" root_uuid="ABCD"/> + <projects uuid="BCDE" + uuid_path="NOT_USED" + root_uuid="ABCD" + id="100" + scope="FIL" + qualifier="CLA" + kee="struts:Action" + name="Action"/> <snapshots id="100" uuid="u100" - component_uuid="BCDE" root_component_uuid="ABCD" islast="[true]"/> + component_uuid="BCDE" + root_component_uuid="ABCD" + islast="[true]"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/ServerIssueStorageTest/should_update_issues.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/ServerIssueStorageTest/should_update_issues.xml index fb18192c216..1d99aa35612 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/ServerIssueStorageTest/should_update_issues.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/ServerIssueStorageTest/should_update_issues.xml @@ -1,14 +1,32 @@ <dataset> - <projects id="10" scope="PRJ" qualifier="TRK" kee="struts" name="Struts" uuid="ABCD" root_uuid="ABCD"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + root_uuid="ABCD" + id="10" + scope="PRJ" + qualifier="TRK" + kee="struts" + name="Struts"/> <snapshots id="10" uuid="u10" - component_uuid="ABCD" root_component_uuid="ABCD" islast="[true]"/> + component_uuid="ABCD" + root_component_uuid="ABCD" + islast="[true]"/> - <projects id="100" scope="FIL" qualifier="CLA" kee="struts:Action" name="Action" uuid="BCDE" root_uuid="ABCD"/> + <projects uuid="BCDE" + uuid_path="NOT_USED" + root_uuid="ABCD" + id="100" + scope="FIL" + qualifier="CLA" + kee="struts:Action" + name="Action"/> <snapshots id="100" uuid="u100" - component_uuid="BCDE" root_component_uuid="ABCD" islast="[true]"/> + component_uuid="BCDE" + root_component_uuid="ABCD" + islast="[true]"/> <issues id="1" kee="ABCDE" @@ -36,5 +54,5 @@ issue_close_date="[null]" locations="[null]" issue_type="[null]" - /> + /> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueAuthorizationDaoTest/no_authorization.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueAuthorizationDaoTest/no_authorization.xml index b24592a016b..870e665683f 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueAuthorizationDaoTest/no_authorization.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueAuthorizationDaoTest/no_authorization.xml @@ -1,16 +1,39 @@ <dataset> - <projects id="1" uuid="ABC" project_uuid="ABC" module_uuid="[null]" module_uuid_path="." - root_uuid="ABC" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - description="the description" long_name="Apache Struts" - enabled="[true]" language="java" path="[null]" - authorization_updated_at="123456789"/> + <projects uuid="ABC" + uuid_path="NOT_USED" + project_uuid="ABC" + module_uuid="[null]" + module_uuid_path="." + root_uuid="ABC" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts" + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="java" + path="[null]" + authorization_updated_at="123456789" + id="1"/> <!-- no authorizations project ABC. --> - <users id="10" login="user1" name="User 1" email="user1@company.net" active="[true]"/> - <groups id="100" name="devs"/> + <users id="10" + login="user1" + name="User 1" + email="user1@company.net" + active="[true]"/> + <groups id="100" + name="devs"/> - <user_roles id="1" user_id="10" resource_id="2" role="user"/> - <group_roles id="1" group_id="100" resource_id="2" role="admin"/> + <user_roles id="1" + user_id="10" + resource_id="2" + role="user"/> + <group_roles id="1" + group_id="100" + resource_id="2" + role="admin"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueAuthorizationDaoTest/shared.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueAuthorizationDaoTest/shared.xml index 4a8ebf00a64..fd8f98276bb 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueAuthorizationDaoTest/shared.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueAuthorizationDaoTest/shared.xml @@ -1,36 +1,99 @@ <dataset> - <projects id="1" uuid="ABC" project_uuid="ABC" module_uuid="[null]" module_uuid_path="." - root_uuid="ABC" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - description="the description" long_name="Apache Struts" - enabled="[true]" language="java" path="[null]" - authorization_updated_at="1000000000"/> + <projects uuid="ABC" + uuid_path="NOT_USED" + project_uuid="ABC" + module_uuid="[null]" + module_uuid_path="." + root_uuid="ABC" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts" + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="java" + path="[null]" + authorization_updated_at="1000000000" + id="1"/> - <projects id="2" uuid="DEF" project_uuid="DEF" module_uuid="[null]" module_uuid_path="." - root_uuid="ABC" scope="PRJ" qualifier="TRK" kee="org.sonar.sample" name="Sample" - description="the description" long_name="Sample" - enabled="[true]" language="java" path="[null]" - authorization_updated_at="2000000000"/> + <projects uuid="DEF" + uuid_path="NOT_USED" + project_uuid="DEF" + module_uuid="[null]" + module_uuid_path="." + root_uuid="ABC" + scope="PRJ" + qualifier="TRK" + kee="org.sonar.sample" + name="Sample" + description="the description" + long_name="Sample" + enabled="[true]" + language="java" + path="[null]" + authorization_updated_at="2000000000" + id="2"/> <!-- user1 can access both projects --> - <users id="10" login="user1" name="User 1" email="user1@company.net" active="[true]"/> - <user_roles id="1" user_id="10" resource_id="1" role="user"/> - <user_roles id="2" user_id="10" resource_id="1" role="admin"/> - <user_roles id="3" user_id="10" resource_id="2" role="user"/> + <users id="10" + login="user1" + name="User 1" + email="user1@company.net" + active="[true]"/> + <user_roles id="1" + user_id="10" + resource_id="1" + role="user"/> + <user_roles id="2" + user_id="10" + resource_id="1" + role="admin"/> + <user_roles id="3" + user_id="10" + resource_id="2" + role="user"/> <!-- group devs has user access on ABC only --> - <groups id="100" name="devs"/> - <group_roles id="1" group_id="100" resource_id="1" role="user"/> - <group_roles id="2" group_id="100" resource_id="1" role="admin"/> + <groups id="100" + name="devs"/> + <group_roles id="1" + group_id="100" + resource_id="1" + role="user"/> + <group_roles id="2" + group_id="100" + resource_id="1" + role="admin"/> <!-- Anyone group has user access on both projects --> - <group_roles id="4" group_id="[null]" resource_id="1" role="user"/> - <group_roles id="5" group_id="[null]" resource_id="1" role="admin"/> - <group_roles id="6" group_id="[null]" resource_id="2" role="user"/> + <group_roles id="4" + group_id="[null]" + resource_id="1" + role="user"/> + <group_roles id="5" + group_id="[null]" + resource_id="1" + role="admin"/> + <group_roles id="6" + group_id="[null]" + resource_id="2" + role="user"/> <!-- user2 has user access on DEF only --> - <users id="11" login="user2" name="User 2" email="user2@company.net" active="[true]" /> - <user_roles id="4" user_id="11" resource_id="1" role="admin"/> - <user_roles id="5" user_id="11" resource_id="2" role="user"/> + <users id="11" + login="user2" + name="User 2" + email="user2@company.net" + active="[true]"/> + <user_roles id="4" + user_id="11" + resource_id="1" + role="admin"/> + <user_roles id="5" + user_id="11" + resource_id="2" + role="user"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueAuthorizationIndexerTest/index.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueAuthorizationIndexerTest/index.xml index 6ef3ef25402..6700e00ccbe 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueAuthorizationIndexerTest/index.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueAuthorizationIndexerTest/index.xml @@ -1,22 +1,60 @@ <dataset> - <projects id="1" uuid="ABC" project_uuid="ABC" module_uuid="[null]" module_uuid_path="." - root_uuid="ABC" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - description="the description" long_name="Apache Struts" - enabled="[true]" language="java" path="[null]" - authorization_updated_at="123456789"/> + <projects uuid="ABC" + uuid_path="NOT_USED" + project_uuid="ABC" + module_uuid="[null]" + module_uuid_path="." + root_uuid="ABC" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts" + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="java" + path="[null]" + authorization_updated_at="123456789" + id="1"/> - <users id="10" login="user1" name="User 1" email="user1@company.net" active="[true]"/> - <user_roles id="1" user_id="10" resource_id="1" role="user"/> - <user_roles id="2" user_id="10" resource_id="1" role="admin"/> - <user_roles id="3" user_id="10" resource_id="2" role="admin"/> + <users id="10" + login="user1" + name="User 1" + email="user1@company.net" + active="[true]"/> + <user_roles id="1" + user_id="10" + resource_id="1" + role="user"/> + <user_roles id="2" + user_id="10" + resource_id="1" + role="admin"/> + <user_roles id="3" + user_id="10" + resource_id="2" + role="admin"/> - <groups id="100" name="devs"/> - <group_roles id="1" group_id="100" resource_id="1" role="user"/> - <group_roles id="2" group_id="100" resource_id="2" role="admin"/> + <groups id="100" + name="devs"/> + <group_roles id="1" + group_id="100" + resource_id="1" + role="user"/> + <group_roles id="2" + group_id="100" + resource_id="2" + role="admin"/> <!-- Anyone group --> - <group_roles id="3" group_id="[null]" resource_id="1" role="user"/> - <group_roles id="4" group_id="[null]" resource_id="2" role="admin"/> + <group_roles id="3" + group_id="[null]" + resource_id="1" + role="user"/> + <group_roles id="4" + group_id="[null]" + resource_id="2" + role="admin"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index.xml index 0651a152049..6ed27b0b58e 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index.xml @@ -1,12 +1,34 @@ <dataset> - <rules id="1" tags="[null]" system_tags="[null]" name="Avoid Cycles" plugin_rule_key="AvoidCycles" - plugin_config_key="[null]" plugin_name="squid"/> + <rules id="1" + tags="[null]" + system_tags="[null]" + name="Avoid Cycles" + plugin_rule_key="AvoidCycles" + plugin_config_key="[null]" + plugin_name="squid"/> - <projects id="10" scope="PRJ" qualifier="TRK" kee="the_project" name="TheProject" - uuid="THE_PROJECT" root_uuid="THE_PROJECT" module_uuid="[null]" module_uuid_path="." path="[null]"/> - <projects id="11" scope="FIL" qualifier="FIL" kee="abcde" name="TheFile" - uuid="THE_FILE" root_uuid="THE_PROJECT" module_uuid="THE_PROJECT" module_uuid_path=".THE_PROJECT." - path="src/main/java/TheFile.java"/> + <projects uuid="THE_PROJECT" + uuid_path="NOT_USED" + root_uuid="THE_PROJECT" + module_uuid="[null]" + module_uuid_path="." + path="[null]" + id="10" + scope="PRJ" + qualifier="TRK" + kee="the_project" + name="TheProject"/> + <projects uuid="THE_FILE" + uuid_path="NOT_USED" + root_uuid="THE_PROJECT" + module_uuid="THE_PROJECT" + module_uuid_path=".THE_PROJECT." + path="src/main/java/TheFile.java" + id="11" + scope="FIL" + qualifier="FIL" + kee="abcde" + name="TheFile"/> <issues id="1" kee="ABCDE" @@ -34,5 +56,5 @@ issue_close_date="[null]" locations="[null]" issue_type="2" - /> + /> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index_project.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index_project.xml index e5aa741671c..15db5d0f386 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index_project.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueIndexerTest/index_project.xml @@ -1,13 +1,35 @@ <dataset> - <rules id="1" tags="[null]" system_tags="[null]" name="Avoid Cycles" plugin_rule_key="AvoidCycles" - plugin_config_key="[null]" plugin_name="squid"/> + <rules id="1" + tags="[null]" + system_tags="[null]" + name="Avoid Cycles" + plugin_rule_key="AvoidCycles" + plugin_config_key="[null]" + plugin_name="squid"/> <!-- Project 1 --> - <projects id="10" scope="PRJ" qualifier="TRK" kee="the_project_1" name="TheProject1" - uuid="THE_PROJECT_1" root_uuid="THE_PROJECT_1" module_uuid="[null]" module_uuid_path="." path="[null]"/> - <projects id="11" scope="FIL" qualifier="FIL" kee="the_file_1" name="TheFile1" - uuid="THE_FILE_1" root_uuid="THE_PROJECT_1" module_uuid="THE_PROJECT_1" module_uuid_path=".THE_PROJECT_1." - path="src/main/java/TheFile.java"/> + <projects uuid="THE_PROJECT_1" + uuid_path="NOT_USED" + root_uuid="THE_PROJECT_1" + module_uuid="[null]" + module_uuid_path="." + path="[null]" + id="10" + scope="PRJ" + qualifier="TRK" + kee="the_project_1" + name="TheProject1"/> + <projects uuid="THE_FILE_1" + uuid_path="NOT_USED" + root_uuid="THE_PROJECT_1" + module_uuid="THE_PROJECT_1" + module_uuid_path=".THE_PROJECT_1." + path="src/main/java/TheFile.java" + id="11" + scope="FIL" + qualifier="FIL" + kee="the_file_1" + name="TheFile1"/> <issues id="1" kee="ABCDE" @@ -38,11 +60,28 @@ /> <!-- Project 2 --> - <projects id="100" scope="PRJ" qualifier="TRK" kee="the_project_2" name="TheProject2" - uuid="THE_PROJECT_2" root_uuid="THE_PROJECT_2" module_uuid="[null]" module_uuid_path="." path="[null]"/> - <projects id="111" scope="FIL" qualifier="FIL" kee="the_file_2" name="TheFile2" - uuid="THE_FILE_2" root_uuid="THE_PROJECT_2" module_uuid="THE_PROJECT_2" module_uuid_path=".THE_PROJECT_2." - path="src/main/java/TheFile.java"/> + <projects uuid="THE_PROJECT_2" + uuid_path="NOT_USED" + root_uuid="THE_PROJECT_2" + module_uuid="[null]" + module_uuid_path="." + path="[null]" + id="100" + scope="PRJ" + qualifier="TRK" + kee="the_project_2" + name="TheProject2"/> + <projects uuid="THE_FILE_2" + uuid_path="NOT_USED" + root_uuid="THE_PROJECT_2" + module_uuid="THE_PROJECT_2" + module_uuid_path=".THE_PROJECT_2." + path="src/main/java/TheFile.java" + id="111" + scope="FIL" + qualifier="FIL" + kee="the_file_2" + name="TheFile2"/> <issues id="10" kee="EDCBA" diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/extract_directory_path.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/extract_directory_path.xml index 2da877f4899..a020c9fe508 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/extract_directory_path.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/extract_directory_path.xml @@ -1,126 +1,167 @@ <dataset> - <rules tags="[null]" system_tags="[null]" id="200" name="Avoid Cycles" plugin_rule_key="AvoidCycles" - plugin_config_key="[null]" plugin_name="squid"/> + <rules tags="[null]" + system_tags="[null]" + id="200" + name="Avoid Cycles" + plugin_rule_key="AvoidCycles" + plugin_config_key="[null]" + plugin_name="squid"/> - <projects id="10" scope="PRJ" qualifier="TRK" kee="struts" name="Struts" uuid="PROJECT" root_uuid="MODULE" path="[null]" module_uuid_path=".PROJECT."/> - <projects id="11" scope="PRJ" qualifier="BRC" kee="struts-core" name="Struts Core" uuid="MODULE" root_uuid="PROJECT" path="struts-core" module_uuid_path=".PROJECT.MODULE."/> - <projects id="100" scope="FIL" qualifier="FIL" kee="struts:Action" name="Action" uuid="FILE" root_uuid="MODULE" path="src/main/java/Action.java" module_uuid_path=".PROJECT.MODULE."/> - <projects id="101" scope="FIL" qualifier="FIL" kee="pom" name="pom.xml" uuid="ROOT_FILE" root_uuid="MODULE" path="pom.xml" module_uuid_path=".PROJECT.MODULE."/> + <projects uuid="PROJECT" + uuid_path="NOT_USED" + root_uuid="MODULE" + path="[null]" + module_uuid_path=".PROJECT." + id="10" + scope="PRJ" + qualifier="TRK" + kee="struts" + name="Struts"/> + <projects uuid="MODULE" + uuid_path="NOT_USED" + root_uuid="PROJECT" + path="struts-core" + module_uuid_path=".PROJECT.MODULE." + id="11" + scope="PRJ" + qualifier="BRC" + kee="struts-core" + name="Struts Core"/> + <projects uuid="FILE" + uuid_path="NOT_USED" + root_uuid="MODULE" + path="src/main/java/Action.java" + module_uuid_path=".PROJECT.MODULE." + id="100" + scope="FIL" + qualifier="FIL" + kee="struts:Action" + name="Action"/> + <projects uuid="ROOT_FILE" + uuid_path="NOT_USED" + root_uuid="MODULE" + path="pom.xml" + module_uuid_path=".PROJECT.MODULE." + id="101" + scope="FIL" + qualifier="FIL" + kee="pom" + name="pom.xml"/> <issues - id="1" - kee="ABC" - resolution="FIXED" - status="RESOLVED" - severity="BLOCKER" - manual_severity="[false]" - assignee="guy1" - author_login="guy2" - checksum="FFFFF" - gap="[null]" - effort="10" - message="[null]" - line="444" - component_uuid="FILE" - project_uuid="PROJECT" - rule_id="200" - reporter="[null]" - issue_attributes="JIRA=http://jira.com" - action_plan_key="[null]" - tags="tag1,tag2,tag3" - created_at="1400000000000" - updated_at="1400000000000" - issue_creation_date="1115848800000" - issue_update_date="1356994800000" - issue_close_date="[null]" - locations="[null]" - issue_type="1"/> + id="1" + kee="ABC" + resolution="FIXED" + status="RESOLVED" + severity="BLOCKER" + manual_severity="[false]" + assignee="guy1" + author_login="guy2" + checksum="FFFFF" + gap="[null]" + effort="10" + message="[null]" + line="444" + component_uuid="FILE" + project_uuid="PROJECT" + rule_id="200" + reporter="[null]" + issue_attributes="JIRA=http://jira.com" + action_plan_key="[null]" + tags="tag1,tag2,tag3" + created_at="1400000000000" + updated_at="1400000000000" + issue_creation_date="1115848800000" + issue_update_date="1356994800000" + issue_close_date="[null]" + locations="[null]" + issue_type="1"/> <issues - id="2" - kee="DEF" - resolution="[null]" - status="OPEN" - severity="MAJOR" - manual_severity="[false]" - assignee="guy2" - author_login="[null]" - checksum="FFFFF" - gap="[null]" - effort="15" - message="[null]" - line="444" - component_uuid="ROOT_FILE" - project_uuid="PROJECT" - rule_id="200" - reporter="[null]" - issue_attributes="JIRA=http://jira.com" - action_plan_key="[null]" - tags="[null]" - created_at="1400000000000" - updated_at="1450000000000" - issue_creation_date="1115848800000" - issue_update_date="1368828000000" - issue_close_date="[null]" - locations="[null]" - issue_type="1"/> + id="2" + kee="DEF" + resolution="[null]" + status="OPEN" + severity="MAJOR" + manual_severity="[false]" + assignee="guy2" + author_login="[null]" + checksum="FFFFF" + gap="[null]" + effort="15" + message="[null]" + line="444" + component_uuid="ROOT_FILE" + project_uuid="PROJECT" + rule_id="200" + reporter="[null]" + issue_attributes="JIRA=http://jira.com" + action_plan_key="[null]" + tags="[null]" + created_at="1400000000000" + updated_at="1450000000000" + issue_creation_date="1115848800000" + issue_update_date="1368828000000" + issue_close_date="[null]" + locations="[null]" + issue_type="1"/> <issues - id="3" - kee="EFG" - resolution="[null]" - status="OPEN" - severity="MAJOR" - manual_severity="[false]" - assignee="guy2" - author_login="[null]" - checksum="FFFFF" - gap="[null]" - effort="15" - message="[null]" - line="[null]" - component_uuid="PROJECT" - project_uuid="PROJECT" - rule_id="200" - reporter="[null]" - issue_attributes="JIRA=http://jira.com" - action_plan_key="[null]" - tags="[null]" - created_at="1400000000000" - updated_at="1450000000000" - issue_creation_date="1115848800000" - issue_update_date="1368828000000" - issue_close_date="[null]" - locations="[null]" - issue_type="1"/> + id="3" + kee="EFG" + resolution="[null]" + status="OPEN" + severity="MAJOR" + manual_severity="[false]" + assignee="guy2" + author_login="[null]" + checksum="FFFFF" + gap="[null]" + effort="15" + message="[null]" + line="[null]" + component_uuid="PROJECT" + project_uuid="PROJECT" + rule_id="200" + reporter="[null]" + issue_attributes="JIRA=http://jira.com" + action_plan_key="[null]" + tags="[null]" + created_at="1400000000000" + updated_at="1450000000000" + issue_creation_date="1115848800000" + issue_update_date="1368828000000" + issue_close_date="[null]" + locations="[null]" + issue_type="1"/> <issues - id="4" - kee="FGH" - resolution="[null]" - status="OPEN" - severity="MAJOR" - manual_severity="[false]" - assignee="guy2" - author_login="[null]" - checksum="FFFFF" - gap="[null]" - effort="15" - message="[null]" - line="[null]" - component_uuid="MODULE" - project_uuid="PROJECT" - rule_id="200" - reporter="[null]" - issue_attributes="JIRA=http://jira.com" - action_plan_key="[null]" - tags="[null]" - created_at="1400000000000" - updated_at="1450000000000" - issue_creation_date="1115848800000" - issue_update_date="1368828000000" - issue_close_date="[null]" - locations="[null]" - issue_type="1"/> + id="4" + kee="FGH" + resolution="[null]" + status="OPEN" + severity="MAJOR" + manual_severity="[false]" + assignee="guy2" + author_login="[null]" + checksum="FFFFF" + gap="[null]" + effort="15" + message="[null]" + line="[null]" + component_uuid="MODULE" + project_uuid="PROJECT" + rule_id="200" + reporter="[null]" + issue_attributes="JIRA=http://jira.com" + action_plan_key="[null]" + tags="[null]" + created_at="1400000000000" + updated_at="1450000000000" + issue_creation_date="1115848800000" + issue_update_date="1368828000000" + issue_close_date="[null]" + locations="[null]" + issue_type="1"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/extract_file_path.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/extract_file_path.xml index f7d0cd8bbda..7d0ec58c7ef 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/extract_file_path.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/extract_file_path.xml @@ -1,126 +1,167 @@ <dataset> - <rules tags="[null]" system_tags="[null]" id="200" name="Avoid Cycles" plugin_rule_key="AvoidCycles" - plugin_config_key="[null]" plugin_name="squid"/> + <rules tags="[null]" + system_tags="[null]" + id="200" + name="Avoid Cycles" + plugin_rule_key="AvoidCycles" + plugin_config_key="[null]" + plugin_name="squid"/> - <projects id="10" scope="PRJ" qualifier="TRK" kee="struts" name="Struts" uuid="PROJECT" root_uuid="MODULE" path="[null]" module_uuid_path=".PROJECT."/> - <projects id="11" scope="PRJ" qualifier="BRC" kee="struts-core" name="Struts Core" uuid="MODULE" root_uuid="PROJECT" path="struts-core" module_uuid_path=".PROJECT.MODULE."/> - <projects id="100" scope="FIL" qualifier="FIL" kee="struts:Action" name="Action" uuid="FILE" root_uuid="MODULE" path="src/main/java/Action.java" module_uuid_path=".PROJECT.MODULE."/> - <projects id="101" scope="FIL" qualifier="FIL" kee="pom" name="pom.xml" uuid="ROOT_FILE" root_uuid="MODULE" path="pom.xml" module_uuid_path=".PROJECT.MODULE."/> + <projects uuid="PROJECT" + uuid_path="NOT_USED" + root_uuid="MODULE" + path="[null]" + module_uuid_path=".PROJECT." + id="10" + scope="PRJ" + qualifier="TRK" + kee="struts" + name="Struts"/> + <projects uuid="MODULE" + uuid_path="NOT_USED" + root_uuid="PROJECT" + path="struts-core" + module_uuid_path=".PROJECT.MODULE." + id="11" + scope="PRJ" + qualifier="BRC" + kee="struts-core" + name="Struts Core"/> + <projects uuid="FILE" + uuid_path="NOT_USED" + root_uuid="MODULE" + path="src/main/java/Action.java" + module_uuid_path=".PROJECT.MODULE." + id="100" + scope="FIL" + qualifier="FIL" + kee="struts:Action" + name="Action"/> + <projects uuid="ROOT_FILE" + uuid_path="NOT_USED" + root_uuid="MODULE" + path="pom.xml" + module_uuid_path=".PROJECT.MODULE." + id="101" + scope="FIL" + qualifier="FIL" + kee="pom" + name="pom.xml"/> <issues - id="1" - kee="ABC" - resolution="FIXED" - status="RESOLVED" - severity="BLOCKER" - manual_severity="[false]" - assignee="guy1" - author_login="guy2" - checksum="FFFFF" - gap="[null]" - effort="10" - message="[null]" - line="444" - component_uuid="FILE" - project_uuid="PROJECT" - rule_id="200" - reporter="[null]" - issue_attributes="JIRA=http://jira.com" - action_plan_key="PLAN1" - tags="tag1,tag2,tag3" - created_at="1400000000000" - updated_at="1400000000000" - issue_creation_date="1115848800000" - issue_update_date="1356994800000" - issue_close_date="[null]" - locations="[null]" - issue_type="1"/> + id="1" + kee="ABC" + resolution="FIXED" + status="RESOLVED" + severity="BLOCKER" + manual_severity="[false]" + assignee="guy1" + author_login="guy2" + checksum="FFFFF" + gap="[null]" + effort="10" + message="[null]" + line="444" + component_uuid="FILE" + project_uuid="PROJECT" + rule_id="200" + reporter="[null]" + issue_attributes="JIRA=http://jira.com" + action_plan_key="PLAN1" + tags="tag1,tag2,tag3" + created_at="1400000000000" + updated_at="1400000000000" + issue_creation_date="1115848800000" + issue_update_date="1356994800000" + issue_close_date="[null]" + locations="[null]" + issue_type="1"/> <issues - id="2" - kee="DEF" - resolution="[null]" - status="OPEN" - severity="MAJOR" - manual_severity="[false]" - assignee="guy2" - author_login="[null]" - checksum="FFFFF" - gap="[null]" - effort="15" - message="[null]" - line="444" - component_uuid="ROOT_FILE" - project_uuid="PROJECT" - rule_id="200" - reporter="[null]" - issue_attributes="JIRA=http://jira.com" - action_plan_key="PLAN2" - tags="[null]" - created_at="1400000000000" - updated_at="1450000000000" - issue_creation_date="1115848800000" - issue_update_date="1368828000000" - issue_close_date="[null]" - locations="[null]" - issue_type="1"/> + id="2" + kee="DEF" + resolution="[null]" + status="OPEN" + severity="MAJOR" + manual_severity="[false]" + assignee="guy2" + author_login="[null]" + checksum="FFFFF" + gap="[null]" + effort="15" + message="[null]" + line="444" + component_uuid="ROOT_FILE" + project_uuid="PROJECT" + rule_id="200" + reporter="[null]" + issue_attributes="JIRA=http://jira.com" + action_plan_key="PLAN2" + tags="[null]" + created_at="1400000000000" + updated_at="1450000000000" + issue_creation_date="1115848800000" + issue_update_date="1368828000000" + issue_close_date="[null]" + locations="[null]" + issue_type="1"/> <issues - id="3" - kee="EFG" - resolution="[null]" - status="OPEN" - severity="MAJOR" - manual_severity="[false]" - assignee="guy2" - author_login="[null]" - checksum="FFFFF" - gap="[null]" - effort="15" - message="[null]" - line="[null]" - component_uuid="PROJECT" - project_uuid="PROJECT" - rule_id="200" - reporter="[null]" - issue_attributes="JIRA=http://jira.com" - action_plan_key="PLAN2" - tags="[null]" - created_at="1400000000000" - updated_at="1450000000000" - issue_creation_date="1115848800000" - issue_update_date="1368828000000" - issue_close_date="[null]" - locations="[null]" - issue_type="1"/> + id="3" + kee="EFG" + resolution="[null]" + status="OPEN" + severity="MAJOR" + manual_severity="[false]" + assignee="guy2" + author_login="[null]" + checksum="FFFFF" + gap="[null]" + effort="15" + message="[null]" + line="[null]" + component_uuid="PROJECT" + project_uuid="PROJECT" + rule_id="200" + reporter="[null]" + issue_attributes="JIRA=http://jira.com" + action_plan_key="PLAN2" + tags="[null]" + created_at="1400000000000" + updated_at="1450000000000" + issue_creation_date="1115848800000" + issue_update_date="1368828000000" + issue_close_date="[null]" + locations="[null]" + issue_type="1"/> <issues - id="4" - kee="FGH" - resolution="[null]" - status="OPEN" - severity="MAJOR" - manual_severity="[false]" - assignee="guy2" - author_login="[null]" - checksum="FFFFF" - gap="[null]" - effort="15" - message="[null]" - line="[null]" - component_uuid="MODULE" - project_uuid="PROJECT" - rule_id="200" - reporter="[null]" - issue_attributes="JIRA=http://jira.com" - action_plan_key="PLAN2" - tags="[null]" - created_at="1400000000000" - updated_at="1450000000000" - issue_creation_date="1115848800000" - issue_update_date="1368828000000" - issue_close_date="[null]" - locations="[null]" - issue_type="1"/> + id="4" + kee="FGH" + resolution="[null]" + status="OPEN" + severity="MAJOR" + manual_severity="[false]" + assignee="guy2" + author_login="[null]" + checksum="FFFFF" + gap="[null]" + effort="15" + message="[null]" + line="[null]" + component_uuid="MODULE" + project_uuid="PROJECT" + rule_id="200" + reporter="[null]" + issue_attributes="JIRA=http://jira.com" + action_plan_key="PLAN2" + tags="[null]" + created_at="1400000000000" + updated_at="1450000000000" + issue_creation_date="1115848800000" + issue_update_date="1368828000000" + issue_close_date="[null]" + locations="[null]" + issue_type="1"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/many_projects.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/many_projects.xml index d7b49d669db..758f56683df 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/many_projects.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/many_projects.xml @@ -1,13 +1,35 @@ <dataset> - <rules id="1" tags="[null]" system_tags="[null]" name="Avoid Cycles" plugin_rule_key="AvoidCycles" - plugin_config_key="[null]" plugin_name="squid"/> + <rules id="1" + tags="[null]" + system_tags="[null]" + name="Avoid Cycles" + plugin_rule_key="AvoidCycles" + plugin_config_key="[null]" + plugin_name="squid"/> <!-- Project 1 --> - <projects id="10" scope="PRJ" qualifier="TRK" kee="the_project_1" name="TheProject1" - uuid="THE_PROJECT_1" root_uuid="THE_PROJECT_1" module_uuid="[null]" module_uuid_path="." path="[null]"/> - <projects id="11" scope="FIL" qualifier="FIL" kee="the_file_1" name="TheFile1" - uuid="THE_FILE_1" root_uuid="THE_PROJECT_1" module_uuid="THE_PROJECT_1" module_uuid_path=".THE_PROJECT_1." - path="src/main/java/TheFile.java"/> + <projects uuid="THE_PROJECT_1" + uuid_path="NOT_USED" + root_uuid="THE_PROJECT_1" + module_uuid="[null]" + module_uuid_path="." + path="[null]" + id="10" + scope="PRJ" + qualifier="TRK" + kee="the_project_1" + name="TheProject1"/> + <projects uuid="THE_FILE_1" + uuid_path="NOT_USED" + root_uuid="THE_PROJECT_1" + module_uuid="THE_PROJECT_1" + module_uuid_path=".THE_PROJECT_1." + path="src/main/java/TheFile.java" + id="11" + scope="FIL" + qualifier="FIL" + kee="the_file_1" + name="TheFile1"/> <issues id="1" kee="ABCDE" @@ -66,11 +88,28 @@ /> <!-- Project 2 --> - <projects id="100" scope="PRJ" qualifier="TRK" kee="the_project_2" name="TheProject2" - uuid="THE_PROJECT_2" root_uuid="THE_PROJECT_2" module_uuid="[null]" module_uuid_path="." path="[null]"/> - <projects id="111" scope="FIL" qualifier="FIL" kee="the_file_2" name="TheFile2" - uuid="THE_FILE_2" root_uuid="THE_PROJECT_2" module_uuid="THE_PROJECT_2" module_uuid_path=".THE_PROJECT_2." - path="src/main/java/TheFile.java"/> + <projects uuid="THE_PROJECT_2" + uuid_path="NOT_USED" + root_uuid="THE_PROJECT_2" + module_uuid="[null]" + module_uuid_path="." + path="[null]" + id="100" + scope="PRJ" + qualifier="TRK" + kee="the_project_2" + name="TheProject2"/> + <projects uuid="THE_FILE_2" + uuid_path="NOT_USED" + root_uuid="THE_PROJECT_2" + module_uuid="THE_PROJECT_2" + module_uuid_path=".THE_PROJECT_2." + path="src/main/java/TheFile.java" + id="111" + scope="FIL" + qualifier="FIL" + kee="the_file_2" + name="TheFile2"/> <issues id="10" kee="EDCBA" diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/one_issue.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/one_issue.xml index 7b64628aabc..67f4b6a197e 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/one_issue.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/one_issue.xml @@ -1,40 +1,81 @@ <dataset> - <rules tags="[null]" system_tags="[null]" id="200" name="Avoid Cycles" plugin_rule_key="AvoidCycles" - plugin_config_key="[null]" plugin_name="squid"/> + <rules tags="[null]" + system_tags="[null]" + id="200" + name="Avoid Cycles" + plugin_rule_key="AvoidCycles" + plugin_config_key="[null]" + plugin_name="squid"/> - <projects id="10" scope="PRJ" qualifier="TRK" kee="struts" name="Struts" uuid="PROJECT1" root_uuid="PROJECT1" path="[null]" module_uuid_path=".PROJECT1."/> - <projects id="50" scope="PRJ" qualifier="BRC" kee="struts:struts-tiles" name="Struts Tiles" uuid="MODULE1" root_uuid="PROJECT1" path="[null]" module_uuid_path=".PROJECT1.MODULE1."/> - <projects id="70" scope="DIR" qualifier="DIR" kee="struts:struts-tiles:/" name="src/main/java/" uuid="DIR1" root_uuid="MODULE1" path="src/main/java" module_uuid_path=".PROJECT1.MODULE1."/> - <projects id="100" scope="FIL" qualifier="CLA" kee="struts:Action" name="Action" uuid="FILE1" root_uuid="MODULE1" path="src/main/java/Action.java" module_uuid_path=".PROJECT1."/> + <projects uuid="PROJECT1" + uuid_path="NOT_USED" + root_uuid="PROJECT1" + path="[null]" + module_uuid_path=".PROJECT1." + id="10" + scope="PRJ" + qualifier="TRK" + kee="struts" + name="Struts"/> + <projects uuid="MODULE1" + uuid_path="NOT_USED" + root_uuid="PROJECT1" + path="[null]" + module_uuid_path=".PROJECT1.MODULE1." + id="50" + scope="PRJ" + qualifier="BRC" + kee="struts:struts-tiles" + name="Struts Tiles"/> + <projects uuid="DIR1" + uuid_path="NOT_USED" + root_uuid="MODULE1" + path="src/main/java" + module_uuid_path=".PROJECT1.MODULE1." + id="70" + scope="DIR" + qualifier="DIR" + kee="struts:struts-tiles:/" + name="src/main/java/"/> + <projects uuid="FILE1" + uuid_path="NOT_USED" + root_uuid="MODULE1" + path="src/main/java/Action.java" + module_uuid_path=".PROJECT1." + id="100" + scope="FIL" + qualifier="CLA" + kee="struts:Action" + name="Action"/> <issues - id="1" - kee="ABC" - resolution="FIXED" - status="RESOLVED" - severity="BLOCKER" - manual_severity="[false]" - assignee="guy1" - author_login="guy2" - checksum="FFFFF" - gap="2" - effort="10" - message="[null]" - line="444" - component_uuid="FILE1" - project_uuid="PROJECT1" - rule_id="200" - reporter="[null]" - issue_attributes="JIRA=http://jira.com" - action_plan_key="PLAN1" - tags="tag1,tag2,tag3" - created_at="1400000000000" - updated_at="1400000000000" - issue_creation_date="1115848800000" - issue_update_date="1356994800000" - issue_close_date="[null]" - locations="[null]" - issue_type="2" + id="1" + kee="ABC" + resolution="FIXED" + status="RESOLVED" + severity="BLOCKER" + manual_severity="[false]" + assignee="guy1" + author_login="guy2" + checksum="FFFFF" + gap="2" + effort="10" + message="[null]" + line="444" + component_uuid="FILE1" + project_uuid="PROJECT1" + rule_id="200" + reporter="[null]" + issue_attributes="JIRA=http://jira.com" + action_plan_key="PLAN1" + tags="tag1,tag2,tag3" + created_at="1400000000000" + updated_at="1400000000000" + issue_creation_date="1115848800000" + issue_update_date="1356994800000" + issue_close_date="[null]" + locations="[null]" + issue_type="2" /> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/shared.xml b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/shared.xml index 00a834ce17f..396bb288c47 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/shared.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/issue/index/IssueResultSetIteratorTest/shared.xml @@ -1,11 +1,52 @@ <dataset> - <rules tags="[null]" system_tags="[null]" id="200" name="Avoid Cycles" plugin_rule_key="AvoidCycles" - plugin_config_key="[null]" plugin_name="squid"/> + <rules tags="[null]" + system_tags="[null]" + id="200" + name="Avoid Cycles" + plugin_rule_key="AvoidCycles" + plugin_config_key="[null]" + plugin_name="squid"/> - <projects id="10" scope="PRJ" qualifier="TRK" kee="struts" name="Struts" uuid="PROJECT1" root_uuid="PROJECT1" path="[null]" module_uuid_path=".PROJECT1."/> - <projects id="50" scope="PRJ" qualifier="BRC" kee="struts:struts-tiles" name="Struts Tiles" uuid="MODULE1" root_uuid="PROJECT1" path="[null]" module_uuid_path=".PROJECT1.MODULE1."/> - <projects id="70" scope="DIR" qualifier="DIR" kee="struts:struts-tiles:/" name="src/main/java/" uuid="DIR1" root_uuid="MODULE1" path="src/main/java" module_uuid_path=".PROJECT1.MODULE1."/> - <projects id="100" scope="FIL" qualifier="CLA" kee="struts:Action" name="Action" uuid="FILE1" root_uuid="MODULE1" path="src/main/java/Action.java" module_uuid_path=".PROJECT1."/> + <projects uuid="PROJECT1" + uuid_path="NOT_USED" + root_uuid="PROJECT1" + path="[null]" + module_uuid_path=".PROJECT1." + id="10" + scope="PRJ" + qualifier="TRK" + kee="struts" + name="Struts"/> + <projects uuid="MODULE1" + uuid_path="NOT_USED" + root_uuid="PROJECT1" + path="[null]" + module_uuid_path=".PROJECT1.MODULE1." + id="50" + scope="PRJ" + qualifier="BRC" + kee="struts:struts-tiles" + name="Struts Tiles"/> + <projects uuid="DIR1" + uuid_path="NOT_USED" + root_uuid="MODULE1" + path="src/main/java" + module_uuid_path=".PROJECT1.MODULE1." + id="70" + scope="DIR" + qualifier="DIR" + kee="struts:struts-tiles:/" + name="src/main/java/"/> + <projects uuid="FILE1" + uuid_path="NOT_USED" + root_uuid="MODULE1" + path="src/main/java/Action.java" + module_uuid_path=".PROJECT1." + id="100" + scope="FIL" + qualifier="CLA" + kee="struts:Action" + name="Action"/> <issues id="1" @@ -35,7 +76,7 @@ issue_close_date="[null]" locations="[null]" issue_type="1" - /> + /> <issues id="2" @@ -65,7 +106,7 @@ issue_close_date="[null]" locations="[null]" issue_type="2" - /> + /> <issues id="3" @@ -125,6 +166,6 @@ issue_close_date="[null]" locations="[null]" issue_type="1" - /> + /> </dataset> 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 354308dbda2..865e3dd6cab 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 @@ -1,75 +1,218 @@ <dataset> <!-- java project --> - <projects kee="java_project:org.sonar.bar" long_name="org.sonar.bar" scope="FIL" qualifier="CLA" name="org.sonar.bar" - id="1" root_uuid="ABCD" uuid="ABCD" - description="[null]" enabled="[true]" language="[null]" - created_at="2008-12-19 00:00:00.00"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + description="[null]" + enabled="[true]" + language="[null]" + created_at="2008-12-19 00:00:00.00" + kee="java_project:org.sonar.bar" + long_name="org.sonar.bar" + scope="FIL" + qualifier="CLA" + name="org.sonar.bar" + id="1" + root_uuid="ABCD"/> - <projects kee="java_project:org.sonar.foo" scope="FIL" qualifier="CLA" long_name="org.sonar.foo" name="org.sonar.foo" - id="2" root_uuid="ABCD" uuid="BCDE" - description="[null]" enabled="[true]" language="java" - created_at="2008-12-19 00:00:00.00"/> + <projects uuid="BCDE" + uuid_path="NOT_USED" + description="[null]" + enabled="[true]" + language="java" + created_at="2008-12-19 00:00:00.00" + kee="java_project:org.sonar.foo" + scope="FIL" + qualifier="CLA" + long_name="org.sonar.foo" + name="org.sonar.foo" + id="2" + root_uuid="ABCD"/> - <projects kee="java project:org.sonar.foo.Big" scope="FIL" qualifier="CLA" long_name="org.sonar.foo.Big" + <projects uuid="CDEF" + uuid_path="NOT_USED" + description="[null]" + enabled="[true]" + language="java" + created_at="2008-12-19 00:00:00.00" + kee="java project:org.sonar.foo.Big" + scope="FIL" + qualifier="CLA" + long_name="org.sonar.foo.Big" name="Big" - id="3" root_uuid="ABCD" uuid="CDEF" - description="[null]" enabled="[true]" language="java" - created_at="2008-12-19 00:00:00.00"/> + id="3" + root_uuid="ABCD"/> - <projects kee="java project:org.sonar.foo.Tiny" scope="FIL" qualifier="CLA" long_name="org.sonar.foo.Tiny" name="Tiny" - id="4" root_uuid="ABCD" uuid="DEFG" - description="[null]" enabled="[true]" language="java" - created_at="2008-12-19 00:00:00.00"/> + <projects uuid="DEFG" + uuid_path="NOT_USED" + description="[null]" + enabled="[true]" + language="java" + created_at="2008-12-19 00:00:00.00" + kee="java project:org.sonar.foo.Tiny" + scope="FIL" + qualifier="CLA" + long_name="org.sonar.foo.Tiny" + name="Tiny" + id="4" + root_uuid="ABCD"/> <snapshots id="101" uuid="u101" - component_uuid="ABCD" root_component_uuid="ABCD" root_snapshot_id="[null]" parent_snapshot_id="[null]" - scope="FIL" qualifier="CLA" path="" depth="0" - purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" - period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" - period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" - created_at="1229727600000" build_date="1229727600000" - version="1.0" status="P" islast="[true]"/> + component_uuid="ABCD" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + parent_snapshot_id="[null]" + scope="FIL" + qualifier="CLA" + path="" + depth="0" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + created_at="1229727600000" + build_date="1229727600000" + version="1.0" + status="P" + islast="[true]"/> <snapshots id="102" uuid="u102" - component_uuid="BCDE" root_component_uuid="ABCD" root_snapshot_id="101" parent_snapshot_id="101" - scope="FIL" qualifier="CLA" path="101." depth="1" - purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" - period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" - period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" - created_at="1229727600000" build_date="1229727600000" - version="1.0" status="P" islast="[true]"/> + component_uuid="BCDE" + root_component_uuid="ABCD" + root_snapshot_id="101" + parent_snapshot_id="101" + scope="FIL" + qualifier="CLA" + path="101." + depth="1" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + created_at="1229727600000" + build_date="1229727600000" + version="1.0" + status="P" + islast="[true]"/> <snapshots id="103" uuid="u103" - component_uuid="CDEF" root_component_uuid="ABCD" root_snapshot_id="101" parent_snapshot_id="102" - scope="FIL" qualifier="CLA" path="101.102." depth="2" - purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" - period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" - period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" - created_at="1229727600000" build_date="1229727600000" - version="1.0" status="P" islast="[true]"/> + component_uuid="CDEF" + root_component_uuid="ABCD" + root_snapshot_id="101" + parent_snapshot_id="102" + scope="FIL" + qualifier="CLA" + path="101.102." + depth="2" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + created_at="1229727600000" + build_date="1229727600000" + version="1.0" + status="P" + islast="[true]"/> <snapshots id="104" uuid="u104" - component_uuid="DEFG" root_component_uuid="ABCD" root_snapshot_id="101" parent_snapshot_id="102" - scope="FIL" qualifier="CLA" path="101.102." depth="2" - purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" - period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" - period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" - created_at="1229727600000" build_date="1229727600000" - version="1.0" status="P" islast="[true]"/> + component_uuid="DEFG" + root_component_uuid="ABCD" + root_snapshot_id="101" + parent_snapshot_id="102" + scope="FIL" + qualifier="CLA" + path="101.102." + depth="2" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + created_at="1229727600000" + build_date="1229727600000" + version="1.0" + status="P" + islast="[true]"/> - <resource_index id="1" kee="java class1" position="0" name_size="12" component_uuid="ABCD" root_component_uuid="ABCD" qualifier="CLA"/> - <resource_index id="2" kee="java class2" position="1" name_size="12" component_uuid="BCDE" root_component_uuid="ABCD" qualifier="CLA"/> - <resource_index id="3" kee="java%class3" position="2" name_size="12" component_uuid="CDEF" root_component_uuid="ABCD" qualifier="CLA"/> - <resource_index id="4" kee="java%class4" position="3" name_size="12" component_uuid="DEFG" root_component_uuid="ABCD" qualifier="CLA"/> + <resource_index id="1" + kee="java class1" + position="0" + name_size="12" + component_uuid="ABCD" + root_component_uuid="ABCD" + qualifier="CLA"/> + <resource_index id="2" + kee="java class2" + position="1" + name_size="12" + component_uuid="BCDE" + root_component_uuid="ABCD" + qualifier="CLA"/> + <resource_index id="3" + kee="java%class3" + position="2" + name_size="12" + component_uuid="CDEF" + root_component_uuid="ABCD" + qualifier="CLA"/> + <resource_index id="4" + kee="java%class4" + position="3" + name_size="12" + component_uuid="DEFG" + root_component_uuid="ABCD" + qualifier="CLA"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/measure/MeasureFilterExecutorTest/ignore_person_measures.xml b/server/sonar-server/src/test/resources/org/sonar/server/measure/MeasureFilterExecutorTest/ignore_person_measures.xml index a1159c552a6..87064ba708a 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/measure/MeasureFilterExecutorTest/ignore_person_measures.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/measure/MeasureFilterExecutorTest/ignore_person_measures.xml @@ -1,30 +1,77 @@ <dataset> - <metrics id="1" name="lines" val_type="FLOAT" description="Lines" domain="Size" - short_name="Lines" qualitative="[false]" user_managed="[false]" enabled="[true]" worst_value="[null]" - optimized_best_value="[null]" best_value="[null]" direction="1" hidden="[false]" + <metrics id="1" + name="lines" + val_type="FLOAT" + description="Lines" + domain="Size" + short_name="Lines" + qualitative="[false]" + user_managed="[false]" + enabled="[true]" + worst_value="[null]" + optimized_best_value="[null]" + best_value="[null]" + direction="1" + hidden="[false]" delete_historical_data="[null]"/> - <projects kee="java_project" long_name="Java project" scope="PRJ" qualifier="TRK" name="Java project" - id="1" root_uuid="UUID_JAVA_PROJECT" uuid="UUID_JAVA_PROJECT" - description="[null]" enabled="[true]" language="[null]" /> + <projects uuid="UUID_JAVA_PROJECT" + uuid_path="NOT_USED" + description="[null]" + enabled="[true]" + language="[null]" + kee="java_project" + long_name="Java project" + scope="PRJ" + qualifier="TRK" + name="Java project" + id="1" + root_uuid="UUID_JAVA_PROJECT"/> <snapshots id="101" uuid="u101" - component_uuid="UUID_JAVA_PROJECT" root_component_uuid="UUID_JAVA_PROJECT" - root_snapshot_id="[null]" parent_snapshot_id="[null]" - scope="PRJ" qualifier="TRK" path="" depth="0" - purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" - period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" - period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" - created_at="1229727600000" build_date="1229727600000" - version="1.0" status="P" islast="[true]"/> + component_uuid="UUID_JAVA_PROJECT" + root_component_uuid="UUID_JAVA_PROJECT" + root_snapshot_id="[null]" + parent_snapshot_id="[null]" + scope="PRJ" + qualifier="TRK" + path="" + depth="0" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + created_at="1229727600000" + build_date="1229727600000" + version="1.0" + status="P" + islast="[true]"/> <!-- standard measure --> - <project_measures id="1001" metric_id="1" value="500" snapshot_id="101" person_id="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" - variation_value_4="[null]" variation_value_5="400" + <project_measures id="1001" + metric_id="1" + value="500" + snapshot_id="101" + person_id="[null]" + variation_value_1="[null]" + variation_value_2="[null]" + variation_value_3="[null]" + variation_value_4="[null]" + variation_value_5="400" alert_text="[null]" text_value="[null]" component_uuid="ABCD" @@ -32,18 +79,32 @@ description="[null]"/> <!-- details of the measure by person --> - <project_measures id="1002" metric_id="1" value="300" snapshot_id="101" person_id="30000" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" - variation_value_4="[null]" variation_value_5="400" + <project_measures id="1002" + metric_id="1" + value="300" + snapshot_id="101" + person_id="30000" + variation_value_1="[null]" + variation_value_2="[null]" + variation_value_3="[null]" + variation_value_4="[null]" + variation_value_5="400" alert_text="[null]" text_value="[null]" component_uuid="ABCD" alert_status="[null]" description="[null]"/> - <project_measures id="1003" metric_id="1" value="200" snapshot_id="101" person_id="40000" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" - variation_value_4="[null]" variation_value_5="400" + <project_measures id="1003" + metric_id="1" + value="200" + snapshot_id="101" + person_id="40000" + variation_value_1="[null]" + variation_value_2="[null]" + variation_value_3="[null]" + variation_value_4="[null]" + variation_value_5="400" alert_text="[null]" text_value="[null]" component_uuid="ABCD" diff --git a/server/sonar-server/src/test/resources/org/sonar/server/measure/MeasureFilterExecutorTest/ignore_quality_model_measures.xml b/server/sonar-server/src/test/resources/org/sonar/server/measure/MeasureFilterExecutorTest/ignore_quality_model_measures.xml index 073b7c09d6a..ea433b44e9d 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/measure/MeasureFilterExecutorTest/ignore_quality_model_measures.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/measure/MeasureFilterExecutorTest/ignore_quality_model_measures.xml @@ -1,34 +1,81 @@ <dataset> - <metrics id="1" name="lines" val_type="FLOAT" description="Lines" domain="Size" - short_name="Lines" qualitative="[false]" user_managed="[false]" enabled="[true]" worst_value="[null]" - optimized_best_value="[null]" best_value="[null]" direction="1" hidden="[false]" + <metrics id="1" + name="lines" + val_type="FLOAT" + description="Lines" + domain="Size" + short_name="Lines" + qualitative="[false]" + user_managed="[false]" + enabled="[true]" + worst_value="[null]" + optimized_best_value="[null]" + best_value="[null]" + direction="1" + hidden="[false]" delete_historical_data="[null]"/> - <projects kee="java_project" long_name="Java project" scope="PRJ" qualifier="TRK" name="Java project" - id="1" root_uuid="UUID_JAVA_PROJECT" uuid="UUID_JAVA_PROJECT" - description="[null]" enabled="[true]" language="[null]"/> + <projects uuid="UUID_JAVA_PROJECT" + uuid_path="NOT_USED" + description="[null]" + enabled="[true]" + language="[null]" + kee="java_project" + long_name="Java project" + scope="PRJ" + qualifier="TRK" + name="Java project" + id="1" + root_uuid="UUID_JAVA_PROJECT"/> <snapshots id="101" uuid="u101" - component_uuid="UUID_JAVA_PROJECT" root_component_uuid="UUID_JAVA_PROJECT" - root_snapshot_id="[null]" parent_snapshot_id="[null]" - scope="PRJ" qualifier="TRK" path="" depth="0" - purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" - period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" - period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" - created_at="1229727600000" build_date="1229727600000" - version="1.0" status="P" islast="[true]"/> + component_uuid="UUID_JAVA_PROJECT" + root_component_uuid="UUID_JAVA_PROJECT" + root_snapshot_id="[null]" + parent_snapshot_id="[null]" + scope="PRJ" + qualifier="TRK" + path="" + depth="0" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + created_at="1229727600000" + build_date="1229727600000" + version="1.0" + status="P" + islast="[true]"/> <!-- standard measure --> - <project_measures id="1001" metric_id="1" value="500" snapshot_id="101" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" - variation_value_4="[null]" variation_value_5="400" + <project_measures id="1001" + metric_id="1" + value="500" + snapshot_id="101" + variation_value_1="[null]" + variation_value_2="[null]" + variation_value_3="[null]" + variation_value_4="[null]" + variation_value_5="400" alert_text="[null]" text_value="[null]" component_uuid="ABCD" - alert_status="[null]" description="[null]" + alert_status="[null]" + description="[null]" person_id="[null]"/> <!-- details of the measure by model characteristic --> 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 c9b4a48a8bf..1458d4aa9f9 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 @@ -1,211 +1,514 @@ <dataset> - <metrics id="1" name="lines" val_type="FLOAT" description="Lines" domain="Size" - short_name="Lines" qualitative="[false]" user_managed="[false]" enabled="[true]" worst_value="[null]" - optimized_best_value="[null]" best_value="[null]" direction="1" hidden="[false]" + <metrics id="1" + name="lines" + val_type="FLOAT" + description="Lines" + domain="Size" + short_name="Lines" + qualitative="[false]" + user_managed="[false]" + enabled="[true]" + worst_value="[null]" + optimized_best_value="[null]" + best_value="[null]" + direction="1" + hidden="[false]" delete_historical_data="[null]"/> - <metrics id="2" name="profile" val_type="STRING" description="Profile" domain="Rules" - short_name="Profile" qualitative="[false]" user_managed="[false]" enabled="[true]" + <metrics id="2" + name="profile" + val_type="STRING" + description="Profile" + domain="Rules" + short_name="Profile" + qualitative="[false]" + user_managed="[false]" + enabled="[true]" worst_value="[null]" - optimized_best_value="[null]" best_value="[null]" direction="0" hidden="[false]" + optimized_best_value="[null]" + best_value="[null]" + direction="0" + hidden="[false]" delete_historical_data="[null]"/> - <metrics id="3" name="coverage" val_type="FLOAT" description="Coverage" domain="Test" - short_name="Coverage" qualitative="[true]" user_managed="[false]" enabled="[true]" + <metrics id="3" + name="coverage" + val_type="FLOAT" + description="Coverage" + domain="Test" + short_name="Coverage" + qualitative="[true]" + user_managed="[false]" + enabled="[true]" worst_value="[null]" - optimized_best_value="[true]" best_value="100" direction="1" hidden="[false]" + optimized_best_value="[true]" + best_value="100" + direction="1" + hidden="[false]" delete_historical_data="[null]"/> - <metrics id="4" name="unknown" val_type="FLOAT" description="Coverage" domain="Test" - short_name="Unknown" qualitative="[true]" user_managed="[false]" enabled="[true]" - worst_value="[null]" - optimized_best_value="[true]" best_value="100" direction="1" hidden="[false]" - delete_historical_data="[null]"/> + <metrics id="4" + name="unknown" + val_type="FLOAT" + description="Coverage" + domain="Test" + short_name="Unknown" + qualitative="[true]" + user_managed="[false]" + enabled="[true]" + worst_value="[null]" + optimized_best_value="[true]" + best_value="100" + direction="1" + hidden="[false]" + delete_historical_data="[null]"/> <!-- java project --> - <projects kee="java_project" long_name="Java project" scope="PRJ" qualifier="TRK" name="Java project" - id="1" root_uuid="UUID_JAVA_PROJECT" uuid="UUID_JAVA_PROJECT" project_uuid="UUID_JAVA_PROJECT" - description="[null]" enabled="[true]" language="[null]" - created_at="2008-12-19 00:00:00.00"/> + <projects uuid="UUID_JAVA_PROJECT" + uuid_path="NOT_USED" + project_uuid="UUID_JAVA_PROJECT" + description="[null]" + enabled="[true]" + language="[null]" + created_at="2008-12-19 00:00:00.00" + kee="java_project" + long_name="Java project" + scope="PRJ" + qualifier="TRK" + name="Java project" + id="1" + root_uuid="UUID_JAVA_PROJECT"/> - <projects kee="java_project:org.sonar.foo" scope="DIR" qualifier="PAC" long_name="org.sonar.foo" name="org.sonar.foo" - id="2" root_uuid="UUID_JAVA_PROJECT" uuid="BCDE" project_uuid="UUID_JAVA_PROJECT" - description="[null]" enabled="[true]" language="[null]" - created_at="2008-12-19 00:00:00.00"/> + <projects uuid="BCDE" + uuid_path="NOT_USED" + project_uuid="UUID_JAVA_PROJECT" + description="[null]" + enabled="[true]" + language="[null]" + created_at="2008-12-19 00:00:00.00" + kee="java_project:org.sonar.foo" + scope="DIR" + qualifier="PAC" + long_name="org.sonar.foo" + name="org.sonar.foo" + id="2" + root_uuid="UUID_JAVA_PROJECT"/> - <projects kee="java_project:org.sonar.foo.Big" scope="FIL" qualifier="CLA" long_name="org.sonar.foo.Big" + <projects uuid="CDEF" + uuid_path="NOT_USED" + project_uuid="UUID_JAVA_PROJECT" + description="[null]" + enabled="[true]" + language="java" + created_at="2008-12-19 00:00:00.00" + kee="java_project:org.sonar.foo.Big" + scope="FIL" + qualifier="CLA" + long_name="org.sonar.foo.Big" name="Big" - id="3" root_uuid="UUID_JAVA_PROJECT" uuid="CDEF" project_uuid="UUID_JAVA_PROJECT" - description="[null]" enabled="[true]" language="java" - created_at="2008-12-19 00:00:00.00"/> + id="3" + root_uuid="UUID_JAVA_PROJECT"/> - <projects kee="java_project:org.sonar.foo.Tiny" scope="FIL" qualifier="CLA" long_name="org.sonar.foo.Tiny" name="Tiny" - id="4" root_uuid="UUID_JAVA_PROJECT" uuid="DEFG" project_uuid="UUID_JAVA_PROJECT" - description="[null]" enabled="[true]" language="java" - created_at="2008-12-19 00:00:00.00"/> + <projects uuid="DEFG" + uuid_path="NOT_USED" + project_uuid="UUID_JAVA_PROJECT" + description="[null]" + enabled="[true]" + language="java" + created_at="2008-12-19 00:00:00.00" + kee="java_project:org.sonar.foo.Tiny" + scope="FIL" + qualifier="CLA" + long_name="org.sonar.foo.Tiny" + name="Tiny" + id="4" + root_uuid="UUID_JAVA_PROJECT"/> <snapshots id="101" uuid="u101" - component_uuid="UUID_JAVA_PROJECT" root_component_uuid="UUID_JAVA_PROJECT" - root_snapshot_id="[null]" parent_snapshot_id="[null]" - scope="PRJ" qualifier="TRK" path="" depth="0" - purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" - period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" - period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" - created_at="1229727600000" build_date="1229727600000" - version="1.0" status="P" islast="[true]"/> + component_uuid="UUID_JAVA_PROJECT" + root_component_uuid="UUID_JAVA_PROJECT" + root_snapshot_id="[null]" + parent_snapshot_id="[null]" + scope="PRJ" + qualifier="TRK" + path="" + depth="0" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + created_at="1229727600000" + build_date="1229727600000" + version="1.0" + status="P" + islast="[true]"/> <snapshots id="102" uuid="u102" - component_uuid="BCDE" root_component_uuid="UUID_JAVA_PROJECT" root_snapshot_id="101" + component_uuid="BCDE" + root_component_uuid="UUID_JAVA_PROJECT" + root_snapshot_id="101" parent_snapshot_id="101" - scope="DIR" qualifier="PAC" path="101." depth="1" - purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" - period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" - period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" - created_at="1229727600000" build_date="1229727600000" - version="1.0" status="P" islast="[true]"/> + scope="DIR" + qualifier="PAC" + path="101." + depth="1" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + created_at="1229727600000" + build_date="1229727600000" + version="1.0" + status="P" + islast="[true]"/> <snapshots id="103" uuid="u103" - component_uuid="CDEF" root_component_uuid="UUID_JAVA_PROJECT" root_snapshot_id="101" + component_uuid="CDEF" + root_component_uuid="UUID_JAVA_PROJECT" + root_snapshot_id="101" parent_snapshot_id="102" - scope="FIL" qualifier="CLA" path="101.102." depth="2" - purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" - period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" - period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" - created_at="1229727600000" build_date="1229727600000" - version="1.0" status="P" islast="[true]"/> + scope="FIL" + qualifier="CLA" + path="101.102." + depth="2" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + created_at="1229727600000" + build_date="1229727600000" + version="1.0" + status="P" + islast="[true]"/> <snapshots id="104" uuid="u104" - component_uuid="DEFG" root_component_uuid="UUID_JAVA_PROJECT" root_snapshot_id="101" + component_uuid="DEFG" + root_component_uuid="UUID_JAVA_PROJECT" + root_snapshot_id="101" parent_snapshot_id="102" - scope="FIL" qualifier="CLA" path="101.102." depth="2" - purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" - period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" - period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" - created_at="1229727600000" build_date="1229727600000" - version="1.0" status="P" islast="[true]"/> + scope="FIL" + qualifier="CLA" + path="101.102." + depth="2" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + created_at="1229727600000" + build_date="1229727600000" + version="1.0" + status="P" + islast="[true]"/> <!-- lines, variation during period 5 --> - <project_measures id="1001" metric_id="1" value="510" snapshot_id="101" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" - variation_value_4="[null]" variation_value_5="400" + <project_measures id="1001" + metric_id="1" + value="510" + snapshot_id="101" + variation_value_1="[null]" + variation_value_2="[null]" + variation_value_3="[null]" + variation_value_4="[null]" + variation_value_5="400" alert_text="[null]" - text_value="[null]" component_uuid="ABCD" - alert_status="[null]" description="[null]"/> + text_value="[null]" + component_uuid="ABCD" + alert_status="[null]" + description="[null]"/> - <project_measures id="1002" metric_id="1" value="510" snapshot_id="102" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" - variation_value_4="[null]" variation_value_5="[null]" + <project_measures id="1002" + metric_id="1" + value="510" + snapshot_id="102" + variation_value_1="[null]" + variation_value_2="[null]" + variation_value_3="[null]" + variation_value_4="[null]" + variation_value_5="[null]" alert_text="[null]" text_value="[null]" - alert_status="[null]" description="[null]" - component_uuid="BCDE" /> + alert_status="[null]" + description="[null]" + component_uuid="BCDE"/> - <project_measures id="1003" metric_id="1" value="500" snapshot_id="103" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" - variation_value_4="[null]" variation_value_5="[null]" + <project_measures id="1003" + metric_id="1" + value="500" + snapshot_id="103" + variation_value_1="[null]" + variation_value_2="[null]" + variation_value_3="[null]" + variation_value_4="[null]" + variation_value_5="[null]" alert_text="[null]" text_value="[null]" - alert_status="[null]" description="[null]" - component_uuid="CDEF" /> + alert_status="[null]" + description="[null]" + component_uuid="CDEF"/> - <project_measures id="1004" metric_id="1" value="10" snapshot_id="104" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" - variation_value_4="[null]" variation_value_5="[null]" + <project_measures id="1004" + metric_id="1" + value="10" + snapshot_id="104" + variation_value_1="[null]" + variation_value_2="[null]" + variation_value_3="[null]" + variation_value_4="[null]" + variation_value_5="[null]" alert_text="[null]" text_value="[null]" - alert_status="[null]" description="[null]" + alert_status="[null]" + description="[null]" component_uuid="DEFG"/> <!-- profile of java project --> - <project_measures id="1005" metric_id="2" value="[null]" snapshot_id="101" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" - variation_value_4="[null]" variation_value_5="[null]" + <project_measures id="1005" + metric_id="2" + value="[null]" + snapshot_id="101" + variation_value_1="[null]" + variation_value_2="[null]" + variation_value_3="[null]" + variation_value_4="[null]" + variation_value_5="[null]" alert_text="[null]" text_value="Sonar way" component_uuid="ABCD" - alert_status="[null]" description="[null]"/> + alert_status="[null]" + description="[null]"/> <!-- coverage of java project --> - <project_measures id="1006" metric_id="3" value="12.3" snapshot_id="101" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" - variation_value_4="[null]" variation_value_5="[null]" + <project_measures id="1006" + metric_id="3" + value="12.3" + snapshot_id="101" + variation_value_1="[null]" + variation_value_2="[null]" + variation_value_3="[null]" + variation_value_4="[null]" + variation_value_5="[null]" alert_text="[null]" text_value="Sonar way" component_uuid="ABCD" - alert_status="[null]" description="[null]"/> + alert_status="[null]" + description="[null]"/> <!-- php project --> - <projects kee="php_project" long_name="PHP project" scope="PRJ" qualifier="TRK" name="PHP project" - id="10" root_uuid="UUID_JAVA_PROJECT" uuid="UUID_PHP_PROJECT" project_uuid="UUID_PHP_PROJECT" - description="[null]" enabled="[true]" language="[null]" - created_at="2012-12-12 04:06:00.00"/> + <projects uuid="UUID_PHP_PROJECT" + uuid_path="NOT_USED" + project_uuid="UUID_PHP_PROJECT" + description="[null]" + enabled="[true]" + language="[null]" + created_at="2012-12-12 04:06:00.00" + kee="php_project" + long_name="PHP project" + scope="PRJ" + qualifier="TRK" + name="PHP project" + id="10" + root_uuid="UUID_JAVA_PROJECT"/> <snapshots id="110" uuid="u110" - component_uuid="UUID_PHP_PROJECT" root_component_uuid="UUID_PHP_PROJECT" root_snapshot_id="[null]" + component_uuid="UUID_PHP_PROJECT" + root_component_uuid="UUID_PHP_PROJECT" + root_snapshot_id="[null]" parent_snapshot_id="[null]" - scope="PRJ" qualifier="TRK" path="" depth="0" - purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" - period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" - period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" - created_at="1355367960000" build_date="1355367960000" - version="3.0" status="P" islast="[true]"/> + scope="PRJ" + qualifier="TRK" + path="" + depth="0" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + created_at="1355367960000" + build_date="1355367960000" + version="3.0" + status="P" + islast="[true]"/> <!-- lines, many new lines during period 5 --> - <project_measures id="1010" metric_id="1" value="5000" snapshot_id="110" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" - variation_value_4="[null]" variation_value_5="4900" + <project_measures id="1010" + metric_id="1" + value="5000" + snapshot_id="110" + variation_value_1="[null]" + variation_value_2="[null]" + variation_value_3="[null]" + variation_value_4="[null]" + variation_value_5="4900" alert_text="[null]" text_value="[null]" component_uuid="EFGH" - alert_status="[null]" description="[null]"/> + alert_status="[null]" + description="[null]"/> - <project_measures id="1011" metric_id="2" value="[null]" snapshot_id="110" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" - variation_value_4="[null]" variation_value_5="[null]" + <project_measures id="1011" + metric_id="2" + value="[null]" + snapshot_id="110" + variation_value_1="[null]" + variation_value_2="[null]" + variation_value_3="[null]" + variation_value_4="[null]" + variation_value_5="[null]" alert_text="[null]" text_value="php way" component_uuid="EFGH" - alert_status="[null]" description="[null]"/> + alert_status="[null]" + description="[null]"/> - <resource_index id="1" kee="java project" position="0" name_size="12" component_uuid="UUID_JAVA_PROJECT" - root_component_uuid="UUID_JAVA_PROJECT" qualifier="TRK"/> - <resource_index id="2" kee="java projec" position="1" name_size="12" component_uuid="UUID_JAVA_PROJECT" - root_component_uuid="UUID_JAVA_PROJECT" qualifier="TRK"/> - <resource_index id="3" kee="java proje" position="2" name_size="12" component_uuid="UUID_JAVA_PROJECT" - root_component_uuid="UUID_JAVA_PROJECT" qualifier="TRK"/> - <resource_index id="4" kee="java proj" position="3" name_size="12" component_uuid="UUID_JAVA_PROJECT" - root_component_uuid="UUID_JAVA_PROJECT" qualifier="TRK"/> + <resource_index id="1" + kee="java project" + position="0" + name_size="12" + component_uuid="UUID_JAVA_PROJECT" + root_component_uuid="UUID_JAVA_PROJECT" + qualifier="TRK"/> + <resource_index id="2" + kee="java projec" + position="1" + name_size="12" + component_uuid="UUID_JAVA_PROJECT" + root_component_uuid="UUID_JAVA_PROJECT" + qualifier="TRK"/> + <resource_index id="3" + kee="java proje" + position="2" + name_size="12" + component_uuid="UUID_JAVA_PROJECT" + root_component_uuid="UUID_JAVA_PROJECT" + qualifier="TRK"/> + <resource_index id="4" + kee="java proj" + position="3" + name_size="12" + component_uuid="UUID_JAVA_PROJECT" + root_component_uuid="UUID_JAVA_PROJECT" + qualifier="TRK"/> <!-- etc --> - <resource_index id="5" kee="php project" position="0" name_size="11" component_uuid="UUID_PHP_PROJECT" - root_component_uuid="UUID_PHP_PROJECT" qualifier="TRK"/> - <resource_index id="6" kee="php projec" position="1" name_size="11" component_uuid="UUID_PHP_PROJECT" - root_component_uuid="UUID_PHP_PROJECT" qualifier="TRK"/> - <resource_index id="7" kee="php proje" position="2" name_size="11" component_uuid="UUID_PHP_PROJECT" - root_component_uuid="UUID_PHP_PROJECT" qualifier="TRK"/> - <resource_index id="8" kee="php proj" position="3" name_size="11" component_uuid="UUID_PHP_PROJECT" - root_component_uuid="UUID_PHP_PROJECT" qualifier="TRK"/> + <resource_index id="5" + kee="php project" + position="0" + name_size="11" + component_uuid="UUID_PHP_PROJECT" + root_component_uuid="UUID_PHP_PROJECT" + qualifier="TRK"/> + <resource_index id="6" + kee="php projec" + position="1" + name_size="11" + component_uuid="UUID_PHP_PROJECT" + root_component_uuid="UUID_PHP_PROJECT" + qualifier="TRK"/> + <resource_index id="7" + kee="php proje" + position="2" + name_size="11" + component_uuid="UUID_PHP_PROJECT" + root_component_uuid="UUID_PHP_PROJECT" + qualifier="TRK"/> + <resource_index id="8" + kee="php proj" + position="3" + name_size="11" + component_uuid="UUID_PHP_PROJECT" + root_component_uuid="UUID_PHP_PROJECT" + qualifier="TRK"/> <!-- etc --> <!-- two favourites : Big.java and PHP project --> - <properties id="1" prop_key="favourite" resource_id="3" text_value="[null]" user_id="50"/> - <properties id="2" prop_key="favourite" resource_id="10" text_value="[null]" user_id="50"/> + <properties id="1" + prop_key="favourite" + resource_id="3" + text_value="[null]" + user_id="50"/> + <properties id="2" + prop_key="favourite" + resource_id="10" + text_value="[null]" + user_id="50"/> <!-- another properties --> - <properties id="3" prop_key="favourite" resource_id="1" text_value="[null]" user_id="1234"/> - <properties id="4" prop_key="sonar.profile" resource_id="1" text_value="Sonar way" user_id="[null]"/> + <properties id="3" + prop_key="favourite" + resource_id="1" + text_value="[null]" + user_id="1234"/> + <properties id="4" + prop_key="sonar.profile" + resource_id="1" + text_value="Sonar way" + user_id="[null]"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/measure/MeasureFilterExecutorTest/sort_by_alert.xml b/server/sonar-server/src/test/resources/org/sonar/server/measure/MeasureFilterExecutorTest/sort_by_alert.xml index 95b9e0a203a..ce6f4f3c9cb 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/measure/MeasureFilterExecutorTest/sort_by_alert.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/measure/MeasureFilterExecutorTest/sort_by_alert.xml @@ -1,92 +1,212 @@ <dataset> - <metrics id="5" name="alert_status" val_type="LEVEL" description="Alert" domain="General" - short_name="Alert" qualitative="[true]" user_managed="[false]" enabled="[true]" + <metrics id="5" + name="alert_status" + val_type="LEVEL" + description="Alert" + domain="General" + short_name="Alert" + qualitative="[true]" + user_managed="[false]" + enabled="[true]" worst_value="[null]" - optimized_best_value="[true]" best_value="[null]" direction="1" hidden="[false]" + optimized_best_value="[true]" + best_value="[null]" + direction="1" + hidden="[false]" delete_historical_data="[null]"/> <!-- java project --> - <projects kee="java_project" long_name="Java project" scope="PRJ" qualifier="TRK" name="Java project" - id="1" root_uuid="UUID_JAVA_PROJECT" uuid="UUID_JAVA_PROJECT" - description="[null]" enabled="[true]" language="[null]" - created_at="2008-12-19 00:00:00.00"/> + <projects uuid="UUID_JAVA_PROJECT" + uuid_path="NOT_USED" + description="[null]" + enabled="[true]" + language="[null]" + created_at="2008-12-19 00:00:00.00" + kee="java_project" + long_name="Java project" + scope="PRJ" + qualifier="TRK" + name="Java project" + id="1" + root_uuid="UUID_JAVA_PROJECT"/> <snapshots id="101" uuid="u101" - component_uuid="UUID_JAVA_PROJECT" root_component_uuid="UUID_JAVA_PROJECT" - root_snapshot_id="[null]" parent_snapshot_id="[null]" - scope="PRJ" qualifier="TRK" path="" depth="0" - purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" - period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" - period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" - created_at="1229727600000" build_date="1229727600000" - version="1.0" status="P" islast="[true]"/> + component_uuid="UUID_JAVA_PROJECT" + root_component_uuid="UUID_JAVA_PROJECT" + root_snapshot_id="[null]" + parent_snapshot_id="[null]" + scope="PRJ" + qualifier="TRK" + path="" + depth="0" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + created_at="1229727600000" + build_date="1229727600000" + version="1.0" + status="P" + islast="[true]"/> <!-- alert --> - <project_measures id="1001" metric_id="5" value="510" snapshot_id="101" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" - variation_value_4="[null]" variation_value_5="400" + <project_measures id="1001" + metric_id="5" + value="510" + snapshot_id="101" + variation_value_1="[null]" + variation_value_2="[null]" + variation_value_3="[null]" + variation_value_4="[null]" + variation_value_5="400" alert_text="[null]" text_value="WARN" component_uuid="ABCD" - alert_status="[null]" description="[null]"/> + alert_status="[null]" + description="[null]"/> <!-- php project --> - <projects kee="php_project" long_name="PHP project" scope="PRJ" qualifier="TRK" name="PHP project" - id="10" root_uuid="UUID_PHP_PROJECT" uuid="UUID_PHP_PROJECT" - description="[null]" enabled="[true]" language="[null]" - created_at="2012-12-12 04:06:00.00"/> + <projects uuid="UUID_PHP_PROJECT" + uuid_path="NOT_USED" + description="[null]" + enabled="[true]" + language="[null]" + created_at="2012-12-12 04:06:00.00" + kee="php_project" + long_name="PHP project" + scope="PRJ" + qualifier="TRK" + name="PHP project" + id="10" + root_uuid="UUID_PHP_PROJECT"/> <snapshots id="110" uuid="u110" - component_uuid="UUID_PHP_PROJECT" root_component_uuid="UUID_PHP_PROJECT" root_snapshot_id="[null]" + component_uuid="UUID_PHP_PROJECT" + root_component_uuid="UUID_PHP_PROJECT" + root_snapshot_id="[null]" parent_snapshot_id="[null]" - scope="PRJ" qualifier="TRK" path="" depth="0" - purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" - period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" - period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" - created_at="1355367960000" build_date="1355367960000" - version="3.0" status="P" islast="[true]"/> + scope="PRJ" + qualifier="TRK" + path="" + depth="0" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + created_at="1355367960000" + build_date="1355367960000" + version="3.0" + status="P" + islast="[true]"/> <!-- alert --> - <project_measures id="1010" metric_id="5" value="5000" snapshot_id="110" - url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" - variation_value_4="[null]" variation_value_5="[null]" + <project_measures id="1010" + metric_id="5" + value="5000" + snapshot_id="110" + url="[null]" + variation_value_1="[null]" + variation_value_2="[null]" + variation_value_3="[null]" + variation_value_4="[null]" + variation_value_5="[null]" alert_text="[null]" text_value="OK" component_uuid="BCDE" - alert_status="[null]" description="[null]"/> + alert_status="[null]" + description="[null]"/> <!-- js project --> - <projects kee="js_project" long_name="JS project" scope="PRJ" qualifier="TRK" name="JS project" - id="20" root_uuid="CDEF" uuid="CDEF" - description="[null]" enabled="[true]" language="[null]" - created_at="2012-12-12 04:06:00.00"/> + <projects uuid="CDEF" + uuid_path="NOT_USED" + description="[null]" + enabled="[true]" + language="[null]" + created_at="2012-12-12 04:06:00.00" + kee="js_project" + long_name="JS project" + scope="PRJ" + qualifier="TRK" + name="JS project" + id="20" + root_uuid="CDEF"/> <snapshots id="120" uuid="u120" - component_uuid="CDEF" root_component_uuid="CDEF" root_snapshot_id="[null]" parent_snapshot_id="[null]" - scope="PRJ" qualifier="TRK" path="" depth="0" - purge_status="[null]" period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" period3_mode="[null]" - period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" - period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" - created_at="1355367960000" build_date="1355367960000" - version="3.0" status="P" islast="[true]"/> + component_uuid="CDEF" + root_component_uuid="CDEF" + root_snapshot_id="[null]" + parent_snapshot_id="[null]" + scope="PRJ" + qualifier="TRK" + path="" + depth="0" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + created_at="1355367960000" + build_date="1355367960000" + version="3.0" + status="P" + islast="[true]"/> <!-- alert --> - <project_measures id="1020" metric_id="5" value="5000" snapshot_id="120" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" - variation_value_4="[null]" variation_value_5="[null]" + <project_measures id="1020" + metric_id="5" + value="5000" + snapshot_id="120" + variation_value_1="[null]" + variation_value_2="[null]" + variation_value_3="[null]" + variation_value_4="[null]" + variation_value_5="[null]" alert_text="[null]" text_value="ERROR" component_uuid="CDEF" - alert_status="[null]" description="[null]"/> + alert_status="[null]" + description="[null]"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/platform/BackendCleanupMediumTest/shared.xml b/server/sonar-server/src/test/resources/org/sonar/server/platform/BackendCleanupMediumTest/shared.xml index 1d538bfc0b9..ede35ea2ad6 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/platform/BackendCleanupMediumTest/shared.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/platform/BackendCleanupMediumTest/shared.xml @@ -1,25 +1,67 @@ <dataset> - <projects id="100" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - uuid="JKLM" root_uuid="JKLM" project_uuid="JKLM" module_uuid="[null]" module_uuid_path="." - enabled="[true]" path="[null]"/> + <projects uuid="JKLM" + uuid_path="NOT_USED" + root_uuid="JKLM" + project_uuid="JKLM" + module_uuid="[null]" + module_uuid_path="." + enabled="[true]" + path="[null]" + id="100" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts"/> <snapshots id="100" uuid="u100" - component_uuid="JKLM" parent_snapshot_id="[null]" root_component_uuid="JKLM" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" version="[null]" path=""/> + component_uuid="JKLM" + parent_snapshot_id="[null]" + root_component_uuid="JKLM" + root_snapshot_id="[null]" + status="P" + islast="[true]" + purge_status="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + version="[null]" + path=""/> - <rules tags="[null]" system_tags="[null]" id="1" plugin_rule_key="NewRuleKey" plugin_name="plugin" name="new name" description="new description" status="DEPRECATED" - plugin_config_key="NewConfigKey" priority="0" is_template="[true]" language="dart" template_id="3" - note_data="[null]" note_user_login="[null]" note_created_at="[null]" note_updated_at="[null]" - remediation_function="LINEAR" def_remediation_function="LINEAR_OFFSET" - remediation_gap_mult="1h" def_remediation_gap_mult="5d" - remediation_base_effort="5min" def_remediation_base_effort="10h" - gap_description="squid.S115.effortToFix" description_format="MARKDOWN" - created_at="150000" updated_at="150000" + <rules tags="[null]" + system_tags="[null]" + id="1" + plugin_rule_key="NewRuleKey" + plugin_name="plugin" + name="new name" + description="new description" + status="DEPRECATED" + plugin_config_key="NewConfigKey" + priority="0" + is_template="[true]" + language="dart" + template_id="3" + note_data="[null]" + note_user_login="[null]" + note_created_at="[null]" + note_updated_at="[null]" + remediation_function="LINEAR" + def_remediation_function="LINEAR_OFFSET" + remediation_gap_mult="1h" + def_remediation_gap_mult="5d" + remediation_base_effort="5min" + def_remediation_base_effort="10h" + gap_description="squid.S115.effortToFix" + description_format="MARKDOWN" + created_at="150000" + updated_at="150000" /> - <properties id="1" prop_key="sonar.profile.java" text_value="Sonar Way" resource_id="1" user_id="[null]"/> + <properties id="1" + prop_key="sonar.profile.java" + text_value="Sonar Way" + resource_id="1" + user_id="[null]"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/source/ws/HashActionTest/no_source.xml b/server/sonar-server/src/test/resources/org/sonar/server/source/ws/HashActionTest/no_source.xml index a706ac79ac0..ada95a9064a 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/source/ws/HashActionTest/no_source.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/source/ws/HashActionTest/no_source.xml @@ -1,7 +1,26 @@ <dataset> - <projects id="100" kee="struts" root_uuid="ABCD" qualifier="TRK" scope="PRJ" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path="." path="[null]"/> - <projects id="101" kee="Action.java" root_uuid="ABCD" qualifier="CLA" scope="PRJ" uuid="CDEF" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path=".ABCD." - path="src/main/java/Action.java"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path="." + path="[null]" + id="100" + kee="struts" + root_uuid="ABCD" + qualifier="TRK" + scope="PRJ"/> + <projects uuid="CDEF" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="ABCD" + module_uuid_path=".ABCD." + path="src/main/java/Action.java" + id="101" + kee="Action.java" + root_uuid="ABCD" + qualifier="CLA" + scope="PRJ"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/source/ws/HashActionTest/shared.xml b/server/sonar-server/src/test/resources/org/sonar/server/source/ws/HashActionTest/shared.xml index 9e072388a9d..ade48005e5d 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/source/ws/HashActionTest/shared.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/source/ws/HashActionTest/shared.xml @@ -1,13 +1,37 @@ <dataset> - <projects id="100" kee="struts" root_uuid="ABCD" qualifier="TRK" scope="PRJ" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path="." path="[null]"/> - <projects id="101" kee="Action.java" root_uuid="ABCD" qualifier="CLA" scope="PRJ" uuid="CDEF" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path=".ABCD." - path="src/main/java/Action.java"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path="." + path="[null]" + id="100" + kee="struts" + root_uuid="ABCD" + qualifier="TRK" + scope="PRJ"/> + <projects uuid="CDEF" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="ABCD" + module_uuid_path=".ABCD." + path="src/main/java/Action.java" + id="101" + kee="Action.java" + root_uuid="ABCD" + qualifier="CLA" + scope="PRJ"/> - <file_sources id="101" project_uuid="ABCD" file_uuid="CDEF" - binary_data="" data_hash="hash" + <file_sources id="101" + project_uuid="ABCD" + file_uuid="CDEF" + binary_data="" + data_hash="hash" line_hashes="987654" src_hash="12345" - created_at="1414597442000" updated_at="1414683842000" data_type="SOURCE" /> + created_at="1414597442000" + updated_at="1414683842000" + data_type="SOURCE"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/source/ws/HashActionTest/show_hashes_on_test_file.xml b/server/sonar-server/src/test/resources/org/sonar/server/source/ws/HashActionTest/show_hashes_on_test_file.xml index 5e1cedca4ff..b24a2e78ba0 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/source/ws/HashActionTest/show_hashes_on_test_file.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/source/ws/HashActionTest/show_hashes_on_test_file.xml @@ -1,20 +1,49 @@ <dataset> - <projects id="100" kee="struts" root_uuid="ABCD" qualifier="TRK" scope="PRJ" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path="." path="[null]"/> - <projects id="101" kee="ActionTest.java" root_uuid="ABCD" qualifier="CLA" scope="PRJ" uuid="CDEF" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path=".ABCD." - path="src/test/java/ActionTest.java"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path="." + path="[null]" + id="100" + kee="struts" + root_uuid="ABCD" + qualifier="TRK" + scope="PRJ"/> + <projects uuid="CDEF" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="ABCD" + module_uuid_path=".ABCD." + path="src/test/java/ActionTest.java" + id="101" + kee="ActionTest.java" + root_uuid="ABCD" + qualifier="CLA" + scope="PRJ"/> - <file_sources id="100" project_uuid="ABCD" file_uuid="CDEF" - binary_data="" data_hash="[null]" + <file_sources id="100" + project_uuid="ABCD" + file_uuid="CDEF" + binary_data="" + data_hash="[null]" line_hashes="[null]" src_hash="[null]" - created_at="1414597442000" updated_at="1414683842000" data_type="TEST" /> + created_at="1414597442000" + updated_at="1414683842000" + data_type="TEST"/> - <file_sources id="101" project_uuid="ABCD" file_uuid="CDEF" - binary_data="" data_hash="hash" + <file_sources id="101" + project_uuid="ABCD" + file_uuid="CDEF" + binary_data="" + data_hash="hash" line_hashes="987654" src_hash="12345" - created_at="1414597442000" updated_at="1414683842000" data_type="SOURCE" /> + created_at="1414597442000" + updated_at="1414683842000" + data_type="SOURCE"/> </dataset> diff --git a/server/sonar-server/src/test/resources/org/sonar/server/view/index/ViewIndexerTest/index.xml b/server/sonar-server/src/test/resources/org/sonar/server/view/index/ViewIndexerTest/index.xml index 0683f90d6b6..5b88184d1d7 100644 --- a/server/sonar-server/src/test/resources/org/sonar/server/view/index/ViewIndexerTest/index.xml +++ b/server/sonar-server/src/test/resources/org/sonar/server/view/index/ViewIndexerTest/index.xml @@ -1,91 +1,287 @@ <dataset> <!-- Simple View --> - <projects id="10" uuid="ABCD" root_uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path="." copy_component_uuid="[null]" enabled="[true]" - kee="MASTER_PROJECT" scope="PRJ" qualifier="VW" name="All projects" path="[null]"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + root_uuid="ABCD" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path="." + copy_component_uuid="[null]" + enabled="[true]" + kee="MASTER_PROJECT" + scope="PRJ" + qualifier="VW" + name="All projects" + path="[null]" + id="10"/> <snapshots id="10" uuid="u10" - component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="[null]" - depth="[null]" scope="PRJ" qualifier="VW" created_at="1228222680000" build_date="1228222680000" - version="[null]" path=""/> + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + status="P" + islast="[true]" + purge_status="[null]" + depth="[null]" + scope="PRJ" + qualifier="VW" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path=""/> - <projects id="110" uuid="BCDE" root_uuid="ABCD" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path=".ABCD." copy_component_uuid="JKLM" enabled="[true]" - kee="MASTER_PROJECTorg.struts:struts" scope="FIL" qualifier="TRK" name="Struts" path="[null]"/> + <projects uuid="BCDE" + uuid_path="NOT_USED" + root_uuid="ABCD" + project_uuid="ABCD" + module_uuid="ABCD" + module_uuid_path=".ABCD." + copy_component_uuid="JKLM" + enabled="[true]" + kee="MASTER_PROJECTorg.struts:struts" + scope="FIL" + qualifier="TRK" + name="Struts" + path="[null]" + id="110"/> <snapshots id="110" uuid="u110" - component_uuid="BCDE" parent_snapshot_id="[null]" root_component_uuid="BCDE" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path=""/> + component_uuid="BCDE" + parent_snapshot_id="[null]" + root_component_uuid="BCDE" + root_snapshot_id="[null]" + status="P" + islast="[true]" + purge_status="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path=""/> <!-- View with sub view --> - <projects id="11" uuid="EFGH" root_uuid="EFGH" project_uuid="EFGH" module_uuid="[null]" module_uuid_path="." copy_component_uuid="[null]" enabled="[true]" - kee="LANGUAGE_VIEW" scope="PRJ" qualifier="VW" name="By Language" path="[null]"/> + <projects uuid="EFGH" + uuid_path="NOT_USED" + root_uuid="EFGH" + project_uuid="EFGH" + module_uuid="[null]" + module_uuid_path="." + copy_component_uuid="[null]" + enabled="[true]" + kee="LANGUAGE_VIEW" + scope="PRJ" + qualifier="VW" + name="By Language" + path="[null]" + id="11"/> <snapshots id="11" uuid="u11" - component_uuid="EFGH" parent_snapshot_id="[null]" root_component_uuid="EFGH" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="[null]" - depth="[null]" scope="PRJ" qualifier="VW" created_at="1228222680000" build_date="1228222680000" - version="[null]" path=""/> - <projects id="112" uuid="GHIJ" root_uuid="EFGH" project_uuid="EFGH" module_uuid="EFGH" module_uuid_path=".EFGH." copy_component_uuid="KLMN" enabled="[true]" - kee="VIEW2org.elasticsearch:elasticsearch" scope="FIL" qualifier="TRK" name="SSLR" path="[null]"/> + component_uuid="EFGH" + parent_snapshot_id="[null]" + root_component_uuid="EFGH" + root_snapshot_id="[null]" + status="P" + islast="[true]" + purge_status="[null]" + depth="[null]" + scope="PRJ" + qualifier="VW" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path=""/> + <projects uuid="GHIJ" + uuid_path="NOT_USED" + root_uuid="EFGH" + project_uuid="EFGH" + module_uuid="EFGH" + module_uuid_path=".EFGH." + copy_component_uuid="KLMN" + enabled="[true]" + kee="VIEW2org.elasticsearch:elasticsearch" + scope="FIL" + qualifier="TRK" + name="SSLR" + path="[null]" + id="112"/> <snapshots id="112" uuid="u112" - component_uuid="GHIJ" parent_snapshot_id="[null]" root_component_uuid="GHIJ" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path=""/> + component_uuid="GHIJ" + parent_snapshot_id="[null]" + root_component_uuid="GHIJ" + root_snapshot_id="[null]" + status="P" + islast="[true]" + purge_status="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path=""/> <!-- Sub view --> - <projects id="13" uuid="FGHI" root_uuid="EFGH" project_uuid="EFGH" module_uuid="EFGH" module_uuid_path=".EFGH." copy_component_uuid="[null]" enabled="[true]" - kee="JAVA_PROJECTS" scope="PRJ" qualifier="SVW" name="Java projects" path="[null]"/> + <projects uuid="FGHI" + uuid_path="NOT_USED" + root_uuid="EFGH" + project_uuid="EFGH" + module_uuid="EFGH" + module_uuid_path=".EFGH." + copy_component_uuid="[null]" + enabled="[true]" + kee="JAVA_PROJECTS" + scope="PRJ" + qualifier="SVW" + name="Java projects" + path="[null]" + id="13"/> <snapshots id="13" uuid="u13" - component_uuid="FGHI" parent_snapshot_id="[null]" root_component_uuid="FGHI" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="[null]" - depth="[null]" scope="PRJ" qualifier="SVW" created_at="1228222680000" build_date="1228222680000" - version="[null]" path=""/> + component_uuid="FGHI" + parent_snapshot_id="[null]" + root_component_uuid="FGHI" + root_snapshot_id="[null]" + status="P" + islast="[true]" + purge_status="[null]" + depth="[null]" + scope="PRJ" + qualifier="SVW" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path=""/> - <projects id="113" uuid="HIJK" root_uuid="EFGH" project_uuid="EFGH" module_uuid="FGHI" module_uuid_path=".EFGH.FGHI." copy_component_uuid="JKLM" enabled="[true]" - kee="VIEW2org.struts:struts" scope="FIL" qualifier="TRK" name="Struts" path="[null]"/> + <projects uuid="HIJK" + uuid_path="NOT_USED" + root_uuid="EFGH" + project_uuid="EFGH" + module_uuid="FGHI" + module_uuid_path=".EFGH.FGHI." + copy_component_uuid="JKLM" + enabled="[true]" + kee="VIEW2org.struts:struts" + scope="FIL" + qualifier="TRK" + name="Struts" + path="[null]" + id="113"/> <snapshots id="113" uuid="u113" - component_uuid="HIJK" parent_snapshot_id="[null]" root_component_uuid="HIJK" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path=""/> + component_uuid="HIJK" + parent_snapshot_id="[null]" + root_component_uuid="HIJK" + root_snapshot_id="[null]" + status="P" + islast="[true]" + purge_status="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path=""/> <!-- View without project --> - <projects id="14" uuid="IJKL" root_uuid="IJKL" project_uuid="IJKL" module_uuid="[null]" module_uuid_path="." copy_component_uuid="[null]" enabled="[true]" - kee="OTHER" scope="PRJ" qualifier="VW" name="Other projects" path="[null]"/> + <projects uuid="IJKL" + uuid_path="NOT_USED" + root_uuid="IJKL" + project_uuid="IJKL" + module_uuid="[null]" + module_uuid_path="." + copy_component_uuid="[null]" + enabled="[true]" + kee="OTHER" + scope="PRJ" + qualifier="VW" + name="Other projects" + path="[null]" + id="14"/> <snapshots id="14" uuid="u14" - component_uuid="IJKL" parent_snapshot_id="[null]" root_component_uuid="IJKL" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="[null]" - depth="[null]" scope="PRJ" qualifier="VW" created_at="1228222680000" build_date="1228222680000" - version="[null]" path=""/> + component_uuid="IJKL" + parent_snapshot_id="[null]" + root_component_uuid="IJKL" + root_snapshot_id="[null]" + status="P" + islast="[true]" + purge_status="[null]" + depth="[null]" + scope="PRJ" + qualifier="VW" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path=""/> <!-- Real projects --> - <projects id="100" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - uuid="JKLM" root_uuid="JKLM" project_uuid="JKLM" module_uuid="[null]" module_uuid_path="." - enabled="[true]" copy_component_uuid="[null]" path="[null]"/> + <projects uuid="JKLM" + uuid_path="NOT_USED" + root_uuid="JKLM" + project_uuid="JKLM" + module_uuid="[null]" + module_uuid_path="." + enabled="[true]" + copy_component_uuid="[null]" + path="[null]" + id="100" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts"/> <snapshots id="100" uuid="u100" - component_uuid="JKLM" parent_snapshot_id="[null]" root_component_uuid="JKLM" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path=""/> + component_uuid="JKLM" + parent_snapshot_id="[null]" + root_component_uuid="JKLM" + root_snapshot_id="[null]" + status="P" + islast="[true]" + purge_status="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path=""/> - <projects id="101" scope="PRJ" qualifier="TRK" kee="org.elasticsearch:elasticsearch" name="Elasticsearch" - uuid="KLMN" root_uuid="KLMN" project_uuid="KLMN" module_uuid="[null]" module_uuid_path="." - enabled="[true]" copy_component_uuid="[null]" path="[null]"/> + <projects uuid="KLMN" + uuid_path="NOT_USED" + root_uuid="KLMN" + project_uuid="KLMN" + module_uuid="[null]" + module_uuid_path="." + enabled="[true]" + copy_component_uuid="[null]" + path="[null]" + id="101" + scope="PRJ" + qualifier="TRK" + kee="org.elasticsearch:elasticsearch" + name="Elasticsearch"/> <snapshots id="101" uuid="u101" - component_uuid="KLMN" parent_snapshot_id="[null]" root_component_uuid="KLMN" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path=""/> + component_uuid="KLMN" + parent_snapshot_id="[null]" + root_component_uuid="KLMN" + root_snapshot_id="[null]" + status="P" + islast="[true]" + purge_status="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path=""/> </dataset> diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1255_add_uuid_path_column_to_projects.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1255_add_uuid_path_column_to_projects.rb new file mode 100644 index 00000000000..2a9d667e1b3 --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1255_add_uuid_path_column_to_projects.rb @@ -0,0 +1,29 @@ +# +# SonarQube, open source software quality management tool. +# Copyright (C) 2008-2014 SonarSource +# mailto:contact AT sonarsource DOT com +# +# SonarQube 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. +# +# SonarQube 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. +# + +# +# SonarQube 6.0 +# +class AddUuidPathColumnToProjects < ActiveRecord::Migration + + def self.up + execute_java_migration('org.sonar.db.version.v60.AddUuidPathColumnToProjects') + end +end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1256_populate_uuid_path_column_on_projects.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1256_populate_uuid_path_column_on_projects.rb new file mode 100644 index 00000000000..b71406b8427 --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1256_populate_uuid_path_column_on_projects.rb @@ -0,0 +1,29 @@ +# +# SonarQube, open source software quality management tool. +# Copyright (C) 2008-2014 SonarSource +# mailto:contact AT sonarsource DOT com +# +# SonarQube 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. +# +# SonarQube 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. +# + +# +# SonarQube 6.0 +# +class PopulateUuidPathColumnOnProjects < ActiveRecord::Migration + + def self.up + execute_java_migration('org.sonar.db.version.v60.PopulateUuidPathColumnOnProjects') + end +end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1257_make_uuid_path_column_not_null_on_projects.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1257_make_uuid_path_column_not_null_on_projects.rb new file mode 100644 index 00000000000..7dd387be92b --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/1257_make_uuid_path_column_not_null_on_projects.rb @@ -0,0 +1,29 @@ +# +# SonarQube, open source software quality management tool. +# Copyright (C) 2008-2014 SonarSource +# mailto:contact AT sonarsource DOT com +# +# SonarQube 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. +# +# SonarQube 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. +# + +# +# SonarQube 6.0 +# +class MakeUuidPathColumnNotNullOnProjects < ActiveRecord::Migration + + def self.up + execute_java_migration('org.sonar.db.version.v60.MakeUuidPathColumnNotNullOnProjects') + end +end diff --git a/sonar-db/src/main/java/org/sonar/db/component/ComponentDao.java b/sonar-db/src/main/java/org/sonar/db/component/ComponentDao.java index b531ef282a3..256e03ec2ce 100644 --- a/sonar-db/src/main/java/org/sonar/db/component/ComponentDao.java +++ b/sonar-db/src/main/java/org/sonar/db/component/ComponentDao.java @@ -21,7 +21,9 @@ package org.sonar.db.component; import com.google.common.base.Optional; import com.google.common.collect.Lists; +import com.google.common.collect.Ordering; import java.util.Collection; +import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Locale; @@ -32,8 +34,10 @@ import org.apache.ibatis.session.RowBounds; import org.sonar.api.resources.Qualifiers; import org.sonar.api.resources.Scopes; import org.sonar.db.Dao; +import org.sonar.db.DatabaseUtils; import org.sonar.db.DbSession; import org.sonar.db.RowNotFoundException; +import org.sonar.db.WildcardPosition; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.collect.Maps.newHashMapWithExpectedSize; @@ -139,22 +143,99 @@ public class ComponentDao implements Dao { return mapper(session).selectComponentsHavingSameKeyOrderedById(key); } - public List<ComponentDtoWithSnapshotId> selectDirectChildren(DbSession dbSession, ComponentTreeQuery componentQuery) { - RowBounds rowBounds = new RowBounds(offset(componentQuery.getPage(), componentQuery.getPageSize()), componentQuery.getPageSize()); - return mapper(dbSession).selectDirectChildren(componentQuery, rowBounds); + /** + * Optional parent. It is absent if specified component is root. + */ + public Optional<ComponentDto> selectParent(DbSession dbSession, ComponentDto component) { + if (component.isRoot()) { + return Optional.absent(); + } + List<String> path = component.getUuidPathAsList(); + String parentUuid = path.get(path.size() - 1); + return Optional.of(mapper(dbSession).selectByUuid(parentUuid)); } - public List<ComponentDtoWithSnapshotId> selectAllChildren(DbSession dbSession, ComponentTreeQuery componentQuery) { - RowBounds rowBounds = new RowBounds(offset(componentQuery.getPage(), componentQuery.getPageSize()), componentQuery.getPageSize()); - return mapper(dbSession).selectAllChildren(componentQuery, rowBounds); + /** + * List of ancestors, ordered from root to parent. The list is empty + * if the component is a tree root. + */ + public List<ComponentDto> selectAncestors(DbSession dbSession, ComponentDto component) { + if (component.isRoot()) { + return Collections.emptyList(); + } + List<String> ancestorUuids = component.getUuidPathAsList(); + List<ComponentDto> ancestors = selectByUuids(dbSession, ancestorUuids); + return Ordering.explicit(ancestorUuids).onResultOf(ComponentDto::uuid).immutableSortedCopy(ancestors); } - public int countDirectChildren(DbSession dbSession, ComponentTreeQuery query) { - return mapper(dbSession).countDirectChildren(query); + /** + * Select the children of a base component, given by its UUID. The components that are not present in last + * analysis are ignored. + * + * An empty list is returned if the base component does not exist or if the base component is a leaf. + */ + public List<ComponentDto> selectChildren(DbSession dbSession, ComponentTreeQuery query) { + Optional<ComponentDto> componentOpt = selectByUuid(dbSession, query.getBaseUuid()); + if (!componentOpt.isPresent()) { + return emptyList(); + } + ComponentDto component = componentOpt.get(); + RowBounds rowBounds = new RowBounds(offset(query.getPage(), query.getPageSize()), query.getPageSize()); + return mapper(dbSession).selectChildren(query, uuidPathForChildrenQuery(component), rowBounds); + } + + /** + * Count the children of a base component, given by its UUID. The components that are not present in last + * analysis are ignored. + * + * Zero is returned if the base component does not exist or if the base component is a leaf. + */ + public int countChildren(DbSession dbSession, ComponentTreeQuery query) { + Optional<ComponentDto> componentOpt = selectByUuid(dbSession, query.getBaseUuid()); + if (!componentOpt.isPresent()) { + return 0; + } + ComponentDto component = componentOpt.get(); + return mapper(dbSession).countChildren(query, uuidPathForChildrenQuery(component)); + } + + private static String uuidPathForChildrenQuery(ComponentDto component) { + return component.getUuidPath() + component.uuid() + "."; + } + + /** + * Select the descendants of a base component, given by its UUID. The components that are not present in last + * analysis are ignored. + * + * An empty list is returned if the base component does not exist or if the base component is a leaf. + */ + public List<ComponentDto> selectDescendants(DbSession dbSession, ComponentTreeQuery query) { + Optional<ComponentDto> componentOpt = selectByUuid(dbSession, query.getBaseUuid()); + if (!componentOpt.isPresent()) { + return Collections.emptyList(); + } + ComponentDto component = componentOpt.get(); + RowBounds rowBounds = new RowBounds(offset(query.getPage(), query.getPageSize()), query.getPageSize()); + return mapper(dbSession).selectDescendants(query, uuidPathForDescendantsQuery(component), rowBounds); + } + + /** + * Count the descendants of a base component, given by its UUID. The components that are not present in last + * analysis are ignored. + * + * Zero is returned if the base component does not exist or if the base component is a leaf. + */ + public int countDescendants(DbSession dbSession, ComponentTreeQuery query) { + Optional<ComponentDto> componentOpt = selectByUuid(dbSession, query.getBaseUuid()); + if (!componentOpt.isPresent()) { + return 0; + } + ComponentDto component = componentOpt.get(); + return mapper(dbSession).countDescendants(query, uuidPathForDescendantsQuery(component)); } - public int countAllChildren(DbSession dbSession, ComponentTreeQuery query) { - return mapper(dbSession).countAllChildren(query); + private static String uuidPathForDescendantsQuery(ComponentDto component) { + return DatabaseUtils.buildLikeValue(component.getUuidPath() + component.uuid() + ".", WildcardPosition.AFTER); } public ComponentDto selectOrFailByKey(DbSession session, String key) { diff --git a/sonar-db/src/main/java/org/sonar/db/component/ComponentDto.java b/sonar-db/src/main/java/org/sonar/db/component/ComponentDto.java index 9df936cbf36..7652c76f6eb 100644 --- a/sonar-db/src/main/java/org/sonar/db/component/ComponentDto.java +++ b/sonar-db/src/main/java/org/sonar/db/component/ComponentDto.java @@ -19,33 +19,88 @@ */ package org.sonar.db.component; +import com.google.common.base.Splitter; +import com.google.common.base.Strings; import java.util.Date; +import java.util.List; import javax.annotation.CheckForNull; import javax.annotation.Nullable; import org.apache.commons.lang.builder.ToStringBuilder; import org.sonar.api.component.Component; import org.sonar.api.resources.Scopes; +import static com.google.common.base.Preconditions.checkArgument; import static org.sonar.db.component.ComponentValidator.checkComponentKey; import static org.sonar.db.component.ComponentValidator.checkComponentName; public class ComponentDto implements Component { - public static final String MODULE_UUID_PATH_SEP = "."; + public static final String UUID_PATH_SEPARATOR = "."; + public static final String UUID_PATH_OF_ROOT = UUID_PATH_SEPARATOR; + private static final Splitter UUID_PATH_SPLITTER = Splitter.on(UUID_PATH_SEPARATOR).omitEmptyStrings(); + /** + * ID generated by database. Do not use. + */ private Long id; - private String uuid; + + /** + * Non-empty and unique functional key + */ private String kee; - private String scope; - private String qualifier; + /** + * Not empty . Max size is 50 (note that effective UUID values are 40 characters with + * the current algorithm in use). Obviously it is unique. + * It is generated by Compute Engine. + */ + private String uuid; + + /** + * Not empty path of ancestor UUIDS, including self. Value is suffixed by a dot in + * order to support LIKE conditions when requesting descendants of a component. + * Example: + * - on root module: UUID="1" UUID_PATH="1." + * - on module: UUID="2" UUID_PATH="1.2." + * - on directory: UUID="3" UUID_PATH="1.2.3." + * - on file: UUID="4" UUID_PATH="1.2.3.4." + * - on view: UUID="5" UUID_PATH="5." + * - on sub-view: UUID="6" UUID_PATH="5.6." + * + * @since 6.0 + */ + private String uuidPath; + + /** + * Non-null UUID of root component. Equals UUID column on root components + * Example: + * - on root module: UUID="1" PROJECT_UUID="1" + * - on module: UUID="2" PROJECT_UUID="1" + * - on directory: UUID="3" PROJECT_UUID="1" + * - on file: UUID="4" PROJECT_UUID="1" + * - on view: UUID="5" PROJECT_UUID="5" + * - on sub-view: UUID="6" PROJECT_UUID="5" + */ private String projectUuid; + + /** + * Badly named, it is not the root ! + * - on root module: UUID="1" ROOT_UUID="1" + * - on modules, whatever depth, value is the root module: UUID="2" ROOT_UUID="1" + * - on directory, value is the closed module: UUID="3" ROOT_UUID="2" + * - on file, value is the closed module: UUID="4" ROOT_UUID="2" + * - on view: UUID="5" ROOT_UUID="5" + * - on sub-view: UUID="6" ROOT_UUID="5" + * @since 6.0 + */ + private String rootUuid; + private String moduleUuid; private String moduleUuidPath; - private String rootUuid; private String copyComponentUuid; private String developerUuid; - + private String scope; + private String qualifier; private String path; private String deprecatedKey; private String name; @@ -75,6 +130,26 @@ public class ComponentDto implements Component { return this; } + /** + * No need to have public visibility as this field + * is supposed to be used only internally in SQL requests. + */ + String getUuidPath() { + return uuidPath; + } + + /** + * List of ancestor UUIDs, ordered by depth in tree. + */ + List<String> getUuidPathAsList() { + return UUID_PATH_SPLITTER.splitToList(uuidPath); + } + + public ComponentDto setUuidPath(String s) { + this.uuidPath = s; + return this; + } + @Override public String key() { return kee; @@ -121,6 +196,10 @@ public class ComponentDto implements Component { return this; } + public boolean isRoot() { + return UUID_PATH_OF_ROOT.equals(uuidPath); + } + /** * Return the direct module of a component. Will be null on projects */ @@ -270,7 +349,6 @@ public class ComponentDto implements Component { return moduleUuid == null && Scopes.PROJECT.equals(scope); } - // FIXME equals/hashCode mean nothing on DTOs, especially when on id @Override public boolean equals(Object o) { if (this == o) { @@ -280,16 +358,13 @@ public class ComponentDto implements Component { return false; } ComponentDto that = (ComponentDto) o; - if (id != null ? !id.equals(that.id) : that.id != null) { - return false; - } - return true; + return uuid != null ? uuid.equals(that.uuid) : (that.uuid == null); + } - // FIXME equals/hashCode mean nothing on DTOs, especially when on id @Override public int hashCode() { - return id != null ? id.hashCode() : 0; + return uuid != null ? uuid.hashCode() : 0; } @Override @@ -297,6 +372,7 @@ public class ComponentDto implements Component { return new ToStringBuilder(this) .append("id", id) .append("uuid", uuid) + .append("uuidPath", uuidPath) .append("kee", kee) .append("scope", scope) .append("qualifier", qualifier) @@ -316,4 +392,9 @@ public class ComponentDto implements Component { .toString(); } + public static String formatUuidPathFromParent(ComponentDto parent) { + checkArgument(!Strings.isNullOrEmpty(parent.getUuidPath())); + checkArgument(!Strings.isNullOrEmpty(parent.uuid())); + return parent.getUuidPath() + parent.uuid() + UUID_PATH_SEPARATOR; + } } diff --git a/sonar-db/src/main/java/org/sonar/db/component/ComponentMapper.java b/sonar-db/src/main/java/org/sonar/db/component/ComponentMapper.java index bc5e291c5c7..9f69872a2fa 100644 --- a/sonar-db/src/main/java/org/sonar/db/component/ComponentMapper.java +++ b/sonar-db/src/main/java/org/sonar/db/component/ComponentMapper.java @@ -62,20 +62,15 @@ public interface ComponentMapper { int countByQuery(@Param("query") ComponentQuery query); - /** - * Return direct children components - */ - List<ComponentDtoWithSnapshotId> selectDirectChildren(@Param("query") ComponentTreeQuery componentTreeQuery, RowBounds rowBounds); + List<ComponentDto> selectAncestors(@Param("query") ComponentTreeQuery query, @Param("baseUuidPathLike") String baseUuidPathLike); - int countDirectChildren(@Param("query") ComponentTreeQuery componentTreeQuery); + List<ComponentDto> selectChildren(@Param("query") ComponentTreeQuery query, @Param("baseUuidPath") String baseUuidPath, RowBounds rowBounds); - /** - * Return all children components. - */ - List<ComponentDtoWithSnapshotId> selectAllChildren(@Param("query") ComponentTreeQuery componentTreeQuery, - RowBounds rowBounds); + int countChildren(@Param("query") ComponentTreeQuery query, @Param("baseUuidPath") String baseUuidPath); + + List<ComponentDto> selectDescendants(@Param("query") ComponentTreeQuery query, @Param("baseUuidPathLike") String baseUuidPathLike, RowBounds rowBounds); - int countAllChildren(@Param("query") ComponentTreeQuery componentTreeQuery); + int countDescendants(@Param("query") ComponentTreeQuery query, @Param("baseUuidPathLike") String baseUuidPathLike); /** * Return all project (PRJ/TRK) uuids diff --git a/sonar-db/src/main/java/org/sonar/db/component/ComponentTreeQuery.java b/sonar-db/src/main/java/org/sonar/db/component/ComponentTreeQuery.java index d7f1dee8746..5c0cae54a60 100644 --- a/sonar-db/src/main/java/org/sonar/db/component/ComponentTreeQuery.java +++ b/sonar-db/src/main/java/org/sonar/db/component/ComponentTreeQuery.java @@ -19,20 +19,19 @@ */ package org.sonar.db.component; -import com.google.common.base.Function; -import com.google.common.base.Joiner; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Locale; +import java.util.function.Function; +import java.util.stream.Collectors; import javax.annotation.CheckForNull; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import org.sonar.db.WildcardPosition; import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.collect.FluentIterable.from; import static com.google.common.collect.Lists.newArrayList; +import static java.lang.String.format; import static java.util.Objects.requireNonNull; import static org.sonar.db.DatabaseUtils.buildLikeValue; import static org.sonar.db.WildcardPosition.AFTER; @@ -47,8 +46,7 @@ public class ComponentTreeQuery { private final Integer page; @CheckForNull private final Integer pageSize; - private final SnapshotDto baseSnapshot; - private final String baseSnapshotPath; + private final String baseUuid; private final String sqlSort; private final String direction; @@ -57,8 +55,7 @@ public class ComponentTreeQuery { this.qualifiers = builder.qualifiers == null ? null : newArrayList(builder.qualifiers); this.page = builder.page; this.pageSize = builder.pageSize; - this.baseSnapshot = builder.baseSnapshot; - this.baseSnapshotPath = buildBaseSnapshotPath(baseSnapshot); + this.baseUuid = builder.baseUuid; this.direction = builder.asc ? "ASC" : "DESC"; this.sqlSort = sortFieldsToSqlSort(builder.sortFields, direction); } @@ -85,12 +82,8 @@ public class ComponentTreeQuery { return pageSize; } - public SnapshotDto getBaseSnapshot() { - return baseSnapshot; - } - - public String getBaseSnapshotPath() { - return baseSnapshotPath; + public String getBaseUuid() { + return baseUuid; } public String getSqlSort() { @@ -106,15 +99,10 @@ public class ComponentTreeQuery { } private static String sortFieldsToSqlSort(List<String> sortFields, String direction) { - List<String> sqlSortFields = from(sortFields) - .transform(new SortFieldToSqlSortFieldFunction(direction)).toList(); - - return Joiner.on(", ").join(sqlSortFields); - } - - private static String buildBaseSnapshotPath(SnapshotDto baseSnapshot) { - String existingSnapshotPath = baseSnapshot.getPath() == null ? "" : baseSnapshot.getPath(); - return buildLikeValue(existingSnapshotPath + baseSnapshot.getId() + ".", WildcardPosition.AFTER); + return sortFields + .stream() + .map(new SortFieldToSqlSortFieldFunction(direction)::apply) + .collect(Collectors.joining(", ")); } public static class Builder { @@ -126,7 +114,7 @@ public class ComponentTreeQuery { private Integer page; @CheckForNull private Integer pageSize; - private SnapshotDto baseSnapshot; + private String baseUuid; private List<String> sortFields; private boolean asc = true; @@ -135,7 +123,7 @@ public class ComponentTreeQuery { } public ComponentTreeQuery build() { - requireNonNull(baseSnapshot); + requireNonNull(baseUuid); return new ComponentTreeQuery(this); } @@ -159,12 +147,12 @@ public class ComponentTreeQuery { return this; } - public Builder setBaseSnapshot(SnapshotDto baseSnapshot) { - this.baseSnapshot = baseSnapshot; + public Builder setBaseUuid(String uuid) { + this.baseUuid = uuid; return this; } - public Builder setSortFields(@Nullable List<String> sorts) { + public Builder setSortFields(List<String> sorts) { checkArgument(sorts != null && !sorts.isEmpty()); this.sortFields = sorts; return this; @@ -188,7 +176,7 @@ public class ComponentTreeQuery { @Nonnull @Override public String apply(@Nonnull String input) { - return String.format(PATTERN, input, direction); + return format(PATTERN, input, direction); } } } diff --git a/sonar-db/src/main/java/org/sonar/db/measure/MeasureDao.java b/sonar-db/src/main/java/org/sonar/db/measure/MeasureDao.java index 738034f5d69..112808cde61 100644 --- a/sonar-db/src/main/java/org/sonar/db/measure/MeasureDao.java +++ b/sonar-db/src/main/java/org/sonar/db/measure/MeasureDao.java @@ -21,6 +21,7 @@ package org.sonar.db.measure; import com.google.common.collect.Lists; import java.util.Collection; +import java.util.Collections; import java.util.List; import java.util.Set; import javax.annotation.CheckForNull; @@ -35,6 +36,19 @@ import static org.sonar.db.DatabaseUtils.executeLargeInputs; public class MeasureDao implements Dao { + public List<MeasureDto> selectByQuery(DbSession dbSession, MeasureQuery query) { + if (query.returnsEmpty()) { + return Collections.emptyList(); + } + if (query.getComponentUuids() == null) { + return mapper(dbSession).selectByQuery(query); + } + return executeLargeInputs(query.getComponentUuids(), componentUuids -> { + MeasureQuery pageQuery = MeasureQuery.copyWithSubsetOfComponentUuids(query, componentUuids); + return mapper(dbSession).selectByQuery(pageQuery); + }); + } + public boolean existsByKey(DbSession session, String componentKey, String metricKey) { return mapper(session).countByComponentAndMetric(componentKey, metricKey) > 0; } diff --git a/sonar-db/src/main/java/org/sonar/db/measure/MeasureMapper.java b/sonar-db/src/main/java/org/sonar/db/measure/MeasureMapper.java index 5c0910167c0..08423df79d7 100644 --- a/sonar-db/src/main/java/org/sonar/db/measure/MeasureMapper.java +++ b/sonar-db/src/main/java/org/sonar/db/measure/MeasureMapper.java @@ -27,8 +27,9 @@ import org.apache.ibatis.annotations.Param; public interface MeasureMapper { - MeasureDto selectByKey(@Param("componentKey") String componentKey, @Param("metricKey") String metricKey); + List<MeasureDto> selectByQuery(@Param("query") MeasureQuery query); + MeasureDto selectByKey(@Param("componentKey") String componentKey, @Param("metricKey") String metricKey); List<MeasureDto> selectByComponentAndMetrics(@Param("componentKey") String componentKey, @Param("metricKeys") List<String> metricKeys); List<MeasureDto> selectBySnapshotAndMetricKeys(@Param("snapshotId") long snapshotId, @Param("metricKeys") List<String> metricKeys); diff --git a/sonar-db/src/main/java/org/sonar/db/measure/MeasureQuery.java b/sonar-db/src/main/java/org/sonar/db/measure/MeasureQuery.java new file mode 100644 index 00000000000..b787570f161 --- /dev/null +++ b/sonar-db/src/main/java/org/sonar/db/measure/MeasureQuery.java @@ -0,0 +1,95 @@ +/* + * 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.measure; + +import java.util.Collection; +import java.util.List; +import javax.annotation.CheckForNull; +import javax.annotation.Nullable; + +import static com.google.common.base.Preconditions.checkState; + +public class MeasureQuery { + private final List<String> componentUuids; + private final Collection<Integer> metricIds; + private final Long personId; + + private MeasureQuery(Builder builder) { + this(builder.componentUuids, builder.metricIds, builder.personId); + } + + private MeasureQuery(List<String> componentUuids, @CheckForNull Collection<Integer> metricIds, @Nullable Long personId) { + checkState(componentUuids != null, "Component UUIDs must be set"); + this.componentUuids = componentUuids; + this.metricIds = metricIds; + this.personId = personId; + } + + public List<String> getComponentUuids() { + return componentUuids; + } + + @CheckForNull + public Collection<Integer> getMetricIds() { + return metricIds; + } + + @CheckForNull + public Long getPersonId() { + return personId; + } + + public boolean returnsEmpty() { + return componentUuids.isEmpty() + || (metricIds != null && metricIds.isEmpty()); + } + + public static MeasureQuery copyWithSubsetOfComponentUuids(MeasureQuery query, List<String> componentUuids) { + return new MeasureQuery(componentUuids, query.metricIds, query.personId); + } + + public static final class Builder { + private List<String> componentUuids; + private Collection<Integer> metricIds; + private Long personId; + + public Builder setComponentUuids(List<String> componentUuids) { + this.componentUuids = componentUuids; + return this; + } + + /** + * All the measures are returned if parameter is {@code null}. + */ + public Builder setMetricIds(@Nullable Collection<Integer> metricIds) { + this.metricIds = metricIds; + return this; + } + + public Builder setPersonId(@Nullable Long l) { + this.personId = l; + return this; + } + + public MeasureQuery build() { + return new MeasureQuery(this); + } + } +} diff --git a/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java b/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java index 91a8b88a9c7..09e6fd5afd8 100644 --- a/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java +++ b/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java @@ -30,7 +30,7 @@ import org.sonar.db.MyBatis; public class DatabaseVersion { - public static final int LAST_VERSION = 1_254; + public static final int LAST_VERSION = 1_257; /** * The minimum supported version which can be upgraded. Lower @@ -90,7 +90,8 @@ public class DatabaseVersion { "user_roles", "user_tokens", "widgets", - "widget_properties"); + "widget_properties" + ); private MyBatis mybatis; public DatabaseVersion(MyBatis mybatis) { diff --git a/sonar-db/src/main/java/org/sonar/db/version/MigrationStepModule.java b/sonar-db/src/main/java/org/sonar/db/version/MigrationStepModule.java index 6e4314e9e16..5dd6b7e55e7 100644 --- a/sonar-db/src/main/java/org/sonar/db/version/MigrationStepModule.java +++ b/sonar-db/src/main/java/org/sonar/db/version/MigrationStepModule.java @@ -93,6 +93,7 @@ import org.sonar.db.version.v60.AddLastUsedColumnToRulesProfiles; import org.sonar.db.version.v60.AddUuidColumnToSnapshots; import org.sonar.db.version.v60.AddUuidColumnsToProjects; import org.sonar.db.version.v60.AddUuidColumnsToResourceIndex; +import org.sonar.db.version.v60.AddUuidPathColumnToProjects; import org.sonar.db.version.v60.CleanEventsWithoutAnalysisUuid; import org.sonar.db.version.v60.CleanEventsWithoutSnapshotId; import org.sonar.db.version.v60.CleanOrphanRowsInProjects; @@ -118,6 +119,7 @@ import org.sonar.db.version.v60.MakeComponentUuidNotNullOnMeasures; import org.sonar.db.version.v60.MakeUuidColumnNotNullOnSnapshots; import org.sonar.db.version.v60.MakeUuidColumnsNotNullOnProjects; import org.sonar.db.version.v60.MakeUuidColumnsNotNullOnResourceIndex; +import org.sonar.db.version.v60.MakeUuidPathColumnNotNullOnProjects; import org.sonar.db.version.v60.PopulateAnalysisUuidColumnOnCeActivity; import org.sonar.db.version.v60.PopulateAnalysisUuidOfDuplicationsIndex; import org.sonar.db.version.v60.PopulateAnalysisUuidOnEvents; @@ -128,6 +130,7 @@ import org.sonar.db.version.v60.PopulateLastUsedColumnOfRulesProfiles; import org.sonar.db.version.v60.PopulateUuidColumnOnSnapshots; import org.sonar.db.version.v60.PopulateUuidColumnsOfProjects; import org.sonar.db.version.v60.PopulateUuidColumnsOfResourceIndex; +import org.sonar.db.version.v60.PopulateUuidPathColumnOnProjects; public class MigrationStepModule extends Module { @Override @@ -267,6 +270,11 @@ public class MigrationStepModule extends Module { CleanEventsWithoutAnalysisUuid.class, CleanEventsWithoutSnapshotId.class, MakeAnalysisUuidNotNullOnEvents.class, - DropSnapshotIdColumnFromEvents.class); + DropSnapshotIdColumnFromEvents.class, + + // PROJECTS.UUID_PATH + AddUuidPathColumnToProjects.class, + PopulateUuidPathColumnOnProjects.class, + MakeUuidPathColumnNotNullOnProjects.class); } } diff --git a/sonar-db/src/main/java/org/sonar/db/version/Select.java b/sonar-db/src/main/java/org/sonar/db/version/Select.java index 0d8b4a3698f..00714395082 100644 --- a/sonar-db/src/main/java/org/sonar/db/version/Select.java +++ b/sonar-db/src/main/java/org/sonar/db/version/Select.java @@ -126,6 +126,7 @@ public interface Select extends SqlStatement<Select> { } } + @FunctionalInterface interface RowReader<T> { T read(Row row) throws SQLException; } @@ -154,6 +155,7 @@ public interface Select extends SqlStatement<Select> { RowReader<String> STRING_READER = new StringReader(); + @FunctionalInterface interface RowHandler { void handle(Row row) throws SQLException; } diff --git a/sonar-db/src/main/java/org/sonar/db/version/VarcharColumnDef.java b/sonar-db/src/main/java/org/sonar/db/version/VarcharColumnDef.java index 71c77a0cd1f..0983a4145a0 100644 --- a/sonar-db/src/main/java/org/sonar/db/version/VarcharColumnDef.java +++ b/sonar-db/src/main/java/org/sonar/db/version/VarcharColumnDef.java @@ -31,6 +31,7 @@ import static org.sonar.db.version.ColumnDefValidation.validateColumnName; * Used to define VARCHAR column */ public class VarcharColumnDef extends AbstractColumnDef { + public static final int MAX_SIZE = 4_000; public static final int UUID_VARCHAR_SIZE = 50; private final int columnSize; diff --git a/sonar-db/src/main/java/org/sonar/db/version/v60/AddUuidPathColumnToProjects.java b/sonar-db/src/main/java/org/sonar/db/version/v60/AddUuidPathColumnToProjects.java new file mode 100644 index 00000000000..b9a46741d8a --- /dev/null +++ b/sonar-db/src/main/java/org/sonar/db/version/v60/AddUuidPathColumnToProjects.java @@ -0,0 +1,45 @@ +/* + * 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.version.v60; + +import java.sql.SQLException; +import org.sonar.db.Database; +import org.sonar.db.version.AddColumnsBuilder; +import org.sonar.db.version.DdlChange; + +import static org.sonar.db.version.VarcharColumnDef.MAX_SIZE; +import static org.sonar.db.version.VarcharColumnDef.newVarcharColumnDefBuilder; + +public class AddUuidPathColumnToProjects extends DdlChange { + + private static final String TABLE_PROJECTS = "projects"; + + public AddUuidPathColumnToProjects(Database db) { + super(db); + } + + @Override + public void execute(Context context) throws SQLException { + context.execute(new AddColumnsBuilder(getDialect(), TABLE_PROJECTS) + .addColumn(newVarcharColumnDefBuilder().setColumnName("uuid_path").setLimit(MAX_SIZE).setIsNullable(true).build()) + .build()); + } + +} diff --git a/sonar-db/src/main/java/org/sonar/db/version/v60/MakeUuidPathColumnNotNullOnProjects.java b/sonar-db/src/main/java/org/sonar/db/version/v60/MakeUuidPathColumnNotNullOnProjects.java new file mode 100644 index 00000000000..bcb3ce4c7e0 --- /dev/null +++ b/sonar-db/src/main/java/org/sonar/db/version/v60/MakeUuidPathColumnNotNullOnProjects.java @@ -0,0 +1,45 @@ +/* + * 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.version.v60; + +import java.sql.SQLException; +import org.sonar.db.Database; +import org.sonar.db.version.AlterColumnsBuilder; +import org.sonar.db.version.DdlChange; + +import static org.sonar.db.version.VarcharColumnDef.MAX_SIZE; +import static org.sonar.db.version.VarcharColumnDef.newVarcharColumnDefBuilder; + +public class MakeUuidPathColumnNotNullOnProjects extends DdlChange { + + private static final String TABLE_PROJECTS = "projects"; + + public MakeUuidPathColumnNotNullOnProjects(Database db) { + super(db); + } + + @Override + public void execute(Context context) throws SQLException { + context.execute(new AlterColumnsBuilder(getDialect(), TABLE_PROJECTS) + .updateColumn(newVarcharColumnDefBuilder().setColumnName("uuid_path").setLimit(MAX_SIZE).setIsNullable(false).build()) + .build()); + } + +} diff --git a/sonar-db/src/main/java/org/sonar/db/version/v60/PopulateUuidPathColumnOnProjects.java b/sonar-db/src/main/java/org/sonar/db/version/v60/PopulateUuidPathColumnOnProjects.java new file mode 100644 index 00000000000..ce12eb26bc5 --- /dev/null +++ b/sonar-db/src/main/java/org/sonar/db/version/v60/PopulateUuidPathColumnOnProjects.java @@ -0,0 +1,156 @@ +/* + * 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.version.v60; + +import com.google.common.base.Joiner; +import com.google.common.base.Splitter; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.sonar.api.utils.log.Logger; +import org.sonar.api.utils.log.Loggers; +import org.sonar.db.Database; +import org.sonar.db.version.BaseDataChange; +import org.sonar.db.version.MassUpdate; +import org.sonar.db.version.Select; +import org.sonar.db.version.SqlStatement; + +import static java.util.stream.Collectors.toCollection; + +public class PopulateUuidPathColumnOnProjects extends BaseDataChange { + + private static final Logger LOG = Loggers.get(PopulateUuidPathColumnOnProjects.class); + private static final Joiner PATH_JOINER = Joiner.on('.'); + private static final Splitter PATH_SPLITTER = Splitter.on('.').omitEmptyStrings(); + private static final String PATH_SEPARATOR = "."; + private static final String ROOT_PATH = PATH_SEPARATOR; + + public PopulateUuidPathColumnOnProjects(Database db) { + super(db); + } + + @Override + public void execute(Context context) throws SQLException { + // group upgrades by tree of component + List<String> rootComponentUuids = context + .prepareSelect("select distinct project_uuid from projects where uuid_path is null") + .list(row -> row.getString(1)); + for (String rootUuid : rootComponentUuids) { + handleRoot(rootUuid, context); + } + + handleOrphans(context); + } + + private void handleRoot(String rootComponentUuid, Context context) throws SQLException { + Relations relations = new Relations(); + context + .prepareSelect("select s.id, s.path, s.component_uuid from snapshots s where s.root_component_uuid=? and s.islast=?") + .setString(1, rootComponentUuid) + .setBoolean(2, true) + .scroll(row -> { + long snapshotId = row.getLong(1); + String snapshotPath = row.getString(2); + String componentUuid = row.getString(3); + relations.add(new Snapshot(snapshotId, snapshotPath, componentUuid)); + }); + + MassUpdate massUpdate = context.prepareMassUpdate(); + massUpdate.select("select p.uuid, p.project_uuid from projects p where p.project_uuid=? and p.uuid_path is null").setString(1, rootComponentUuid); + massUpdate.update("update projects set uuid_path=? where uuid=? and uuid_path is null"); + massUpdate.rowPluralName("components in tree of " + rootComponentUuid); + massUpdate.execute((row, update) -> handleComponent(relations, row, update)); + } + + private void handleOrphans(Context context) throws SQLException { + MassUpdate massUpdate = context.prepareMassUpdate(); + massUpdate.select("select uuid, project_uuid from projects where uuid_path is null"); + massUpdate.update("update projects set uuid_path=? where uuid=? and uuid_path is null"); + massUpdate.rowPluralName("orphan components"); + massUpdate.execute((row, update, updateIndex) -> { + String uuid = row.getString(1); + String rootUuid = row.getString(2); + String path = uuid.equals(rootUuid) ? ROOT_PATH : (rootUuid + PATH_SEPARATOR); + update.setString(1, path); + update.setString(2, uuid); + return true; + }); + } + + private boolean handleComponent(Relations relations, Select.Row row, SqlStatement update) throws SQLException { + String componentUuid = row.getString(1); + String rootComponentUuid = row.getString(2); + + if (componentUuid.equals(rootComponentUuid)) { + // Root component, no need to use the table SNAPSHOTS. + // Moreover it allows to support provisioned projects (zero analysis) + update.setString(1, PATH_SEPARATOR); + update.setString(2, componentUuid); + return true; + } + + Snapshot snapshot = relations.snapshotsByComponentUuid.get(componentUuid); + if (snapshot == null) { + LOG.trace("No UUID found for component UUID={}", componentUuid); + return false; + } + + List<String> componentUuidPath = Arrays.stream(snapshot.snapshotPath) + .mapToObj(snapshotId -> relations.snapshotsById.get(snapshotId).componentUuid) + .collect(toCollection(() -> new ArrayList<>(snapshot.snapshotPath.length))); + update.setString(1, PATH_JOINER.join(componentUuidPath) + PATH_SEPARATOR); + update.setString(2, componentUuid); + return true; + } + + private static final class Relations { + private final Map<String, Snapshot> snapshotsByComponentUuid = new HashMap<>(); + private final Map<Long, Snapshot> snapshotsById = new HashMap<>(); + + void add(Snapshot snapshot) { + snapshotsByComponentUuid.put(snapshot.componentUuid, snapshot); + snapshotsById.put(snapshot.id, snapshot); + } + } + + private static final class Snapshot { + private final long id; + private final long[] snapshotPath; + private final String componentUuid; + + public Snapshot(long id, String snapshotPath, String componentUuid) { + this.id = id; + this.snapshotPath = parsePath(snapshotPath); + this.componentUuid = componentUuid; + } + + // inputs: "", "1." or "1.2.3." + private long[] parsePath(String snapshotPath) { + return PATH_SPLITTER + .splitToList(snapshotPath) + .stream() + .mapToLong(Long::parseLong) + .toArray(); + } + } +} 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 5129d2e2681..49646233f04 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 @@ -5,6 +5,7 @@ <sql id="componentColumns"> p.id, p.uuid as uuid, + p.uuid_path as uuidPath, p.project_uuid as projectUuid, p.module_uuid as moduleUuid, p.module_uuid_path as moduleUuidPath, @@ -29,6 +30,7 @@ p.id, p.name, p.uuid as uuid, + p.uuid_path as uuidPath, p.kee as kee, p.qualifier as qualifier, p.scope as scope, @@ -315,73 +317,101 @@ </where> </sql> - <select id="selectDirectChildren" resultType="ComponentWithSnapshot"> + <!-- "p" is ancestors --> + <select id="selectAncestors" resultType="Component"> select - <include refid="componentColumns"/>, s.id as snapshotId - <include refid="sqlSelectByTreeQuery"/> - and s.parent_snapshot_id = #{query.baseSnapshot.id} + <include refid="componentColumns"/> + from projects base + inner join projects p + where + base.uuid = #{query.baseUuid} + and p.project_uuid = base.project_uuid + and base.uuid_path like #{baseUuidPathLike} + and p.uuid != base.uuid + and p.enabled = ${_true} order by ${query.sqlSort} </select> - <select id="countDirectChildren" resultType="int"> - select count(p.id) - <include refid="sqlSelectByTreeQuery"/> - and s.parent_snapshot_id = #{query.baseSnapshot.id} - </select> - - <select id="selectAllChildren" resultType="ComponentWithSnapshot"> + <!-- "p" is children --> + <select id="selectChildren" resultType="Component"> select - <include refid="componentColumns"/>, s.id as snapshotId - <include refid="sqlSelectAllChildren" /> + <include refid="componentColumns"/> + <include refid="sqlChildren"/> order by ${query.sqlSort} </select> - <select id="countAllChildren" resultType="int"> + <select id="countChildren" resultType="int"> select count(p.id) - <include refid="sqlSelectAllChildren"/> + <include refid="sqlChildren"/> </select> - <sql id="sqlSelectAllChildren"> - <include refid="sqlSelectByTreeQuery"/> - <if test="query.baseSnapshot.rootId!=null"> - and s.root_snapshot_id = #{query.baseSnapshot.rootId} - </if> - <if test="query.baseSnapshot.rootId==null"> - and s.root_snapshot_id = #{query.baseSnapshot.id} - </if> - and s.path like #{query.baseSnapshotPath} ESCAPE '/' - </sql> - - <sql id="sqlSelectByTreeQuery"> + <sql id="sqlChildren"> from projects p - inner join snapshots s on p.uuid = s.component_uuid + inner join projects base + inner join snapshots s where - p.enabled=${_true} - <if test="query.qualifiers!=null"> - AND p.qualifier in + base.uuid = #{query.baseUuid} + and base.project_uuid = p.project_uuid + and s.component_uuid = base.project_uuid + and p.enabled = ${_true} + and s.islast = ${_true} + and p.uuid_path = #{baseUuidPath} + <include refid="sqlTreeFilters"/> + </sql> + + <sql id="sqlTreeFilters"> + <if test="query.qualifiers != null"> + and p.qualifier in <foreach collection="query.qualifiers" item="qualifier" open="(" close=")" separator=","> #{qualifier} </foreach> </if> - <if test="query.nameOrKeyQuery!=null"> - AND ( - p.kee=#{query.nameOrKeyQuery} - OR - p.uuid IN ( - SELECT ri.component_uuid - FROM resource_index ri - WHERE ri.kee like #{query.nameOrKeyQueryToSqlForResourceIndex} ESCAPE '/' - ) - OR - p.copy_component_uuid IN ( - SELECT ri.component_uuid - FROM resource_index ri - WHERE ri.kee like #{query.nameOrKeyQueryToSqlForResourceIndex} ESCAPE '/' - ) + <if test="query.nameOrKeyQuery != null"> + and ( + p.kee=#{query.nameOrKeyQuery} + or + p.uuid IN ( + SELECT ri.component_uuid + FROM resource_index ri + WHERE ri.kee like #{query.nameOrKeyQueryToSqlForResourceIndex} ESCAPE '/' + ) + or + p.copy_component_uuid IN ( + SELECT ri.component_uuid + FROM resource_index ri + WHERE ri.kee like #{query.nameOrKeyQueryToSqlForResourceIndex} ESCAPE '/' + ) ) </if> </sql> + <!-- "p" is descendants --> + <select id="selectDescendants" resultType="Component"> + select + <include refid="componentColumns"/> + <include refid="sqlDescendants"/> + order by ${query.sqlSort} + </select> + + <select id="countDescendants" resultType="int"> + select count(p.id) + <include refid="sqlDescendants"/> + </select> + + <sql id="sqlDescendants"> + from projects p + inner join projects base + inner join snapshots s + where + base.uuid = #{query.baseUuid} + and base.project_uuid=p.project_uuid + and p.enabled = ${_true} + and p.uuid_path like #{baseUuidPathLike} ESCAPE '/' + and s.component_uuid = base.project_uuid + and s.islast = ${_true} + <include refid="sqlTreeFilters"/> + </sql> + <select id="countRootComponents" resultType="int"> select count(p.id) from projects p @@ -491,17 +521,47 @@ </sql> <sql id="insertSql"> - INSERT INTO projects (kee, deprecated_kee, uuid, project_uuid, module_uuid, module_uuid_path, name, long_name, - qualifier, scope, language, description, root_uuid, path, copy_component_uuid, developer_uuid, enabled, - created_at, authorization_updated_at) - VALUES (#{kee,jdbcType=VARCHAR}, #{deprecatedKey,jdbcType=VARCHAR}, #{uuid,jdbcType=VARCHAR}, - #{projectUuid,jdbcType=VARCHAR}, #{moduleUuid,jdbcType=VARCHAR}, #{moduleUuidPath,jdbcType=VARCHAR}, - #{name,jdbcType=VARCHAR}, #{longName,jdbcType=VARCHAR}, #{qualifier,jdbcType=VARCHAR}, #{scope,jdbcType=VARCHAR}, - #{language,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, - #{rootUuid,jdbcType=VARCHAR}, #{path,jdbcType=VARCHAR}, #{copyComponentUuid,jdbcType=VARCHAR}, + INSERT INTO projects (kee, + deprecated_kee, + uuid, + uuid_path, + project_uuid, + module_uuid, + module_uuid_path, + name, + long_name, + qualifier, + scope, + language, + description, + root_uuid, + path, + copy_component_uuid, + developer_uuid, + enabled, + created_at, + authorization_updated_at) + VALUES ( + #{kee,jdbcType=VARCHAR}, + #{deprecatedKey,jdbcType=VARCHAR}, + #{uuid,jdbcType=VARCHAR}, + #{uuidPath,jdbcType=VARCHAR}, + #{projectUuid,jdbcType=VARCHAR}, + #{moduleUuid,jdbcType=VARCHAR}, + #{moduleUuidPath,jdbcType=VARCHAR}, + #{name,jdbcType=VARCHAR}, + #{longName,jdbcType=VARCHAR}, + #{qualifier,jdbcType=VARCHAR}, + #{scope,jdbcType=VARCHAR}, + #{language,jdbcType=VARCHAR}, + #{description,jdbcType=VARCHAR}, + #{rootUuid,jdbcType=VARCHAR}, + #{path,jdbcType=VARCHAR}, + #{copyComponentUuid,jdbcType=VARCHAR}, #{developerUuid,jdbcType=VARCHAR}, #{enabled,jdbcType=BOOLEAN}, - #{createdAt,jdbcType=TIMESTAMP}, #{authorizationUpdatedAt,jdbcType=BIGINT}) + #{createdAt,jdbcType=TIMESTAMP}, + #{authorizationUpdatedAt,jdbcType=BIGINT}) </sql> <insert id="insert" parameterType="Component" keyColumn="id" useGeneratedKeys="true" keyProperty="id"> diff --git a/sonar-db/src/main/resources/org/sonar/db/measure/MeasureMapper.xml b/sonar-db/src/main/resources/org/sonar/db/measure/MeasureMapper.xml index f2e85bb036c..6641363bf0e 100644 --- a/sonar-db/src/main/resources/org/sonar/db/measure/MeasureMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/measure/MeasureMapper.xml @@ -25,6 +25,49 @@ metric.name as metricKey </sql> + + <select id="selectByQuery" parameterType="map" resultType="Measure"> + select + <include refid="measureColumns"/> + from project_measures pm + inner join snapshots s + where + s.id=pm.snapshot_id + and pm.component_uuid in + <foreach item="componentUuid" collection="query.getComponentUuids()" open="(" separator="," close=")"> + #{componentUuid} + </foreach> + and s.islast=${_true} + <if test="query.getMetricIds() != null"> + and pm.metric_id in + <foreach item="metricId" collection="query.getMetricIds()" open="(" separator="," close=")">#{metricId}</foreach> + </if> + <choose> + <when test="query.getPersonId() != null"> + and person_id = #{query.personId} + </when> + <otherwise> + and person_id is null + </otherwise> + </choose> + </select> + + <select id="selectByComponentUuidsAndMetricIds" parameterType="map" resultType="Measure"> + select + <include refid="measureColumns"/> + from project_measures pm + inner join snapshots s + where + s.id=pm.snapshot_id + and s.islast=${_true} + and pm.component_uuid in + <foreach item="componentUuid" collection="componentUuids" open="(" separator="," close=")">#{componentUuid} + </foreach> + and pm.person_id is null + and pm.metric_id in + <foreach item="metricId" collection="metricIds" open="(" separator="," close=")">#{metricId}</foreach> + </select> + <select id="selectByComponentAndMetric" parameterType="map" resultType="Measure"> SELECT metric.name as metric_name, <include refid="extendedMeasureColumns"/> diff --git a/sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql b/sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql index 5fb4ad24c2f..ce75f9372b6 100644 --- a/sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql +++ b/sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql @@ -461,6 +461,9 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1251'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1252'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1253'); INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1254'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1255'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1256'); +INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('1257'); INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, EXTERNAL_IDENTITY, EXTERNAL_IDENTITY_PROVIDER, USER_LOCAL, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT) VALUES (1, 'admin', 'Administrator', '', 'admin', 'sonarqube', true, 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '1418215735482', '1418215735482'); ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2; diff --git a/sonar-db/src/main/resources/org/sonar/db/version/schema-h2.ddl b/sonar-db/src/main/resources/org/sonar/db/version/schema-h2.ddl index c94c26a17fa..72e3aa398c7 100644 --- a/sonar-db/src/main/resources/org/sonar/db/version/schema-h2.ddl +++ b/sonar-db/src/main/resources/org/sonar/db/version/schema-h2.ddl @@ -217,6 +217,7 @@ CREATE TABLE "PROJECTS" ( "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "KEE" VARCHAR(400), "UUID" VARCHAR(50) NOT NULL, + "UUID_PATH" VARCHAR(4000) NOT NULL, "ROOT_UUID" VARCHAR(50) NOT NULL, "PROJECT_UUID" VARCHAR(50), "MODULE_UUID" VARCHAR(50), @@ -583,6 +584,8 @@ CREATE INDEX "SNAPSHOT_COMPONENT" ON "SNAPSHOTS" ("COMPONENT_UUID"); CREATE UNIQUE INDEX "ANALYSES_UUID" ON "SNAPSHOTS" ("UUID"); +CREATE INDEX "SNAPSHOTS_ROOT_COMPONENT" ON "SNAPSHOTS" ("ROOT_COMPONENT_UUID"); + CREATE INDEX "RULES_PARAMETERS_RULE_ID" ON "RULES_PARAMETERS" ("RULE_ID"); CREATE INDEX "ACTIVE_DASHBOARDS_DASHBOARDID" ON "ACTIVE_DASHBOARDS" ("DASHBOARD_ID"); @@ -647,8 +650,6 @@ CREATE UNIQUE INDEX "USERS_LOGIN" ON "USERS" ("LOGIN"); CREATE INDEX "USERS_UPDATED_AT" ON "USERS" ("UPDATED_AT"); -CREATE INDEX "SNAPSHOTS_ROOT_COMPONENT" ON "SNAPSHOTS" ("ROOT_COMPONENT_UUID"); - CREATE UNIQUE INDEX "UNIQ_GROUP_ROLES" ON "GROUP_ROLES" ("GROUP_ID", "RESOURCE_ID", "ROLE"); CREATE UNIQUE INDEX "RULES_REPO_KEY" ON "RULES" ("PLUGIN_NAME", "PLUGIN_RULE_KEY"); diff --git a/sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java b/sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java index 2acc84c106d..2dd1d5d229b 100644 --- a/sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java +++ b/sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java @@ -20,6 +20,7 @@ package org.sonar.db.component; import com.google.common.base.Optional; +import java.util.Arrays; import java.util.Collections; import java.util.List; import org.junit.Rule; @@ -48,11 +49,19 @@ import static org.sonar.db.component.ComponentTesting.newView; public class ComponentDaoTest { + private static final String PROJECT_UUID = "project-uuid"; + private static final String MODULE_UUID = "module-uuid"; + private static final String FILE_1_UUID = "file-1-uuid"; + private static final String FILE_2_UUID = "file-2-uuid"; + private static final String FILE_3_UUID = "file-3-uuid"; + private static final String A_VIEW_UUID = "view-uuid"; + @Rule public ExpectedException thrown = ExpectedException.none(); @Rule public DbTester db = DbTester.create(System2.INSTANCE); + ComponentDbTester componentDb = new ComponentDbTester(db); final DbSession dbSession = db.getSession(); @@ -63,19 +72,20 @@ public class ComponentDaoTest { public void get_by_uuid() { db.prepareDbUnit(getClass(), "shared.xml"); - ComponentDto result = underTest.selectByUuid(dbSession, "KLMN").get(); + ComponentDto result = underTest.selectByUuid(dbSession, "U1").get(); assertThat(result).isNotNull(); - assertThat(result.uuid()).isEqualTo("KLMN"); - assertThat(result.moduleUuid()).isEqualTo("EFGH"); - assertThat(result.moduleUuidPath()).isEqualTo(".ABCD.EFGH."); - assertThat(result.getRootUuid()).isEqualTo("EFGH"); - assertThat(result.projectUuid()).isEqualTo("ABCD"); - assertThat(result.key()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java"); - assertThat(result.path()).isEqualTo("src/org/struts/RequestContext.java"); - assertThat(result.name()).isEqualTo("RequestContext.java"); - assertThat(result.longName()).isEqualTo("org.struts.RequestContext"); - assertThat(result.qualifier()).isEqualTo("FIL"); - assertThat(result.scope()).isEqualTo("FIL"); + assertThat(result.uuid()).isEqualTo("U1"); + assertThat(result.getUuidPath()).isEqualTo("uuid_path_of_U1"); + assertThat(result.moduleUuid()).isEqualTo("module_uuid_of_U1"); + assertThat(result.moduleUuidPath()).isEqualTo("module_uuid_path_of_U1"); + assertThat(result.getRootUuid()).isEqualTo("root_uuid_of_U1"); + assertThat(result.projectUuid()).isEqualTo("project_uuid_of_U1"); + assertThat(result.key()).isEqualTo("org.struts:struts"); + assertThat(result.path()).isEqualTo("path_of_U1"); + assertThat(result.name()).isEqualTo("Struts"); + assertThat(result.longName()).isEqualTo("Apache Struts"); + assertThat(result.qualifier()).isEqualTo("TRK"); + assertThat(result.scope()).isEqualTo("PRJ"); assertThat(result.language()).isEqualTo("java"); assertThat(result.getCopyResourceUuid()).isNull(); assertThat(result.getDeveloperUuid()).isNull(); @@ -87,13 +97,13 @@ public class ComponentDaoTest { public void get_by_uuid_on_technical_project_copy() { db.prepareDbUnit(getClass(), "shared.xml"); - ComponentDto result = underTest.selectByUuid(dbSession, "STUV").get(); + ComponentDto result = underTest.selectByUuid(dbSession, "U7").get(); assertThat(result).isNotNull(); - assertThat(result.uuid()).isEqualTo("STUV"); - assertThat(result.moduleUuid()).isEqualTo("OPQR"); - assertThat(result.moduleUuidPath()).isEqualTo(".OPQR."); - assertThat(result.getRootUuid()).isEqualTo("OPQR"); - assertThat(result.projectUuid()).isEqualTo("OPQR"); + assertThat(result.uuid()).isEqualTo("U7"); + assertThat(result.moduleUuid()).isEqualTo("module_uuid_of_U7"); + assertThat(result.moduleUuidPath()).isEqualTo("module_uuid_path_of_U7"); + assertThat(result.getRootUuid()).isEqualTo("root_uuid_of_U7"); + assertThat(result.projectUuid()).isEqualTo("project_uuid_of_U7"); assertThat(result.key()).isEqualTo("DEV:anakin@skywalker.name:org.struts:struts"); assertThat(result.path()).isNull(); assertThat(result.name()).isEqualTo("Apache Struts"); @@ -101,29 +111,30 @@ public class ComponentDaoTest { assertThat(result.qualifier()).isEqualTo("DEV_PRJ"); assertThat(result.scope()).isEqualTo("PRJ"); assertThat(result.language()).isNull(); - assertThat(result.getCopyResourceUuid()).isEqualTo("ABCD"); - assertThat(result.getDeveloperUuid()).isEqualTo("OPQR"); + assertThat(result.getCopyResourceUuid()).isEqualTo("U1"); + assertThat(result.getDeveloperUuid()).isEqualTo("developer_uuid_of_U7"); } @Test - public void get_by_uuid_on_developer_project_copy() { + public void selectByUuidon_developer_project_copy() { db.prepareDbUnit(getClass(), "shared.xml"); - ComponentDto result = underTest.selectByUuid(dbSession, "STUV").get(); - assertThat(result.getDeveloperUuid()).isEqualTo("OPQR"); + ComponentDto result = underTest.selectByUuid(dbSession, "U7").get(); + assertThat(result.getDeveloperUuid()).isEqualTo("developer_uuid_of_U7"); } @Test - public void get_by_uuid_on_disabled_component() { + public void selectByUuid_on_disabled_component() { db.prepareDbUnit(getClass(), "shared.xml"); - ComponentDto result = underTest.selectByUuid(dbSession, "DCBA").get(); + ComponentDto result = underTest.selectByUuid(dbSession, "U5").get(); assertThat(result).isNotNull(); + assertThat(result.uuid()).isEqualTo("U5"); assertThat(result.isEnabled()).isFalse(); } @Test - public void fail_to_get_by_uuid_when_component_not_found() { + public void selectOrFailByUuid_fails_when_component_not_found() { thrown.expect(RowNotFoundException.class); db.prepareDbUnit(getClass(), "shared.xml"); @@ -132,7 +143,7 @@ public class ComponentDaoTest { } @Test - public void get_by_key() { + public void selectByKey() { db.prepareDbUnit(getClass(), "shared.xml"); Optional<ComponentDto> optional = underTest.selectByKey(dbSession, "org.struts:struts-core:src/org/struts/RequestContext.java"); @@ -140,20 +151,20 @@ public class ComponentDaoTest { ComponentDto result = optional.get(); assertThat(result.key()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java"); - assertThat(result.path()).isEqualTo("src/org/struts/RequestContext.java"); + assertThat(result.path()).isEqualTo("path_of_U4"); assertThat(result.name()).isEqualTo("RequestContext.java"); assertThat(result.longName()).isEqualTo("org.struts.RequestContext"); assertThat(result.qualifier()).isEqualTo("FIL"); assertThat(result.scope()).isEqualTo("FIL"); assertThat(result.language()).isEqualTo("java"); - assertThat(result.uuid()).isEqualTo("KLMN"); - assertThat(result.getRootUuid()).isEqualTo("EFGH"); + assertThat(result.uuid()).isEqualTo("U4"); + assertThat(result.getRootUuid()).isEqualTo("U1"); assertThat(underTest.selectByKey(dbSession, "unknown")).isAbsent(); } @Test - public void fail_to_get_by_key_when_component_not_found() { + public void selectOrFailByKey_fails_when_component_not_found() { thrown.expect(RowNotFoundException.class); db.prepareDbUnit(getClass(), "shared.xml"); @@ -175,16 +186,17 @@ public class ComponentDaoTest { ComponentDto result = underTest.selectOrFailByKey(dbSession, "org.struts:struts"); assertThat(result.key()).isEqualTo("org.struts:struts"); + assertThat(result.uuid()).isEqualTo("U1"); + assertThat(result.getUuidPath()).isEqualTo("uuid_path_of_U1"); assertThat(result.deprecatedKey()).isEqualTo("org.struts:struts"); - assertThat(result.path()).isNull(); + assertThat(result.path()).isEqualToIgnoringCase("path_of_U1"); assertThat(result.name()).isEqualTo("Struts"); assertThat(result.longName()).isEqualTo("Apache Struts"); assertThat(result.description()).isEqualTo("the description"); assertThat(result.qualifier()).isEqualTo("TRK"); assertThat(result.scope()).isEqualTo("PRJ"); - assertThat(result.language()).isNull(); - assertThat(result.getRootUuid()).isEqualTo("ABCD"); - assertThat(result.getAuthorizationUpdatedAt()).isEqualTo(123456789L); + assertThat(result.getRootUuid()).isEqualTo("root_uuid_of_U1"); + assertThat(result.getAuthorizationUpdatedAt()).isEqualTo(123_456_789L); } @Test @@ -197,13 +209,13 @@ public class ComponentDaoTest { ComponentDto result = results.get(0); assertThat(result).isNotNull(); assertThat(result.key()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java"); - assertThat(result.path()).isEqualTo("src/org/struts/RequestContext.java"); + assertThat(result.path()).isEqualTo("path_of_U4"); assertThat(result.name()).isEqualTo("RequestContext.java"); assertThat(result.longName()).isEqualTo("org.struts.RequestContext"); assertThat(result.qualifier()).isEqualTo("FIL"); assertThat(result.scope()).isEqualTo("FIL"); assertThat(result.language()).isEqualTo("java"); - assertThat(result.getRootUuid()).isEqualTo("EFGH"); + assertThat(result.getRootUuid()).isEqualTo("U1"); assertThat(underTest.selectByKeys(dbSession, singletonList("unknown"))).isEmpty(); } @@ -218,13 +230,13 @@ public class ComponentDaoTest { ComponentDto result = results.get(0); assertThat(result).isNotNull(); assertThat(result.key()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java"); - assertThat(result.path()).isEqualTo("src/org/struts/RequestContext.java"); + assertThat(result.path()).isEqualTo("path_of_U4"); assertThat(result.name()).isEqualTo("RequestContext.java"); assertThat(result.longName()).isEqualTo("org.struts.RequestContext"); assertThat(result.qualifier()).isEqualTo("FIL"); assertThat(result.scope()).isEqualTo("FIL"); assertThat(result.language()).isEqualTo("java"); - assertThat(result.getRootUuid()).isEqualTo("EFGH"); + assertThat(result.getRootUuid()).isEqualTo("U1"); assertThat(underTest.selectByIds(dbSession, newArrayList(555L))).isEmpty(); } @@ -233,18 +245,18 @@ public class ComponentDaoTest { public void get_by_uuids() { db.prepareDbUnit(getClass(), "shared.xml"); - List<ComponentDto> results = underTest.selectByUuids(dbSession, newArrayList("KLMN")); + List<ComponentDto> results = underTest.selectByUuids(dbSession, newArrayList("U4")); assertThat(results).hasSize(1); ComponentDto result = results.get(0); assertThat(result).isNotNull(); - assertThat(result.uuid()).isEqualTo("KLMN"); - assertThat(result.moduleUuid()).isEqualTo("EFGH"); - assertThat(result.moduleUuidPath()).isEqualTo(".ABCD.EFGH."); - assertThat(result.getRootUuid()).isEqualTo("EFGH"); - assertThat(result.projectUuid()).isEqualTo("ABCD"); + assertThat(result.uuid()).isEqualTo("U4"); + assertThat(result.moduleUuid()).isEqualTo("module_uuid_of_U4"); + assertThat(result.moduleUuidPath()).isEqualTo("module_uuid_path_of_U4"); + assertThat(result.getRootUuid()).isEqualTo("U1"); + assertThat(result.projectUuid()).isEqualTo("U1"); assertThat(result.key()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java"); - assertThat(result.path()).isEqualTo("src/org/struts/RequestContext.java"); + assertThat(result.path()).isEqualTo("path_of_U4"); assertThat(result.name()).isEqualTo("RequestContext.java"); assertThat(result.longName()).isEqualTo("org.struts.RequestContext"); assertThat(result.qualifier()).isEqualTo("FIL"); @@ -258,11 +270,12 @@ public class ComponentDaoTest { public void get_by_uuids_on_removed_components() { db.prepareDbUnit(getClass(), "shared.xml"); - List<ComponentDto> results = underTest.selectByUuids(dbSession, newArrayList("DCBA")); + List<ComponentDto> results = underTest.selectByUuids(dbSession, newArrayList("U5")); assertThat(results).hasSize(1); ComponentDto result = results.get(0); assertThat(result).isNotNull(); + assertThat(result.uuid()).isEqualTo("U5"); assertThat(result.isEnabled()).isFalse(); } @@ -270,10 +283,10 @@ public class ComponentDaoTest { public void select_existing_uuids() { db.prepareDbUnit(getClass(), "shared.xml"); - List<String> results = underTest.selectExistingUuids(dbSession, newArrayList("KLMN")); - assertThat(results).containsOnly("KLMN"); + List<String> results = underTest.selectExistingUuids(dbSession, newArrayList("U4")); + assertThat(results).containsOnly("U4"); - assertThat(underTest.selectExistingUuids(dbSession, newArrayList("KLMN", "unknown"))).hasSize(1); + assertThat(underTest.selectExistingUuids(dbSession, newArrayList("U4", "unknown"))).hasSize(1); assertThat(underTest.selectExistingUuids(dbSession, newArrayList("unknown"))).isEmpty(); } @@ -546,12 +559,12 @@ public class ComponentDaoTest { } @Test - public void selectResourcesByRootId() { + public void selectByProjectUuid() { db.prepareDbUnit(getClass(), "shared.xml"); - List<ComponentDto> resources = underTest.selectByProjectUuid("ABCD", dbSession); + List<ComponentDto> components = underTest.selectByProjectUuid("U1", dbSession); - assertThat(resources).extracting("id").containsOnly(1l, 2l, 3l, 4l); + assertThat(components).extracting("id").containsOnly(2l, 3l, 4l); } @Test @@ -560,6 +573,7 @@ public class ComponentDaoTest { ComponentDto componentDto = new ComponentDto() .setUuid("GHIJ") + .setUuidPath("ABCD.EFGH.GHIJ.") .setProjectUuid("ABCD") .setModuleUuid("EFGH") .setModuleUuidPath(".ABCD.EFGH.") @@ -593,6 +607,7 @@ public class ComponentDaoTest { ComponentDto componentDto = new ComponentDto() .setUuid("GHIJ") + .setUuidPath("ABCD.EFGH.GHIJ.") .setProjectUuid("ABCD") .setModuleUuid("EFGH") .setModuleUuidPath(".ABCD.EFGH.") @@ -627,6 +642,7 @@ public class ComponentDaoTest { ComponentDto componentDto = new ComponentDto() .setId(1L) .setUuid("GHIJ") + .setUuidPath("ABCD.EFGH.GHIJ.") .setProjectUuid("ABCD") .setModuleUuid("EFGH") .setModuleUuidPath(".ABCD.EFGH.") @@ -772,90 +788,106 @@ public class ComponentDaoTest { } @Test - public void select_direct_children_of_a_project() { - ComponentDto project = newProjectDto().setKey("project-key").setUuid("project-uuid"); + public void selectChildren() { + // project has 2 children: module and file 1. Other files are part of module. + ComponentDto project = newProjectDto(PROJECT_UUID); SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project); - SnapshotDto moduleSnapshot = componentDb.insertComponentAndSnapshot(newModuleDto("module-1-uuid", project), projectSnapshot); - componentDb.insertComponentAndSnapshot(newFileDto(project, "file-1-uuid"), projectSnapshot); - componentDb.insertComponentAndSnapshot(newFileDto(project, "file-2-uuid"), moduleSnapshot); + ComponentDto module = newModuleDto(MODULE_UUID, project); + SnapshotDto moduleSnapshot = componentDb.insertComponentAndSnapshot(module, projectSnapshot); + ComponentDto file1 = newFileDto(project, FILE_1_UUID).setKey("file-key-1").setName("File One"); + componentDb.insertComponentAndSnapshot(file1, projectSnapshot); + ComponentDto file2 = newFileDto(module, FILE_2_UUID).setKey("file-key-2").setName("File Two"); + componentDb.insertComponentAndSnapshot(file2, moduleSnapshot); + ComponentDto file3 = newFileDto(module, FILE_3_UUID).setKey("file-key-3").setName("File Three"); + componentDb.insertComponentAndSnapshot(file3, moduleSnapshot); db.commit(); componentDb.indexAllComponents(); - ComponentTreeQuery query = newTreeQuery(projectSnapshot).build(); - - List<ComponentDtoWithSnapshotId> result = underTest.selectDirectChildren(dbSession, query); - int count = underTest.countDirectChildren(dbSession, query); - - assertThat(count).isEqualTo(2); - assertThat(result).extracting("uuid").containsExactly("file-1-uuid", "module-1-uuid"); + // test children of root + ComponentTreeQuery query = newTreeQuery(PROJECT_UUID).build(); + List<ComponentDto> children = underTest.selectChildren(dbSession, query); + assertThat(children).extracting("uuid").containsExactly(FILE_1_UUID, MODULE_UUID); + assertThat(underTest.countChildren(dbSession, query)).isEqualTo(2); + + // test children of root, filtered by qualifier + query = newTreeQuery(PROJECT_UUID).setQualifiers(Arrays.asList(Qualifiers.MODULE)).build(); + children = underTest.selectChildren(dbSession, query); + assertThat(children).extracting("uuid").containsExactly(MODULE_UUID); + assertThat(underTest.countChildren(dbSession, query)).isEqualTo(1); + + // test children of intermediate component (module here), default ordering by + query = newTreeQuery(MODULE_UUID).build(); + assertThat(underTest.selectChildren(dbSession, query)).extracting("uuid").containsOnly(FILE_2_UUID, FILE_3_UUID); + assertThat(underTest.countChildren(dbSession, query)).isEqualTo(2); + + // test children of leaf component (file here) + query = newTreeQuery(FILE_1_UUID).build(); + assertThat(underTest.selectChildren(dbSession, query)).isEmpty(); + assertThat(underTest.countChildren(dbSession, query)).isEqualTo(0); + + // test children of root, matching name + query = newTreeQuery(PROJECT_UUID).setNameOrKeyQuery("One").build(); + assertThat(underTest.selectChildren(dbSession, query)).extracting("uuid").containsOnly(FILE_1_UUID); + assertThat(underTest.countChildren(dbSession, query)).isEqualTo(1); + + // test children of root, matching case-insensitive name + query = newTreeQuery(PROJECT_UUID).setNameOrKeyQuery("OnE").build(); + assertThat(underTest.selectChildren(dbSession, query)).extracting("uuid").containsOnly(FILE_1_UUID); + assertThat(underTest.countChildren(dbSession, query)).isEqualTo(1); + + // test children of root, matching key + query = newTreeQuery(PROJECT_UUID).setNameOrKeyQuery("file-key-1").build(); + assertThat(underTest.selectChildren(dbSession, query)).extracting("uuid").containsOnly(FILE_1_UUID); + assertThat(underTest.countChildren(dbSession, query)).isEqualTo(1); + + // test children of root, without matching name nor key + query = newTreeQuery(PROJECT_UUID).setNameOrKeyQuery("does-not-exist").build(); + assertThat(underTest.selectChildren(dbSession, query)).isEmpty(); + assertThat(underTest.countChildren(dbSession, query)).isEqualTo(0); + + // test children of intermediate component (module here), matching name + query = newTreeQuery(MODULE_UUID).setNameOrKeyQuery("Two").build(); + assertThat(underTest.selectChildren(dbSession, query)).extracting("uuid").containsOnly(FILE_2_UUID); + assertThat(underTest.countChildren(dbSession, query)).isEqualTo(1); + + // test children of intermediate component (module here), without matching name + query = newTreeQuery(MODULE_UUID).setNameOrKeyQuery("does-not-exist").build(); + assertThat(underTest.selectChildren(dbSession, query)).isEmpty(); + assertThat(underTest.countChildren(dbSession, query)).isEqualTo(0); + + // test children of leaf component (file here) + query = newTreeQuery(FILE_1_UUID).build(); + assertThat(underTest.selectChildren(dbSession, query)).isEmpty(); + assertThat(underTest.countChildren(dbSession, query)).isEqualTo(0); + + // test children of leaf component (file here), matching name + query = newTreeQuery(FILE_1_UUID).setNameOrKeyQuery("Foo").build(); + assertThat(underTest.selectChildren(dbSession, query)).isEmpty(); + assertThat(underTest.countChildren(dbSession, query)).isEqualTo(0); } @Test - public void select_direct_children_with_name_query() { - ComponentDto project = newProjectDto().setKey("project-key").setUuid("project-uuid"); - SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project); - SnapshotDto moduleSnapshot = componentDb.insertComponentAndSnapshot(newModuleDto("module-1-uuid", project), projectSnapshot); - componentDb.insertComponentAndSnapshot(newFileDto(project, "file-1-uuid").setName("file-name-1"), projectSnapshot); - componentDb.insertComponentAndSnapshot(newFileDto(project, "file-2-uuid").setName("file-name-2"), moduleSnapshot); - db.commit(); - componentDb.indexAllComponents(); - - ComponentTreeQuery query = newTreeQuery(projectSnapshot) - .setNameOrKeyQuery("file-name").build(); - - List<ComponentDtoWithSnapshotId> result = underTest.selectDirectChildren(dbSession, query); - int count = underTest.countDirectChildren(dbSession, query); - - assertThat(count).isEqualTo(1); - assertThat(result).extracting("uuid").containsExactly("file-1-uuid"); - } - - @Test - public void select_direct_children_with_key_query() { - ComponentDto project = newProjectDto().setKey("project-key").setUuid("project-uuid"); - SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project); - SnapshotDto moduleSnapshot = componentDb.insertComponentAndSnapshot(newModuleDto("module-1-uuid", project), projectSnapshot); - componentDb.insertComponentAndSnapshot(newFileDto(project, "file-1-uuid").setKey("file-key-1").setName("File one"), projectSnapshot); - componentDb.insertComponentAndSnapshot(newFileDto(project, "file-2-uuid").setKey("file-key-2").setName("File two"), moduleSnapshot); - db.commit(); - componentDb.indexAllComponents(); - - ComponentTreeQuery query = newTreeQuery(projectSnapshot) - .setNameOrKeyQuery("file-key-1").build(); - - List<ComponentDtoWithSnapshotId> result = underTest.selectDirectChildren(dbSession, query); - int count = underTest.countDirectChildren(dbSession, query); - - assertThat(count).isEqualTo(1); - assertThat(result).extracting("uuid").containsExactly("file-1-uuid"); - } - - @Test - public void select_direct_children_with_pagination() { - ComponentDto project = newProjectDto().setKey("project-key").setUuid("project-uuid"); + public void selectChildren_with_pagination() { + ComponentDto project = newProjectDto(PROJECT_UUID); SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project); for (int i = 1; i <= 9; i++) { componentDb.insertComponentAndSnapshot(newFileDto(project, "file-uuid-" + i), projectSnapshot); } db.commit(); - componentDb.indexAllComponents(); - ComponentTreeQuery query = newTreeQuery(projectSnapshot) + ComponentTreeQuery query = newTreeQuery(PROJECT_UUID) .setPage(2) .setPageSize(3) .setAsc(false) .build(); - List<ComponentDtoWithSnapshotId> result = underTest.selectDirectChildren(dbSession, query); - int count = underTest.countDirectChildren(dbSession, query); - - assertThat(count).isEqualTo(9); - assertThat(result).extracting("uuid").containsExactly("file-uuid-6", "file-uuid-5", "file-uuid-4"); + assertThat(underTest.selectChildren(dbSession, query)).extracting("uuid").containsExactly("file-uuid-6", "file-uuid-5", "file-uuid-4"); + assertThat(underTest.countChildren(dbSession, query)).isEqualTo(9); } @Test - public void select_direct_children_with_order_by_path() { - ComponentDto project = newProjectDto(); + public void selectChildren_ordered_by_file_path() { + ComponentDto project = newProjectDto(PROJECT_UUID); SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project); componentDb.insertComponentAndSnapshot(newFileDto(project, "file-uuid-1").setName("file-name-1").setPath("3"), projectSnapshot); componentDb.insertComponentAndSnapshot(newFileDto(project, "file-uuid-2").setName("file-name-2").setPath("2"), projectSnapshot); @@ -863,93 +895,128 @@ public class ComponentDaoTest { db.commit(); componentDb.indexAllComponents(); - ComponentTreeQuery query = newTreeQuery(projectSnapshot) + ComponentTreeQuery query = newTreeQuery(PROJECT_UUID) .setSortFields(singletonList("path")) .setAsc(true) .build(); - List<ComponentDtoWithSnapshotId> result = underTest.selectDirectChildren(dbSession, query); - + List<ComponentDto> result = underTest.selectChildren(dbSession, query); assertThat(result).extracting("uuid").containsExactly("file-uuid-3", "file-uuid-2", "file-uuid-1"); } @Test - public void select_direct_children_of_a_module() { - ComponentDto project = newProjectDto(); - SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project); - SnapshotDto moduleSnapshot = componentDb.insertComponentAndSnapshot(newModuleDto("module-1-uuid", project), projectSnapshot); - componentDb.insertComponentAndSnapshot(newFileDto(project, "file-1-uuid"), projectSnapshot); - componentDb.insertComponentAndSnapshot(newFileDto(project, "file-2-uuid"), moduleSnapshot); - db.commit(); - componentDb.indexAllComponents(); - - ComponentTreeQuery query = newTreeQuery(moduleSnapshot).build(); + public void selectChildren_returns_empty_list_if_base_component_does_not_exist() { + ComponentTreeQuery query = newTreeQuery(PROJECT_UUID).build(); - List<ComponentDtoWithSnapshotId> result = underTest.selectDirectChildren(dbSession, query); - - assertThat(result).extracting("uuid").containsOnly("file-2-uuid"); - } - - @Test - public void select_all_children_of_a_project() { - ComponentDto project = newProjectDto().setKey("project-key").setUuid("project-uuid"); - SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project); - SnapshotDto moduleSnapshot = componentDb.insertComponentAndSnapshot(newModuleDto("module-1-uuid", project), projectSnapshot); - componentDb.insertComponentAndSnapshot(newFileDto(project, "file-1-uuid"), projectSnapshot); - componentDb.insertComponentAndSnapshot(newFileDto(project, "file-2-uuid"), moduleSnapshot); - db.commit(); - componentDb.indexAllComponents(); - - ComponentTreeQuery query = newTreeQuery(projectSnapshot).build(); - - List<ComponentDtoWithSnapshotId> result = underTest.selectAllChildren(dbSession, query); - int count = underTest.countAllChildren(dbSession, query); - - assertThat(count).isEqualTo(3); - assertThat(result).extracting("uuid").containsExactly("file-1-uuid", "file-2-uuid", "module-1-uuid"); + List<ComponentDto> result = underTest.selectChildren(dbSession, query); + assertThat(result).isEmpty(); } @Test - public void list_direct_children_of_a_view() { - ComponentDto view = newView("view-uuid"); + public void selectChildren_of_a_view() { + ComponentDto view = newView(A_VIEW_UUID); SnapshotDto viewSnapshot = componentDb.insertViewAndSnapshot(view); // one subview ComponentDto subView = newSubView(view, "subview-uuid", "subview-key").setName("subview-name"); componentDb.insertComponentAndSnapshot(subView, viewSnapshot); // one project and its copy linked to the view - ComponentDto project = newProjectDto("project-uuid").setName("project-name"); + ComponentDto project = newProjectDto(PROJECT_UUID).setName("project-name"); componentDb.insertProjectAndSnapshot(project); componentDb.insertComponentAndSnapshot(newProjectCopy("project-copy-uuid", project, view), viewSnapshot); componentDb.indexAllComponents(); - ComponentTreeQuery dbQuery = newTreeQuery(viewSnapshot).build(); - - List<ComponentDtoWithSnapshotId> components = underTest.selectDirectChildren(dbSession, dbQuery); + ComponentTreeQuery query = newTreeQuery(A_VIEW_UUID).build(); + List<ComponentDto> components = underTest.selectChildren(dbSession, query); assertThat(components).extracting("uuid").containsOnly("project-copy-uuid", "subview-uuid"); } @Test - public void search_direct_children_of_a_view() { - ComponentDto view = newView("view-uuid"); + public void selectChildren_of_a_view_and_filter_by_name() { + ComponentDto view = newView(A_VIEW_UUID); SnapshotDto viewSnapshot = componentDb.insertViewAndSnapshot(view); // one subview ComponentDto subView = newSubView(view, "subview-uuid", "subview-key").setName("subview name"); componentDb.insertComponentAndSnapshot(subView, viewSnapshot); // one project and its copy linked to the view - ComponentDto project = newProjectDto("project-uuid").setName("project name"); + ComponentDto project = newProjectDto(PROJECT_UUID).setName("project name"); componentDb.insertProjectAndSnapshot(project); componentDb.insertComponentAndSnapshot(newProjectCopy("project-copy-uuid", project, view), viewSnapshot); componentDb.indexAllComponents(); - ComponentTreeQuery dbQuery = newTreeQuery(viewSnapshot).setNameOrKeyQuery("name").build(); - - List<ComponentDtoWithSnapshotId> components = underTest.selectDirectChildren(dbSession, dbQuery); + ComponentTreeQuery dbQuery = newTreeQuery(A_VIEW_UUID).setNameOrKeyQuery("name").build(); + List<ComponentDto> components = underTest.selectChildren(dbSession, dbQuery); assertThat(components).extracting("uuid").containsOnly("project-copy-uuid", "subview-uuid"); } @Test - public void select_all_files_of_a_project_paginated_and_ordered() { - ComponentDto project = newProjectDto().setKey("project-key").setUuid("project-uuid"); + public void selectParent() { + // project -> module -> file + ComponentDto project = newProjectDto(PROJECT_UUID); + SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project); + ComponentDto module = newModuleDto(MODULE_UUID, project); + SnapshotDto moduleSnapshot = componentDb.insertComponentAndSnapshot(module, projectSnapshot); + ComponentDto file = newFileDto(module, FILE_1_UUID); + componentDb.insertComponentAndSnapshot(file, moduleSnapshot); + db.commit(); + + assertThat(underTest.selectParent(dbSession, project)).isAbsent(); + assertThat(underTest.selectParent(dbSession, module).get().uuid()).isEqualTo(PROJECT_UUID); + assertThat(underTest.selectParent(dbSession, file).get().uuid()).isEqualTo(MODULE_UUID); + } + + @Test + public void selectAncestors() { + // project -> module -> file + ComponentDto project = newProjectDto(PROJECT_UUID); + SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project); + ComponentDto module = newModuleDto(MODULE_UUID, project); + SnapshotDto moduleSnapshot = componentDb.insertComponentAndSnapshot(module, projectSnapshot); + ComponentDto file = newFileDto(module, FILE_1_UUID); + componentDb.insertComponentAndSnapshot(file, moduleSnapshot); + db.commit(); + + // ancestors of root + List<ComponentDto> ancestors = underTest.selectAncestors(dbSession, project); + assertThat(ancestors).isEmpty(); + + // ancestors of module + ancestors = underTest.selectAncestors(dbSession, module); + assertThat(ancestors).extracting("uuid").containsExactly(PROJECT_UUID); + + // ancestors of file + ancestors = underTest.selectAncestors(dbSession, file); + assertThat(ancestors).extracting("uuid").containsExactly(PROJECT_UUID, MODULE_UUID); + } + + @Test + public void selectDescendants() { + ComponentDto project = newProjectDto(PROJECT_UUID); + SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project); + SnapshotDto moduleSnapshot = componentDb.insertComponentAndSnapshot(newModuleDto("module-1-uuid", project), projectSnapshot); + componentDb.insertComponentAndSnapshot(newFileDto(project, "file-1-uuid"), projectSnapshot); + componentDb.insertComponentAndSnapshot(newFileDto(project, "file-2-uuid"), moduleSnapshot); + db.commit(); + componentDb.indexAllComponents(); + + ComponentTreeQuery query = newTreeQuery(PROJECT_UUID).build(); + + List<ComponentDto> result = underTest.selectDescendants(dbSession, query); + assertThat(result).extracting("uuid").containsExactly("file-1-uuid", "file-2-uuid", "module-1-uuid"); + int count = underTest.countDescendants(dbSession, query); + assertThat(count).isEqualTo(3); + } + + @Test + public void selectDescendants_returns_empty_list_if_base_component_does_not_exist() { + ComponentTreeQuery query = newTreeQuery(PROJECT_UUID).build(); + + List<ComponentDto> result = underTest.selectDescendants(dbSession, query); + assertThat(result).isEmpty(); + } + + @Test + public void selectDescendants_of_a_project_paginated_and_ordered() { + ComponentDto project = newProjectDto(PROJECT_UUID).setKey("project-key"); SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project); SnapshotDto moduleSnapshot = componentDb.insertComponentAndSnapshot(newModuleDto("module-1-uuid", project), projectSnapshot); componentDb.insertComponentAndSnapshot(newFileDto(project, "file-uuid-1").setName("file-name-1"), projectSnapshot); @@ -960,7 +1027,7 @@ public class ComponentDaoTest { db.commit(); componentDb.indexAllComponents(); - ComponentTreeQuery query = newTreeQuery(projectSnapshot) + ComponentTreeQuery query = newTreeQuery(PROJECT_UUID) .setQualifiers(newArrayList(Qualifiers.FILE)) .setPage(2) .setPageSize(3) @@ -969,18 +1036,18 @@ public class ComponentDaoTest { .setAsc(false) .build(); - List<ComponentDtoWithSnapshotId> result = underTest.selectAllChildren(dbSession, query); - int count = underTest.countAllChildren(dbSession, query); + List<ComponentDto> result = underTest.selectDescendants(dbSession, query); + int count = underTest.countDescendants(dbSession, query); assertThat(count).isEqualTo(9); assertThat(result).extracting("uuid").containsExactly("file-uuid-6", "file-uuid-5", "file-uuid-4"); } - private static ComponentTreeQuery.Builder newTreeQuery(SnapshotDto baseSnapshot) { + private static ComponentTreeQuery.Builder newTreeQuery(String baseUuid) { return ComponentTreeQuery.builder() .setPage(1) .setPageSize(500) - .setBaseSnapshot(baseSnapshot) + .setBaseUuid(baseUuid) .setSortFields(singletonList("name")) .setAsc(true); } diff --git a/sonar-db/src/test/java/org/sonar/db/component/ComponentDtoTest.java b/sonar-db/src/test/java/org/sonar/db/component/ComponentDtoTest.java index 09b1ffc597b..d8e9de2e54b 100644 --- a/sonar-db/src/test/java/org/sonar/db/component/ComponentDtoTest.java +++ b/sonar-db/src/test/java/org/sonar/db/component/ComponentDtoTest.java @@ -63,17 +63,17 @@ public class ComponentDtoTest { @Test public void equals_and_hashcode() { - ComponentDto dto = new ComponentDto().setId(1L); - ComponentDto dtoWithSameId = new ComponentDto().setId(1L); - ComponentDto dtoWithDifferentId = new ComponentDto().setId(2L); + ComponentDto dto = new ComponentDto().setUuid("u1"); + ComponentDto dtoWithSameUuid = new ComponentDto().setUuid("u1"); + ComponentDto dtoWithDifferentUuid = new ComponentDto().setUuid("u2"); assertThat(dto).isEqualTo(dto); - assertThat(dto).isEqualTo(dtoWithSameId); - assertThat(dto).isNotEqualTo(dtoWithDifferentId); + assertThat(dto).isEqualTo(dtoWithSameUuid); + assertThat(dto).isNotEqualTo(dtoWithDifferentUuid); assertThat(dto.hashCode()).isEqualTo(dto.hashCode()); - assertThat(dto.hashCode()).isEqualTo(dtoWithSameId.hashCode()); - assertThat(dto.hashCode()).isNotEqualTo(dtoWithDifferentId.hashCode()); + assertThat(dto.hashCode()).isEqualTo(dtoWithSameUuid.hashCode()); + assertThat(dto.hashCode()).isNotEqualTo(dtoWithDifferentUuid.hashCode()); } @Test @@ -88,4 +88,19 @@ public class ComponentDtoTest { assertThat(new ComponentDto().setModuleUuid("ABCD").setScope(Scopes.DIRECTORY).isRootProject()).isFalse(); assertThat(new ComponentDto().setModuleUuid(null).setScope(Scopes.PROJECT).setQualifier(Qualifiers.PROJECT).isRootProject()).isTrue(); } + + @Test + public void test_formatUuidPathFromParent() { + ComponentDto parent = ComponentTesting.newProjectDto("123").setUuidPath(ComponentDto.UUID_PATH_OF_ROOT); + assertThat(ComponentDto.formatUuidPathFromParent(parent)).isEqualTo(".123."); + } + + @Test + public void test_Name() { + ComponentDto root = new ComponentDto().setUuidPath(ComponentDto.UUID_PATH_OF_ROOT); + assertThat(root.getUuidPathAsList()).isEmpty(); + + ComponentDto nonRoot = new ComponentDto().setUuidPath(".12.34.56."); + assertThat(nonRoot.getUuidPathAsList()).containsExactly("12", "34", "56"); + } } diff --git a/sonar-db/src/test/java/org/sonar/db/component/ComponentTesting.java b/sonar-db/src/test/java/org/sonar/db/component/ComponentTesting.java index cc5904b0b5e..3d80147a92b 100644 --- a/sonar-db/src/test/java/org/sonar/db/component/ComponentTesting.java +++ b/sonar-db/src/test/java/org/sonar/db/component/ComponentTesting.java @@ -25,7 +25,7 @@ import org.sonar.api.resources.Scopes; import org.sonar.core.util.Uuids; import static com.google.common.base.Preconditions.checkNotNull; -import static org.sonar.db.component.ComponentDto.MODULE_UUID_PATH_SEP; +import static org.sonar.db.component.ComponentDto.UUID_PATH_SEPARATOR; public class ComponentTesting { @@ -69,9 +69,9 @@ public class ComponentTesting { .setQualifier(Qualifiers.SUBVIEW); } - public static ComponentDto newModuleDto(String uuid, ComponentDto subProjectOrProject) { - return newChildComponent(uuid, subProjectOrProject) - .setModuleUuidPath(subProjectOrProject.moduleUuidPath() + uuid + MODULE_UUID_PATH_SEP) + public static ComponentDto newModuleDto(String uuid, ComponentDto parentModuleOrProject) { + return newChildComponent(uuid, parentModuleOrProject) + .setModuleUuidPath(parentModuleOrProject.moduleUuidPath() + uuid + UUID_PATH_SEPARATOR) .setKey("KEY_" + uuid) .setName("NAME_" + uuid) .setLongName("LONG_NAME_" + uuid) @@ -92,8 +92,9 @@ public class ComponentTesting { public static ComponentDto newProjectDto(String uuid) { return new ComponentDto() .setUuid(uuid) + .setUuidPath(ComponentDto.UUID_PATH_OF_ROOT) .setProjectUuid(uuid) - .setModuleUuidPath(MODULE_UUID_PATH_SEP + uuid + MODULE_UUID_PATH_SEP) + .setModuleUuidPath(UUID_PATH_SEPARATOR + uuid + UUID_PATH_SEPARATOR) .setRootUuid(uuid) .setKey("KEY_" + uuid) .setName("NAME_" + uuid) @@ -109,8 +110,9 @@ public class ComponentTesting { String uuid = Uuids.create(); return new ComponentDto() .setUuid(uuid) + .setUuidPath(ComponentDto.UUID_PATH_OF_ROOT) .setProjectUuid(uuid) - .setModuleUuidPath(MODULE_UUID_PATH_SEP + uuid + MODULE_UUID_PATH_SEP) + .setModuleUuidPath(UUID_PATH_SEPARATOR + uuid + UUID_PATH_SEPARATOR) .setRootUuid(uuid) .setKey(uuid) .setName(name) @@ -123,6 +125,24 @@ public class ComponentTesting { .setEnabled(true); } + public static ComponentDto newDeveloper(String name, String uuid) { + return new ComponentDto() + .setUuid(uuid) + .setUuidPath(ComponentDto.UUID_PATH_OF_ROOT) + .setProjectUuid(uuid) + .setModuleUuidPath(UUID_PATH_SEPARATOR + uuid + UUID_PATH_SEPARATOR) + .setRootUuid(uuid) + .setKey(uuid) + .setName(name) + .setLongName(name) + .setScope(Scopes.PROJECT) + // XXX No constant ! + .setQualifier("DEV") + .setPath(null) + .setLanguage(null) + .setEnabled(true); + } + public static ComponentDto newView(String uuid) { return newProjectDto(uuid) .setUuid(uuid) @@ -162,13 +182,14 @@ public class ComponentTesting { .setLanguage(null); } - private static ComponentDto newChildComponent(String uuid, ComponentDto module) { + public static ComponentDto newChildComponent(String uuid, ComponentDto parent) { return new ComponentDto() .setUuid(uuid) - .setProjectUuid(module.projectUuid()) - .setModuleUuid(module.uuid()) - .setModuleUuidPath(module.moduleUuidPath()) - .setRootUuid(module.uuid()) + .setUuidPath(ComponentDto.formatUuidPathFromParent(parent)) + .setProjectUuid(parent.projectUuid()) + .setRootUuid(parent.uuid()) + .setModuleUuid(parent.uuid()) + .setModuleUuidPath(parent.moduleUuidPath()) .setCreatedAt(new Date()) .setEnabled(true); } diff --git a/sonar-db/src/test/java/org/sonar/db/component/ComponentTreeQueryTest.java b/sonar-db/src/test/java/org/sonar/db/component/ComponentTreeQueryTest.java index ed24c6fab44..44795f230a0 100644 --- a/sonar-db/src/test/java/org/sonar/db/component/ComponentTreeQueryTest.java +++ b/sonar-db/src/test/java/org/sonar/db/component/ComponentTreeQueryTest.java @@ -29,13 +29,15 @@ import static org.assertj.core.api.Assertions.assertThat; public class ComponentTreeQueryTest { + private static final String AN_UUID = "u1"; + @Rule public ExpectedException expectedException = ExpectedException.none(); @Test public void convert_sorts_in_sql_representation() { ComponentTreeQuery result = ComponentTreeQuery.builder() - .setBaseSnapshot(new SnapshotDto()) + .setBaseUuid(AN_UUID) .setSortFields(newArrayList("name", "path", "qualifier")) .build(); @@ -43,7 +45,7 @@ public class ComponentTreeQueryTest { } @Test - public void fail_if_no_base_snapshot() { + public void fail_if_no_base_uuid() { expectedException.expect(NullPointerException.class); ComponentTreeQuery.builder() @@ -56,7 +58,7 @@ public class ComponentTreeQueryTest { expectedException.expect(NullPointerException.class); ComponentTreeQuery.builder() - .setBaseSnapshot(new SnapshotDto()) + .setBaseUuid(AN_UUID) .build(); } } 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 61b0c00cf17..43faf115245 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 @@ -147,7 +147,14 @@ public class ResourceIndexDaoTest { @Test public void restrict_indexed_combinations_to_400_characters() { String longName = repeat("a", 2_000); - ComponentDto project = new ComponentDto().setUuid(ROOT_UUID).setRootUuid(ROOT_UUID).setKey("the_key").setName(longName).setScope(Scopes.PROJECT).setQualifier(Qualifiers.PROJECT); + ComponentDto project = new ComponentDto() + .setUuid(ROOT_UUID) + .setRootUuid(ROOT_UUID) + .setUuidPath(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() diff --git a/sonar-db/src/test/java/org/sonar/db/measure/MeasureDaoTest.java b/sonar-db/src/test/java/org/sonar/db/measure/MeasureDaoTest.java index fdc2ab7ccec..f2c43e9515c 100644 --- a/sonar-db/src/test/java/org/sonar/db/measure/MeasureDaoTest.java +++ b/sonar-db/src/test/java/org/sonar/db/measure/MeasureDaoTest.java @@ -341,9 +341,9 @@ public class MeasureDaoTest { SnapshotDto developerSnapshot = componentDb.insertDeveloperAndSnapshot(developer); componentDb.insertComponentAndSnapshot(newDevProjectCopy("project-copy-uuid", project, developer), developerSnapshot); underTest.insert(dbSession, - newMeasureDto(metric, developerSnapshot.getId()).setDeveloperId(developer.getId()), - newMeasureDto(metric, projectSnapshot.getId()), - newMeasureDto(metric, fileSnapshot.getId())); + newMeasureDto(metric, developerSnapshot).setDeveloperId(developer.getId()), + newMeasureDto(metric, projectSnapshot), + newMeasureDto(metric, fileSnapshot)); dbSession.commit(); List<MeasureDto> result = underTest.selectBySnapshotIdsAndMetricIds(dbSession, @@ -368,10 +368,10 @@ public class MeasureDaoTest { componentDb.insertComponentAndSnapshot(newDevProjectCopy("project-copy-uuid", project, developer), developerSnapshot); underTest.insert(dbSession, - newMeasureDto(metric, developerSnapshot.getId()).setDeveloperId(developer.getId()), - newMeasureDto(metric, projectSnapshot.getId()).setDeveloperId(developer.getId()), - newMeasureDto(metric, projectSnapshot.getId()).setDeveloperId(null), - newMeasureDto(metric, fileSnapshot.getId()).setDeveloperId(developer.getId())); + newMeasureDto(metric, developerSnapshot).setDeveloperId(developer.getId()), + newMeasureDto(metric, projectSnapshot).setDeveloperId(developer.getId()), + newMeasureDto(metric, projectSnapshot).setDeveloperId(null), + newMeasureDto(metric, fileSnapshot).setDeveloperId(developer.getId())); dbSession.commit(); List<MeasureDto> result = underTest.selectByDeveloperAndSnapshotIdsAndMetricIds(dbSession, diff --git a/sonar-db/src/test/java/org/sonar/db/measure/MeasureTesting.java b/sonar-db/src/test/java/org/sonar/db/measure/MeasureTesting.java index f77c8be5fb8..fcecfd476b5 100644 --- a/sonar-db/src/test/java/org/sonar/db/measure/MeasureTesting.java +++ b/sonar-db/src/test/java/org/sonar/db/measure/MeasureTesting.java @@ -19,20 +19,24 @@ */ package org.sonar.db.measure; -import org.apache.commons.lang.RandomStringUtils; -import org.sonar.core.util.Uuids; +import org.sonar.db.component.SnapshotDto; import org.sonar.db.metric.MetricDto; +import static com.google.common.base.Preconditions.checkNotNull; + public class MeasureTesting { private MeasureTesting() { // static methods only } - public static MeasureDto newMeasureDto(MetricDto metricDto, long snapshotId) { + public static MeasureDto newMeasureDto(MetricDto metricDto, SnapshotDto snapshot) { + checkNotNull(metricDto.getId()); + checkNotNull(metricDto.getKey()); + checkNotNull(snapshot.getComponentUuid()); return new MeasureDto() .setMetricId(metricDto.getId()) .setMetricKey(metricDto.getKey()) - .setComponentUuid(RandomStringUtils.randomAlphanumeric(Uuids.MAX_LENGTH)) - .setSnapshotId(snapshotId); + .setComponentUuid(snapshot.getComponentUuid()) + .setSnapshotId(snapshot.getId()); } } diff --git a/sonar-db/src/test/java/org/sonar/db/version/MigrationStepModuleTest.java b/sonar-db/src/test/java/org/sonar/db/version/MigrationStepModuleTest.java index be2e9aab823..a4d75a54649 100644 --- a/sonar-db/src/test/java/org/sonar/db/version/MigrationStepModuleTest.java +++ b/sonar-db/src/test/java/org/sonar/db/version/MigrationStepModuleTest.java @@ -29,6 +29,6 @@ public class MigrationStepModuleTest { public void verify_count_of_added_MigrationStep_types() { ComponentContainer container = new ComponentContainer(); new MigrationStepModule().configure(container); - assertThat(container.size()).isEqualTo(110); + assertThat(container.size()).isEqualTo(113); } } diff --git a/sonar-db/src/test/java/org/sonar/db/version/v60/PopulateUuidPathColumnOnProjectsTest.java b/sonar-db/src/test/java/org/sonar/db/version/v60/PopulateUuidPathColumnOnProjectsTest.java new file mode 100644 index 00000000000..6151dbf75bc --- /dev/null +++ b/sonar-db/src/test/java/org/sonar/db/version/v60/PopulateUuidPathColumnOnProjectsTest.java @@ -0,0 +1,157 @@ +/* + * 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.version.v60; + +import java.sql.SQLException; +import java.util.Map; +import org.junit.Rule; +import org.junit.Test; +import org.sonar.api.utils.System2; +import org.sonar.db.DbTester; + +import static java.lang.String.format; +import static org.assertj.core.api.Assertions.assertThat; + +public class PopulateUuidPathColumnOnProjectsTest { + + private static final String TABLE_PROJECTS = "projects"; + private static final String TABLE_SNAPSHOTS = "snapshots"; + private static final String A_PROJECT_UUID = "U_PRJ"; + private static final String A_MODULE_UUID = "U_MOD"; + private static final String A_DIR_UUID = "U_DIR"; + private static final String A_FILE_UUID = "U_FIL"; + + @Rule + public DbTester db = DbTester.createForSchema(System2.INSTANCE, PopulateUuidPathColumnOnProjectsTest.class, + "in_progress_projects_and_snapshots.sql"); + + private PopulateUuidPathColumnOnProjects underTest = new PopulateUuidPathColumnOnProjects(db.database()); + + @Test + public void has_no_effect_on_empty_tables() throws SQLException { + underTest.execute(); + + assertThat(db.countRowsOfTable(TABLE_PROJECTS)).isEqualTo(0); + } + + @Test + public void migrates_provisioned_projects() throws SQLException { + insert(A_PROJECT_UUID, A_PROJECT_UUID); + + underTest.execute(); + + verifyPath(A_PROJECT_UUID, "."); + } + + @Test + public void migrates_projects_without_modules() throws SQLException { + insert(A_PROJECT_UUID, A_PROJECT_UUID, new Snapshot(1L, "", true)); + insert(A_DIR_UUID, A_PROJECT_UUID, new Snapshot(2L, "1.", true)); + insert(A_FILE_UUID, A_PROJECT_UUID, new Snapshot(3L, "1.2.", true)); + + underTest.execute(); + + verifyPath(A_PROJECT_UUID, "."); + verifyPath(A_DIR_UUID, format("%s.", A_PROJECT_UUID)); + verifyPath(A_FILE_UUID, format("%s.%s.", A_PROJECT_UUID, A_DIR_UUID)); + } + + @Test + public void migrates_projects_with_modules() throws SQLException { + insert(A_PROJECT_UUID, A_PROJECT_UUID, new Snapshot(1L, "", true)); + insert(A_MODULE_UUID, A_PROJECT_UUID, new Snapshot(2L, "1.", true)); + insert(A_DIR_UUID, A_PROJECT_UUID, new Snapshot(3L, "1.2.", true)); + insert(A_FILE_UUID, A_PROJECT_UUID, new Snapshot(4L, "1.2.3.", true)); + + underTest.execute(); + + verifyPath(A_PROJECT_UUID, "."); + verifyPath(A_MODULE_UUID, format("%s.", A_PROJECT_UUID)); + verifyPath(A_DIR_UUID, format("%s.%s.", A_PROJECT_UUID, A_MODULE_UUID)); + verifyPath(A_FILE_UUID, format("%s.%s.%s.", A_PROJECT_UUID, A_MODULE_UUID, A_DIR_UUID)); + } + + @Test + public void migrates_components_without_snapshot_path() throws SQLException { + // these components do not have snapshots + insert(A_DIR_UUID, A_PROJECT_UUID); + insert(A_FILE_UUID, A_PROJECT_UUID); + + underTest.execute(); + + verifyPath(A_DIR_UUID, format("%s.", A_PROJECT_UUID)); + verifyPath(A_FILE_UUID, format("%s.", A_PROJECT_UUID)); + } + + @Test + public void migration_is_reentrant() throws SQLException { + insert(A_PROJECT_UUID, A_PROJECT_UUID, new Snapshot(1L, "", true)); + insert(A_DIR_UUID, A_PROJECT_UUID, new Snapshot(2L, "1.", true)); + insert(A_FILE_UUID, A_PROJECT_UUID, new Snapshot(3L, "1.2.", true)); + + underTest.execute(); + verifyNoNullPath(); + + underTest.execute(); + verifyNoNullPath(); + } + + private void insert(String uuid, String rootUuid, Snapshot... snapshots) { + db.executeInsert( + TABLE_PROJECTS, + "uuid", uuid, + "project_uuid", rootUuid, + "root_uuid", rootUuid); + + for (Snapshot snapshot : snapshots) { + db.executeInsert( + TABLE_SNAPSHOTS, + "id", String.valueOf(snapshot.id), + "uuid", "u" + snapshot.id, + "path", snapshot.idPath, + "islast", String.valueOf(snapshot.isLast), + "component_uuid", uuid, + "root_component_uuid", rootUuid + ); + } + db.commit(); + } + + private void verifyPath(String componentUuid, String expectedUuidPath) { + Map<String, Object> row = db.selectFirst("select uuid_path from projects where uuid='" + componentUuid + "'"); + assertThat(row.get("UUID_PATH")).isEqualTo(expectedUuidPath); + } + + private void verifyNoNullPath() { + assertThat(db.select("select * from projects where uuid_path is null or uuid_path = ''")).isEmpty(); + } + + private static final class Snapshot { + private final long id; + private final String idPath; + private final boolean isLast; + + Snapshot(long id, String idPath, boolean isLast) { + this.id = id; + this.idPath = idPath; + this.isLast = isLast; + } + } +} diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/delete-result.xml b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/delete-result.xml index d525297195a..59786c1a985 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/delete-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/delete-result.xml @@ -1,23 +1,65 @@ <dataset> <!-- module --> - <projects id="2" root_id="1" kee="org.struts:struts-core" name="Struts Core" - uuid="EFGH" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD.EFGH." - scope="PRJ" qualifier="BRC" long_name="Struts Core" - description="[null]" enabled="[true]" language="[null]" copy_resource_id="[null]" person_id="[null]" authorization_updated_at="[null]"/> + <projects id="2" + root_id="1" + kee="org.struts:struts-core" + name="Struts Core" + uuid="EFGH" + uuid_path="ABCDE.EFGH." + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path=".ABCD.EFGH." + scope="PRJ" + qualifier="BRC" + long_name="Struts Core" + description="[null]" + enabled="[true]" + language="[null]" + copy_resource_id="[null]" + person_id="[null]" + authorization_updated_at="[null]"/> <!-- directory --> - <projects long_name="org.struts" id="3" scope="DIR" qualifier="DIR" kee="org.struts:struts-core:src/org/struts" - uuid="GHIJ" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH." - name="src/org/struts" root_id="2" + <projects long_name="org.struts" + id="3" + scope="DIR" + qualifier="DIR" + kee="org.struts:struts-core:src/org/struts" + uuid="GHIJ" + uuid_path="ABCDE.EFGH.GHIJ." + project_uuid="ABCD" + module_uuid="EFGH" + module_uuid_path=".ABCD.EFGH." + name="src/org/struts" + root_id="2" description="[null]" - enabled="[true]" language="[null]" copy_resource_id="[null]" person_id="[null]" path="src/org/struts" authorization_updated_at="[null]"/> + enabled="[true]" + language="[null]" + copy_resource_id="[null]" + person_id="[null]" + path="src/org/struts" + authorization_updated_at="[null]"/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="4" scope="FIL" qualifier="FIL" kee="org.struts:struts-core:src/org/struts/RequestContext.java" - uuid="KLMN" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH." - name="RequestContext.java" root_id="2" + <projects long_name="org.struts.RequestContext" + id="4" + scope="FIL" + qualifier="FIL" + kee="org.struts:struts-core:src/org/struts/RequestContext.java" + uuid="KLMN" + uuid_path="ABCDE.EFGH.GHIJ.KLMN." + project_uuid="ABCD" + module_uuid="EFGH" + module_uuid_path=".ABCD.EFGH." + name="RequestContext.java" + root_id="2" description="[null]" - enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" path="src/org/struts/RequestContext.java" authorization_updated_at="[null]"/> + enabled="[true]" + language="java" + copy_resource_id="[null]" + person_id="[null]" + path="src/org/struts/RequestContext.java" + authorization_updated_at="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/delete.xml b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/delete.xml index 78749b4753e..bb7903772a7 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/delete.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/delete.xml @@ -1,29 +1,87 @@ <dataset> <!-- root project --> - <projects id="1" root_id="[null]" scope="PRJ" qualifier="TRK" kee="org.struts:struts" deprecated_kee="org.struts:struts" name="Struts" - uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD." - description="the description" long_name="Apache Struts" - enabled="[true]" language="[null]" copy_resource_id="[null]" person_id="[null]" path="[null]" authorization_updated_at="123456789"/> + <projects id="1" + root_id="[null]" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + deprecated_kee="org.struts:struts" + name="Struts" + uuid="ABCD" + uuid_path="ABCD." + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path=".ABCD." + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="[null]" + copy_resource_id="[null]" + person_id="[null]" + path="[null]" + authorization_updated_at="123456789"/> <!-- module --> - <projects id="2" root_id="1" kee="org.struts:struts-core" name="Struts Core" - uuid="EFGH" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD.EFGH." - scope="PRJ" qualifier="BRC" long_name="Struts Core" - description="[null]" enabled="[true]" language="[null]" copy_resource_id="[null]" person_id="[null]" authorization_updated_at="[null]"/> + <projects id="2" + root_id="1" + kee="org.struts:struts-core" + name="Struts Core" + uuid="EFGH" + uuid_path="ABCDE.EFGH." + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path=".ABCD.EFGH." + scope="PRJ" + qualifier="BRC" + long_name="Struts Core" + description="[null]" + enabled="[true]" + language="[null]" + copy_resource_id="[null]" + person_id="[null]" + authorization_updated_at="[null]"/> <!-- directory --> - <projects long_name="org.struts" id="3" scope="DIR" qualifier="DIR" kee="org.struts:struts-core:src/org/struts" - uuid="GHIJ" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH." - name="src/org/struts" root_id="2" + <projects long_name="org.struts" + id="3" + scope="DIR" + qualifier="DIR" + kee="org.struts:struts-core:src/org/struts" + uuid="GHIJ" + uuid_path="ABCDE.EFGH.GHIJ." + project_uuid="ABCD" + module_uuid="EFGH" + module_uuid_path=".ABCD.EFGH." + name="src/org/struts" + root_id="2" description="[null]" - enabled="[true]" language="[null]" copy_resource_id="[null]" person_id="[null]" path="src/org/struts" authorization_updated_at="[null]"/> + enabled="[true]" + language="[null]" + copy_resource_id="[null]" + person_id="[null]" + path="src/org/struts" + authorization_updated_at="[null]"/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="4" scope="FIL" qualifier="FIL" kee="org.struts:struts-core:src/org/struts/RequestContext.java" - uuid="KLMN" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH." - name="RequestContext.java" root_id="2" + <projects long_name="org.struts.RequestContext" + id="4" + scope="FIL" + qualifier="FIL" + kee="org.struts:struts-core:src/org/struts/RequestContext.java" + uuid="KLMN" + uuid_path="ABCDE.EFGH.GHIJ.KLMN." + project_uuid="ABCD" + module_uuid="EFGH" + module_uuid_path=".ABCD.EFGH." + name="RequestContext.java" + root_id="2" description="[null]" - enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" path="src/org/struts/RequestContext.java" authorization_updated_at="[null]"/> + enabled="[true]" + language="java" + copy_resource_id="[null]" + person_id="[null]" + path="src/org/struts/RequestContext.java" + authorization_updated_at="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert-result.xml b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert-result.xml index 8d70ce24e52..d9307035631 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert-result.xml @@ -1,11 +1,26 @@ <dataset> - <projects id="1" kee="org.struts:struts-core:src/org/struts/RequestContext.java" deprecated_kee="org.struts:struts-core:src/org/struts/RequestContext.java" - name="RequestContext.java" long_name="org.struts.RequestContext" - uuid="GHIJ" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH." - qualifier="FIL" scope="FIL" language="java" path="src/org/struts/RequestContext.java" root_uuid="uuid_3" - description="description" enabled="[true]" copy_component_uuid="uuid_5" developer_uuid="uuid_7" - authorization_updated_at="123456789" created_at="2014-06-18" - /> + <projects id="1" + kee="org.struts:struts-core:src/org/struts/RequestContext.java" + deprecated_kee="org.struts:struts-core:src/org/struts/RequestContext.java" + name="RequestContext.java" + long_name="org.struts.RequestContext" + uuid="GHIJ" + uuid_path="ABCD.EFGH.GHIJ." + project_uuid="ABCD" + module_uuid="EFGH" + module_uuid_path=".ABCD.EFGH." + qualifier="FIL" + scope="FIL" + language="java" + path="src/org/struts/RequestContext.java" + root_uuid="uuid_3" + description="description" + enabled="[true]" + copy_component_uuid="uuid_5" + developer_uuid="uuid_7" + authorization_updated_at="123456789" + created_at="2014-06-18" + /> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert_disabled_component-result.xml b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert_disabled_component-result.xml index 3fe7c2f0512..d5b8047d511 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert_disabled_component-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/insert_disabled_component-result.xml @@ -1,10 +1,26 @@ <dataset> - <projects id="1" kee="org.struts:struts-core:src/org/struts/RequestContext.java" name="RequestContext.java" long_name="org.struts.RequestContext" - uuid="GHIJ" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH." - qualifier="FIL" scope="FIL" language="java" path="src/org/struts/RequestContext.java" root_uuid="uuid_3" - description="[null]" enabled="[false]" copy_component_uuid="[null]" developer_uuid="[null]" deprecated_kee="[null]" - authorization_updated_at="123456789" created_at="2014-06-18" - /> + <projects id="1" + kee="org.struts:struts-core:src/org/struts/RequestContext.java" + name="RequestContext.java" + long_name="org.struts.RequestContext" + uuid="GHIJ" + uuid_path="ABCD.EFGH.GHIJ." + project_uuid="ABCD" + module_uuid="EFGH" + module_uuid_path=".ABCD.EFGH." + qualifier="FIL" + scope="FIL" + language="java" + path="src/org/struts/RequestContext.java" + root_uuid="uuid_3" + description="[null]" + enabled="[false]" + copy_component_uuid="[null]" + developer_uuid="[null]" + deprecated_kee="[null]" + authorization_updated_at="123456789" + created_at="2014-06-18" + /> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/multi-modules.xml b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/multi-modules.xml index 82c7bbbecfd..4c6bbe815ab 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/multi-modules.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/multi-modules.xml @@ -1,10 +1,25 @@ <dataset> <!-- root project --> - <projects id="1" root_uuid="ABCD" kee="org.struts:struts" name="Struts" - uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD." - scope="PRJ" qualifier="TRK" long_name="Apache Struts" description="the description" - enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" authorization_updated_at="[null]"/> + <projects id="1" + root_uuid="ABCD" + kee="org.struts:struts" + name="Struts" + uuid="ABCD" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path=".ABCD." + scope="PRJ" + qualifier="TRK" + long_name="Apache Struts" + description="the description" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="[null]"/> <snapshots id="1" uuid="u1" component_uuid="ABCD" @@ -25,10 +40,24 @@ qualifier="TRK"/> <!-- module --> - <projects id="2" root_uuid="ABCD" kee="org.struts:struts-core" name="Struts Core" - uuid="EFGH" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD.EFGH." - scope="PRJ" qualifier="BRC" long_name="Struts Core" description="[null]" - enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" authorization_updated_at="[null]"/> + <projects id="2" + root_uuid="ABCD" + kee="org.struts:struts-core" + name="Struts Core" + uuid="EFGH" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path=".ABCD.EFGH." + scope="PRJ" + qualifier="BRC" + long_name="Struts Core" + description="[null]" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]"/> <snapshots id="2" uuid="u2" component_uuid="EFGH" @@ -40,10 +69,24 @@ qualifier="BRC"/> <!-- sub module --> - <projects id="3" root_uuid="ABCD" kee="org.struts:struts-data" name="Struts Data" - uuid="FGHI" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH.FGHI." - scope="PRJ" qualifier="BRC" long_name="Struts Data" description="[null]" - enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" authorization_updated_at="[null]"/> + <projects id="3" + root_uuid="ABCD" + kee="org.struts:struts-data" + name="Struts Data" + uuid="FGHI" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="EFGH" + module_uuid_path=".ABCD.EFGH.FGHI." + scope="PRJ" + qualifier="BRC" + long_name="Struts Data" + description="[null]" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]"/> <snapshots id="3" uuid="u3" component_uuid="FGHI" @@ -55,10 +98,25 @@ qualifier="BRC"/> <!-- directory --> - <projects id="4" root_uuid="FGHI" scope="DIR" qualifier="DIR" kee="org.struts:struts-core:src/org/struts" - uuid="GHIJ" project_uuid="ABCD" module_uuid="FGHI" module_uuid_path=".ABCD.EFGH.FGHI." - name="src/org/struts" long_name="org.struts" description="[null]" - enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" path="src/org/struts" authorization_updated_at="[null]"/> + <projects id="4" + root_uuid="FGHI" + scope="DIR" + qualifier="DIR" + kee="org.struts:struts-core:src/org/struts" + uuid="GHIJ" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="FGHI" + module_uuid_path=".ABCD.EFGH.FGHI." + name="src/org/struts" + long_name="org.struts" + description="[null]" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="src/org/struts" + authorization_updated_at="[null]"/> <snapshots id="4" uuid="u4" component_uuid="GHIJ" @@ -70,10 +128,25 @@ qualifier="DIR"/> <!-- file --> - <projects id="5" root_uuid="FGHI" scope="FIL" qualifier="FIL" kee="org.struts:struts-core:src/org/struts/RequestContext.java" - uuid="HIJK" project_uuid="ABCD" module_uuid="FGHI" module_uuid_path=".ABCD.EFGH.FGHI." - name="RequestContext.java" long_name="org.struts.RequestContext" description="[null]" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="src/org/struts/RequestContext.java" authorization_updated_at="[null]"/> + <projects id="5" + root_uuid="FGHI" + scope="FIL" + qualifier="FIL" + kee="org.struts:struts-core:src/org/struts/RequestContext.java" + uuid="HIJK" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="FGHI" + module_uuid_path=".ABCD.EFGH.FGHI." + name="RequestContext.java" + long_name="org.struts.RequestContext" + description="[null]" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="src/org/struts/RequestContext.java" + authorization_updated_at="[null]"/> <snapshots id="5" uuid="u5" component_uuid="HIJK" @@ -85,21 +158,65 @@ qualifier="FIL"/> <!-- removed sub module --> - <projects id="10" root_uuid="ABCD" kee="org.struts:struts-data-removed" name="Struts Data Removed" - uuid="IHGF" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH.IHGF." - scope="PRJ" qualifier="BRC" long_name="Struts Data" description="[null]" - enabled="[false]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" authorization_updated_at="[null]"/> + <projects id="10" + root_uuid="ABCD" + kee="org.struts:struts-data-removed" + name="Struts Data Removed" + uuid="IHGF" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="EFGH" + module_uuid_path=".ABCD.EFGH.IHGF." + scope="PRJ" + qualifier="BRC" + long_name="Struts Data" + description="[null]" + enabled="[false]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]"/> <!-- removed directory --> - <projects id="11" root_uuid="IHGF" scope="DIR" qualifier="DIR" kee="org.struts:struts-core:src/org/struts-removed" - uuid="JIHG" project_uuid="ABCD" module_uuid="FGHI" module_uuid_path=".ABCD.EFGH.IHGF." - name="src/org/struts" long_name="org.struts" description="[null]" - enabled="[false]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" path="src/org/struts" authorization_updated_at="[null]"/> + <projects id="11" + root_uuid="IHGF" + scope="DIR" + qualifier="DIR" + kee="org.struts:struts-core:src/org/struts-removed" + uuid="JIHG" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="FGHI" + module_uuid_path=".ABCD.EFGH.IHGF." + name="src/org/struts" + long_name="org.struts" + description="[null]" + enabled="[false]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="src/org/struts" + authorization_updated_at="[null]"/> <!-- removed file --> - <projects id="12" root_uuid="IHGF" scope="FIL" qualifier="FIL" kee="org.struts:struts-core:src/org/struts/RequestContextRemoved.java" - uuid="KJIH" project_uuid="ABCD" module_uuid="FGHI" module_uuid_path=".ABCD.EFGH.IHGF." - name="RequestContext.java" long_name="org.struts.RequestContext" description="[null]" - enabled="[false]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="src/org/struts/RequestContext.java" authorization_updated_at="[null]"/> + <projects id="12" + root_uuid="IHGF" + scope="FIL" + qualifier="FIL" + kee="org.struts:struts-core:src/org/struts/RequestContextRemoved.java" + uuid="KJIH" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="FGHI" + module_uuid_path=".ABCD.EFGH.IHGF." + name="RequestContext.java" + long_name="org.struts.RequestContext" + description="[null]" + enabled="[false]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="src/org/struts/RequestContext.java" + authorization_updated_at="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/select_ghost_projects.xml b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/select_ghost_projects.xml index 57b445759e0..deed953573e 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/select_ghost_projects.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/select_ghost_projects.xml @@ -1,26 +1,61 @@ <dataset> <!-- Struts projects is authorized for all user --> - <group_roles id="1" group_id="[null]" resource_id="1" role="user"/> + <group_roles id="1" + group_id="[null]" + resource_id="1" + role="user"/> <!-- Ghost project --> - <projects id="42" root_uuid="PPAA" scope="PRJ" qualifier="TRK" kee="org.ghost.project" name="Ghost Project" - uuid="PPAA" project_uuid="PPAA" module_uuid="[null]" module_uuid_path="." - description="the description" long_name="Ghost Project" - enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" authorization_updated_at="123456789"/> + <projects id="42" + root_uuid="PPAA" + scope="PRJ" + qualifier="TRK" + kee="org.ghost.project" + name="Ghost Project" + uuid="PPAA" + uuid_path="NOT_USED" + project_uuid="PPAA" + module_uuid="[null]" + module_uuid_path="." + description="the description" + long_name="Ghost Project" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="123456789"/> <!-- root project --> - <projects id="1" root_uuid="ABCD" scope="PRJ" qualifier="TRK" kee="org.struts:struts" deprecated_kee="org.struts:struts" name="Struts" - uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD." - description="the description" long_name="Apache Struts" - enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" authorization_updated_at="123456789"/> + <projects id="1" + root_uuid="ABCD" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + deprecated_kee="org.struts:struts" + name="Struts" + uuid="ABCD" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path=".ABCD." + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="123456789"/> <snapshots id="1" uuid="u1" component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - status="P" islast="[true]" + status="P" + islast="[true]" purge_status="[null]" period1_mode="[null]" period1_param="[null]" @@ -37,18 +72,21 @@ period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" + depth="[null]" + scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path=""/> + version="[null]" + path=""/> <snapshots id="10" uuid="u10" component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - status="P" islast="[false]" + status="P" + islast="[false]" purge_status="[null]" period1_mode="[null]" period1_param="[null]" @@ -70,14 +108,16 @@ qualifier="TRK" created_at="1228136280000" build_date="1228136280000" - version="[null]" path=""/> + version="[null]" + path=""/> <snapshots id="11" uuid="u11" component_uuid="PPAA" parent_snapshot_id="[null]" root_component_uuid="PPAA" root_snapshot_id="[null]" - status="U" islast="[false]" + status="U" + islast="[false]" purge_status="[null]" period1_mode="[null]" period1_param="[null]" @@ -99,20 +139,36 @@ qualifier="TRK" created_at="1228136280000" build_date="1228136280000" - version="[null]" path=""/> + version="[null]" + path=""/> <!-- module --> - <projects id="2" root_uuid="ABCD" kee="org.struts:struts-core" name="Struts Core" - uuid="EFGH" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD.EFGH." - scope="PRJ" qualifier="BRC" long_name="Struts Core" - description="[null]" enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" authorization_updated_at="[null]"/> + <projects id="2" + root_uuid="ABCD" + kee="org.struts:struts-core" + name="Struts Core" + uuid="EFGH" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path=".ABCD.EFGH." + scope="PRJ" + qualifier="BRC" + long_name="Struts Core" + description="[null]" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]"/> <snapshots id="2" uuid="u2" component_uuid="EFGH" parent_snapshot_id="1" root_component_uuid="ABCD" root_snapshot_id="1" - status="P" islast="[true]" + status="P" + islast="[true]" purge_status="[null]" period1_mode="[null]" period1_param="[null]" @@ -138,18 +194,33 @@ path="1."/> <!-- directory --> - <projects long_name="org.struts" id="3" scope="DIR" qualifier="DIR" kee="org.struts:struts-core:src/org/struts" - uuid="GHIJ" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH." - name="src/org/struts" root_uuid="EFGH" + <projects long_name="org.struts" + id="3" + scope="DIR" + qualifier="DIR" + kee="org.struts:struts-core:src/org/struts" + uuid="GHIJ" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="EFGH" + module_uuid_path=".ABCD.EFGH." + name="src/org/struts" + root_uuid="EFGH" description="[null]" - enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" path="src/org/struts" authorization_updated_at="[null]"/> + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="src/org/struts" + authorization_updated_at="[null]"/> <snapshots id="3" uuid="u3" component_uuid="GHIJ" parent_snapshot_id="2" root_component_uuid="ABCD" root_snapshot_id="1" - status="P" islast="[true]" + status="P" + islast="[true]" purge_status="[null]" period1_mode="[null]" period1_param="[null]" @@ -175,11 +246,25 @@ path="1.2."/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="4" scope="FIL" qualifier="FIL" kee="org.struts:struts-core:src/org/struts/RequestContext.java" - uuid="KLMN" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH." - name="RequestContext.java" root_uuid="EFGH" + <projects long_name="org.struts.RequestContext" + id="4" + scope="FIL" + qualifier="FIL" + kee="org.struts:struts-core:src/org/struts/RequestContext.java" + uuid="KLMN" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="EFGH" + module_uuid_path=".ABCD.EFGH." + name="RequestContext.java" + root_uuid="EFGH" description="[null]" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="src/org/struts/RequestContext.java" authorization_updated_at="[null]"/> + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="src/org/struts/RequestContext.java" + authorization_updated_at="[null]"/> <snapshots id="4" uuid="u4" @@ -187,7 +272,8 @@ parent_snapshot_id="3" root_component_uuid="ABCD" root_snapshot_id="1" - status="P" islast="[true]" + status="P" + islast="[true]" purge_status="[null]" period1_mode="[null]" period1_param="[null]" @@ -213,19 +299,64 @@ path="1.2.3."/> <!-- Disabled projects --> - <projects id="10" root_uuid="DCBA" scope="PRJ" qualifier="TRK" kee="org.disabled.project" name="Disabled Project" - uuid="DCBA" project_uuid="DCBA" module_uuid="[null]" module_uuid_path="." - description="the description" long_name="Disabled project" - enabled="[false]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" authorization_updated_at="123456789"/> + <projects id="10" + root_uuid="DCBA" + scope="PRJ" + qualifier="TRK" + kee="org.disabled.project" + name="Disabled Project" + uuid="DCBA" + uuid_path="NOT_USED" + project_uuid="DCBA" + module_uuid="[null]" + module_uuid_path="." + description="the description" + long_name="Disabled project" + enabled="[false]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="123456789"/> <!-- Developer and technical project copy --> - <projects id="11" root_uuid="OPQR" scope="PRJ" qualifier="DEV" kee="DEV:anakin@skywalker.name" name="Anakin Skywalker" - uuid="OPQR" project_uuid="OPQR" module_uuid="[null]" module_uuid_path=".OPQR." - description="the description" long_name="Anakin Skywalker" - enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" authorization_updated_at="123456789"/> - <projects id="12" root_uuid="OPQR" scope="PRJ" qualifier="DEV_PRJ" kee="DEV:anakin@skywalker.name:org.struts:struts" name="Apache Struts" - uuid="STUV" project_uuid="OPQR" module_uuid="OPQR" module_uuid_path=".OPQR." - description="the description" long_name="Apache Struts" - enabled="[true]" language="[null]" copy_component_uuid="ABCD" developer_uuid="OPQR" path="[null]" authorization_updated_at="123456789"/> + <projects id="11" + root_uuid="OPQR" + scope="PRJ" + qualifier="DEV" + kee="DEV:anakin@skywalker.name" + name="Anakin Skywalker" + uuid="OPQR" + uuid_path="NOT_USED" + project_uuid="OPQR" + module_uuid="[null]" + module_uuid_path=".OPQR." + description="the description" + long_name="Anakin Skywalker" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="123456789"/> + <projects id="12" + root_uuid="OPQR" + scope="PRJ" + qualifier="DEV_PRJ" + kee="DEV:anakin@skywalker.name:org.struts:struts" + name="Apache Struts" + uuid="STUV" + uuid_path="NOT_USED" + project_uuid="OPQR" + module_uuid="OPQR" + module_uuid_path=".OPQR." + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="[null]" + copy_component_uuid="ABCD" + developer_uuid="OPQR" + path="[null]" + authorization_updated_at="123456789"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/select_module_files_tree.xml b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/select_module_files_tree.xml index 7aab8b98265..0069b4fc43c 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/select_module_files_tree.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/select_module_files_tree.xml @@ -1,56 +1,151 @@ <dataset> <!-- root project --> - <projects id="1" root_uuid="ABCD" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD." - description="the description" long_name="Apache Struts" - enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" authorization_updated_at="[null]"/> + <projects id="1" + root_uuid="ABCD" + 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=".ABCD." + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="[null]"/> <!-- module --> - <projects id="2" root_uuid="ABCD" kee="org.struts:struts-core" name="Struts Core" - uuid="EFGH" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD.EFGH." - scope="PRJ" qualifier="BRC" long_name="Struts Core" - description="[null]" enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" authorization_updated_at="[null]"/> + <projects id="2" + root_uuid="ABCD" + kee="org.struts:struts-core" + name="Struts Core" + uuid="EFGH" + project_uuid="ABCD" + uuid_path="NOT_USED" + module_uuid="[null]" + module_uuid_path=".ABCD.EFGH." + scope="PRJ" + qualifier="BRC" + long_name="Struts Core" + description="[null]" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]"/> <!-- file attached directly on module --> - <projects id="3" scope="FIL" qualifier="FIL" kee="org.struts:struts-core:pom.xml" - uuid="EFGHI" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH." - name="pom.xml" long_name="pom.xml" root_uuid="EFGHI" + <projects id="3" + scope="FIL" + qualifier="FIL" + kee="org.struts:struts-core:pom.xml" + uuid="EFGHI" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="EFGH" + module_uuid_path=".ABCD.EFGH." + name="pom.xml" + long_name="pom.xml" + root_uuid="EFGHI" description="[null]" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="src/org/struts/pom.xml" authorization_updated_at="[null]"/> + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="src/org/struts/pom.xml" + authorization_updated_at="[null]"/> - <file_sources id="101" project_uuid="ABCD" file_uuid="EFGHI" + <file_sources id="101" + project_uuid="ABCD" + file_uuid="EFGHI" binary_data=",,,,,,,,,,,,,,,unchanged ,,,,,,,,,,,,,,,content " line_hashes="lineEFGHI" data_hash="dataEFGHI" - src_hash="srcEFGHI" revision="123456789" - created_at="1412952242000" updated_at="1412952242000" data_type="SOURCE"/> + src_hash="srcEFGHI" + revision="123456789" + created_at="1412952242000" + updated_at="1412952242000" + data_type="SOURCE"/> <!-- sub module --> - <projects id="4" root_uuid="ABCD" kee="org.struts:struts-data" name="Struts Data" - uuid="FGHI" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH.FGHI." - scope="PRJ" qualifier="BRC" long_name="Struts Data" - description="[null]" enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" authorization_updated_at="[null]"/> + <projects id="4" + root_uuid="ABCD" + kee="org.struts:struts-data" + name="Struts Data" + uuid="FGHI" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="EFGH" + module_uuid_path=".ABCD.EFGH.FGHI." + scope="PRJ" + qualifier="BRC" + long_name="Struts Data" + description="[null]" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]"/> <!-- directory --> - <projects id="5" scope="DIR" qualifier="DIR" kee="org.struts:struts-core:src/org/struts" - uuid="GHIJ" project_uuid="ABCD" module_uuid="FGHI" module_uuid_path=".ABCD.EFGH.FGHI." - name="src/org/struts" long_name="org.struts" root_uuid="EFGHI" + <projects id="5" + scope="DIR" + qualifier="DIR" + kee="org.struts:struts-core:src/org/struts" + uuid="GHIJ" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="FGHI" + module_uuid_path=".ABCD.EFGH.FGHI." + name="src/org/struts" + long_name="org.struts" + root_uuid="EFGHI" description="[null]" - enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" path="src/org/struts" authorization_updated_at="[null]"/> + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="src/org/struts" + authorization_updated_at="[null]"/> <!-- file --> - <projects id="6" scope="FIL" qualifier="FIL" kee="org.struts:struts-core:src/org/struts/RequestContext.java" - uuid="HIJK" project_uuid="ABCD" module_uuid="FGHI" module_uuid_path=".ABCD.EFGH.FGHI." - name="RequestContext.java" long_name="org.struts.RequestContext" root_uuid="EFGHI" + <projects id="6" + scope="FIL" + qualifier="FIL" + kee="org.struts:struts-core:src/org/struts/RequestContext.java" + uuid="HIJK" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="FGHI" + module_uuid_path=".ABCD.EFGH.FGHI." + name="RequestContext.java" + long_name="org.struts.RequestContext" + root_uuid="EFGHI" description="[null]" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="src/org/struts/RequestContext.java" authorization_updated_at="[null]"/> + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="src/org/struts/RequestContext.java" + authorization_updated_at="[null]"/> - <file_sources id="102" project_uuid="ABCD" file_uuid="HIJK" + <file_sources id="102" + project_uuid="ABCD" + file_uuid="HIJK" binary_data=",,,,,,,,,,,,,,,unchanged ,,,,,,,,,,,,,,,content " line_hashes="lineHIJK" data_hash="dataHIJK" - src_hash="srcHIJK" revision="123456789" - created_at="1412952242000" updated_at="1412952242000" data_type="SOURCE"/> + src_hash="srcHIJK" + revision="123456789" + created_at="1412952242000" + updated_at="1412952242000" + data_type="SOURCE"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/select_provisioned_projects.xml b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/select_provisioned_projects.xml index 481e2fc98ed..f3d286a0f38 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/select_provisioned_projects.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/select_provisioned_projects.xml @@ -1,19 +1,53 @@ <dataset> <!-- Struts projects is authorized for all user --> - <group_roles id="1" group_id="[null]" resource_id="1" role="user"/> + <group_roles id="1" + group_id="[null]" + resource_id="1" + role="user"/> <!-- Provisioned project --> - <projects id="42" root_uuid="PPAA" scope="PRJ" qualifier="TRK" kee="org.provisioned.project" name="Provisioned Project" - uuid="PPAA" project_uuid="PPAA" module_uuid="[null]" module_uuid_path="." - description="the description" long_name="Provisioned Project" - enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" authorization_updated_at="123456789"/> + <projects id="42" + root_uuid="PPAA" + scope="PRJ" + qualifier="TRK" + kee="org.provisioned.project" + name="Provisioned Project" + uuid="PPAA" + uuid_path="NOT_USED" + project_uuid="PPAA" + module_uuid="[null]" + module_uuid_path="." + description="the description" + long_name="Provisioned Project" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="123456789"/> <!-- root project --> - <projects id="1" root_uuid="ABCD" scope="PRJ" qualifier="TRK" kee="org.struts:struts" deprecated_kee="org.struts:struts" name="Struts" - uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD." - description="the description" long_name="Apache Struts" - enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" authorization_updated_at="123456789"/> + <projects id="1" + root_uuid="ABCD" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + deprecated_kee="org.struts:struts" + name="Struts" + uuid="ABCD" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path=".ABCD." + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="123456789"/> <snapshots id="1" uuid="u1" component_uuid="ABCD" @@ -23,13 +57,28 @@ status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path=""/> + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path=""/> <snapshots id="10" uuid="u10" component_uuid="ABCD" @@ -39,19 +88,48 @@ status="P" islast="[false]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228136280000" build_date="1228136280000" - version="[null]" path=""/> + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228136280000" + build_date="1228136280000" + version="[null]" + path=""/> <!-- module --> - <projects id="2" root_uuid="ABCD" kee="org.struts:struts-core" name="Struts Core" - uuid="EFGH" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD.EFGH." - scope="PRJ" qualifier="BRC" long_name="Struts Core" - description="[null]" enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" authorization_updated_at="[null]"/> + <projects id="2" + root_uuid="ABCD" + kee="org.struts:struts-core" + name="Struts Core" + uuid="EFGH" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path=".ABCD.EFGH." + scope="PRJ" + qualifier="BRC" + long_name="Struts Core" + description="[null]" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]"/> <snapshots id="2" uuid="u2" component_uuid="EFGH" @@ -61,20 +139,49 @@ status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="BRC" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="1."/> + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="BRC" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="1."/> <!-- directory --> - <projects long_name="org.struts" id="3" scope="DIR" qualifier="DIR" kee="org.struts:struts-core:src/org/struts" - uuid="GHIJ" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH." - name="src/org/struts" root_uuid="EFGH" + <projects long_name="org.struts" + id="3" + scope="DIR" + qualifier="DIR" + kee="org.struts:struts-core:src/org/struts" + uuid="GHIJ" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="EFGH" + module_uuid_path=".ABCD.EFGH." + name="src/org/struts" + root_uuid="EFGH" description="[null]" - enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" path="src/org/struts" authorization_updated_at="[null]"/> + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="src/org/struts" + authorization_updated_at="[null]"/> <snapshots id="3" uuid="u3" component_uuid="GHIJ" @@ -84,20 +191,49 @@ status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="DIR" qualifier="PAC" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="1.2."/> + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="DIR" + qualifier="PAC" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="1.2."/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="4" scope="FIL" qualifier="FIL" kee="org.struts:struts-core:src/org/struts/RequestContext.java" - uuid="KLMN" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH." - name="RequestContext.java" root_uuid="EFGH" + <projects long_name="org.struts.RequestContext" + id="4" + scope="FIL" + qualifier="FIL" + kee="org.struts:struts-core:src/org/struts/RequestContext.java" + uuid="KLMN" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="EFGH" + module_uuid_path=".ABCD.EFGH." + name="RequestContext.java" + root_uuid="EFGH" description="[null]" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="src/org/struts/RequestContext.java" authorization_updated_at="[null]"/> + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="src/org/struts/RequestContext.java" + authorization_updated_at="[null]"/> <snapshots id="4" uuid="u4" @@ -108,28 +244,88 @@ status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="FIL" qualifier="CLA" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="1.2.3."/> + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="FIL" + qualifier="CLA" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="1.2.3."/> <!-- Disabled projects --> - <projects id="10" root_uuid="DCBA" scope="PRJ" qualifier="TRK" kee="org.disabled.project" name="Disabled Project" - uuid="DCBA" project_uuid="DCBA" module_uuid="[null]" module_uuid_path="." - description="the description" long_name="Disabled project" - enabled="[false]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" authorization_updated_at="123456789"/> + <projects id="10" + root_uuid="DCBA" + scope="PRJ" + qualifier="TRK" + kee="org.disabled.project" + name="Disabled Project" + uuid="DCBA" + uuid_path="NOT_USED" + project_uuid="DCBA" + module_uuid="[null]" + module_uuid_path="." + description="the description" + long_name="Disabled project" + enabled="[false]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="123456789"/> <!-- Developer and technical project copy --> - <projects id="11" root_uuid="OPQR" scope="PRJ" qualifier="DEV" kee="DEV:anakin@skywalker.name" name="Anakin Skywalker" - uuid="OPQR" project_uuid="OPQR" module_uuid="[null]" module_uuid_path=".OPQR." - description="the description" long_name="Anakin Skywalker" - enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" authorization_updated_at="123456789"/> - <projects id="12" root_uuid="OPQR" scope="PRJ" qualifier="DEV_PRJ" kee="DEV:anakin@skywalker.name:org.struts:struts" name="Apache Struts" - uuid="STUV" project_uuid="OPQR" module_uuid="OPQR" module_uuid_path=".OPQR." - description="the description" long_name="Apache Struts" - enabled="[true]" language="[null]" copy_component_uuid="ABCD" developer_uuid="OPQR" path="[null]" authorization_updated_at="123456789"/> + <projects id="11" + root_uuid="OPQR" + scope="PRJ" + qualifier="DEV" + kee="DEV:anakin@skywalker.name" + name="Anakin Skywalker" + uuid="OPQR" + uuid_path="NOT_USED" + project_uuid="OPQR" + module_uuid="[null]" + module_uuid_path=".OPQR." + description="the description" + long_name="Anakin Skywalker" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="123456789"/> + <projects id="12" + root_uuid="OPQR" + scope="PRJ" + qualifier="DEV_PRJ" + kee="DEV:anakin@skywalker.name:org.struts:struts" + name="Apache Struts" + uuid="STUV" + uuid_path="NOT_USED" + project_uuid="OPQR" + module_uuid="OPQR" + module_uuid_path=".OPQR." + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="[null]" + copy_component_uuid="ABCD" + developer_uuid="OPQR" + path="[null]" + authorization_updated_at="123456789"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared.xml b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared.xml index f3f8f181d84..b7dc6a41b97 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared.xml @@ -1,14 +1,33 @@ <dataset> <!-- Struts projects is authorized for all user --> - <group_roles id="1" group_id="[null]" resource_id="1" role="user"/> + <group_roles id="1" + group_id="[null]" + resource_id="1" + role="user"/> <!-- root project --> - <projects id="1" root_uuid="ABCD" scope="PRJ" qualifier="TRK" kee="org.struts:struts" deprecated_kee="org.struts:struts" name="Struts" - uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD." - description="the description" long_name="Apache Struts" - enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" authorization_updated_at="123456789"/> + <projects id="1" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + deprecated_kee="org.struts:struts" + name="Struts" + uuid="U1" + uuid_path="uuid_path_of_U1" + root_uuid="root_uuid_of_U1" + project_uuid="project_uuid_of_U1" + module_uuid="module_uuid_of_U1" + module_uuid_path="module_uuid_path_of_U1" + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="path_of_U1" + authorization_updated_at="123456789"/> <snapshots id="1" uuid="u1" component_uuid="ABCD" @@ -18,11 +37,21 @@ status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" depth="[null]" scope="PRJ" qualifier="TRK" @@ -36,65 +65,155 @@ parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - status="P" islast="[false]" + status="P" + islast="[false]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228136280000" build_date="1228136280000" - version="[null]" path=""/> + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228136280000" + build_date="1228136280000" + version="[null]" + path=""/> <!-- module --> - <projects id="2" root_uuid="ABCD" kee="org.struts:struts-core" name="Struts Core" - uuid="EFGH" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD.EFGH." - scope="PRJ" qualifier="BRC" long_name="Struts Core" - description="[null]" enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" authorization_updated_at="[null]"/> + <projects id="2" + kee="org.struts:struts-core" + name="Struts Core" + uuid="U2" + uuid_path="uuid_path_of_U2" + project_uuid="U1" + root_uuid="U1" + module_uuid="[null]" + module_uuid_path="module_uuid_path_of_U2" + scope="PRJ" + qualifier="BRC" + long_name="Struts Core" + description="[null]" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]"/> <snapshots id="2" uuid="u2" component_uuid="EFGH" parent_snapshot_id="1" root_component_uuid="ABCD" root_snapshot_id="1" - status="P" islast="[true]" + status="P" + islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="BRC" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="1."/> + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="BRC" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="1."/> <!-- directory --> - <projects long_name="org.struts" id="3" scope="DIR" qualifier="DIR" kee="org.struts:struts-core:src/org/struts" - uuid="GHIJ" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH." - name="src/org/struts" root_uuid="EFGH" + <projects long_name="org.struts" + id="3" + scope="DIR" + qualifier="DIR" + kee="org.struts:struts-core:src/org/struts" + uuid="U3" + uuid_path="uuid_path_of_U3" + project_uuid="U1" + root_uuid="U1" + module_uuid="module_uuid_of_U3" + module_uuid_path="module_uuid_path_of_U3" + name="src/org/struts" description="[null]" - enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" path="src/org/struts" authorization_updated_at="[null]"/> + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="src/org/struts" + authorization_updated_at="[null]"/> <snapshots id="3" uuid="u3" component_uuid="GHIJ" parent_snapshot_id="2" root_component_uuid="ABCD" root_snapshot_id="1" - status="P" islast="[true]" + status="P" + islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="DIR" qualifier="PAC" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="1.2."/> + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="DIR" + qualifier="PAC" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="1.2."/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="4" scope="FIL" qualifier="FIL" kee="org.struts:struts-core:src/org/struts/RequestContext.java" - uuid="KLMN" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH." - name="RequestContext.java" root_uuid="EFGH" + <projects long_name="org.struts.RequestContext" + id="4" + scope="FIL" + qualifier="FIL" + kee="org.struts:struts-core:src/org/struts/RequestContext.java" + uuid="U4" + uuid_path="uuid_path_of_U4" + project_uuid="U1" + root_uuid="U1" + module_uuid="module_uuid_of_U4" + module_uuid_path="module_uuid_path_of_U4" + name="RequestContext.java" description="[null]" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="src/org/struts/RequestContext.java" authorization_updated_at="[null]"/> + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="path_of_U4" + authorization_updated_at="[null]"/> <snapshots id="4" uuid="u4" @@ -105,28 +224,88 @@ status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="FIL" qualifier="CLA" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="1.2.3."/> + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="FIL" + qualifier="CLA" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="1.2.3."/> <!-- Disabled projects --> - <projects id="10" root_uuid="ABCD" scope="PRJ" qualifier="TRK" kee="org.disabled.project" name="Disabled Project" - uuid="DCBA" project_uuid="DCBA" module_uuid="[null]" module_uuid_path="." - description="the description" long_name="Disabled project" - enabled="[false]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" authorization_updated_at="123456789"/> + <projects id="10" + scope="PRJ" + qualifier="TRK" + kee="org.disabled.project" + name="Disabled Project" + uuid="U5" + uuid_path="uuid_path_of_U5" + project_uuid="project_uuid_of_U5" + root_uuid="root_uuid_of_U5" + module_uuid="[null]" + module_uuid_path="module_uuid_path_of_U5" + description="the description" + long_name="Disabled project" + enabled="[false]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="123456789"/> <!-- Developer and technical project copy --> - <projects id="11" root_uuid="OPQR" scope="PRJ" qualifier="DEV" kee="DEV:anakin@skywalker.name" name="Anakin Skywalker" - uuid="OPQR" project_uuid="OPQR" module_uuid="[null]" module_uuid_path=".OPQR." - description="the description" long_name="Anakin Skywalker" - enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" authorization_updated_at="123456789"/> - <projects id="12" root_uuid="OPQR" scope="PRJ" qualifier="DEV_PRJ" kee="DEV:anakin@skywalker.name:org.struts:struts" name="Apache Struts" - uuid="STUV" project_uuid="OPQR" module_uuid="OPQR" module_uuid_path=".OPQR." - description="the description" long_name="Apache Struts" - enabled="[true]" language="[null]" copy_component_uuid="ABCD" developer_uuid="OPQR" path="[null]" authorization_updated_at="123456789"/> + <projects id="11" + scope="PRJ" + qualifier="DEV" + kee="DEV:anakin@skywalker.name" + name="Anakin Skywalker" + uuid="U6" + uuid_path="uuid_path_of_U6" + project_uuid="project_uuid_of_U6" + root_uuid="root_uuid_of_U6" + module_uuid="[null]" + module_uuid_path="module_uuid_path_of_U6" + description="the description" + long_name="Anakin Skywalker" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="123456789"/> + <projects id="12" + scope="PRJ" + qualifier="DEV_PRJ" + kee="DEV:anakin@skywalker.name:org.struts:struts" + name="Apache Struts" + uuid="U7" + uuid_path="uuid_path_of_U7" + project_uuid="project_uuid_of_U7" + root_uuid="root_uuid_of_U7" + module_uuid="module_uuid_of_U7" + module_uuid_path="module_uuid_path_of_U7" + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="[null]" + copy_component_uuid="U1" + developer_uuid="developer_uuid_of_U7" + path="[null]" + authorization_updated_at="123456789"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared_views.xml b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared_views.xml index 3f62fc3ad78..142573b18d8 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared_views.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/shared_views.xml @@ -1,35 +1,141 @@ <dataset> <!-- Simple View --> - <projects id="10" uuid="ABCD" root_uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD." copy_component_uuid="[null]" enabled="[true]" - kee="MASTER_PROJECT" scope="PRJ" qualifier="VW" name="All projects" path="[null]"/> + <projects id="10" + uuid="ABCD" + uuid_path="ABCD." + root_uuid="ABCD" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path=".ABCD." + copy_component_uuid="[null]" + enabled="[true]" + kee="MASTER_PROJECT" + scope="PRJ" + qualifier="VW" + name="All projects" + path="[null]"/> - <projects id="110" uuid="BCDE" root_uuid="ABCD" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path=".ABCD." copy_component_uuid="JKLM" enabled="[true]" - kee="MASTER_PROJECTorg.struts:struts" scope="FIL" qualifier="TRK" name="Struts" path="[null]"/> + <projects id="110" + uuid="BCDE" + uuid_path="ABCD.BCDE." + root_uuid="ABCD" + project_uuid="ABCD" + module_uuid="ABCD" + module_uuid_path=".ABCD." + copy_component_uuid="JKLM" + enabled="[true]" + kee="MASTER_PROJECTorg.struts:struts" + scope="FIL" + qualifier="TRK" + name="Struts" + path="[null]"/> <!-- View with sub view --> - <projects id="11" uuid="EFGH" root_uuid="EFGH" project_uuid="EFGH" module_uuid="[null]" module_uuid_path=".EFGH." copy_component_uuid="[null]" enabled="[true]" - kee="LANGUAGE_VIEW" scope="PRJ" qualifier="VW" name="By Language" path="[null]"/> - <projects id="112" uuid="GHIJ" root_uuid="EFGH" project_uuid="EFGH" module_uuid="EFGH" module_uuid_path=".EFGH." copy_component_uuid="KLMN" enabled="[true]" - kee="VIEW2org.elasticsearch:elasticsearch" scope="FIL" qualifier="TRK" name="SSLR" path="[null]"/> + <projects id="11" + uuid="EFGH" + uuid_path="EFGH." + root_uuid="EFGH" + project_uuid="EFGH" + module_uuid="[null]" + module_uuid_path=".EFGH." + copy_component_uuid="[null]" + enabled="[true]" + kee="LANGUAGE_VIEW" + scope="PRJ" + qualifier="VW" + name="By Language" + path="[null]"/> + <projects id="112" + uuid="GHIJ" + uuid_path="EFGH.GHIJ." + root_uuid="EFGH" + project_uuid="EFGH" + module_uuid="EFGH" + module_uuid_path=".EFGH." + copy_component_uuid="KLMN" + enabled="[true]" + kee="VIEW2org.elasticsearch:elasticsearch" + scope="FIL" + qualifier="TRK" + name="SSLR" + path="[null]"/> <!-- Sub view --> - <projects id="13" uuid="FGHI" root_uuid="FGHI" project_uuid="EFGH" module_uuid="EFGH" module_uuid_path=".EFGH.FGHI." copy_component_uuid="[null]" enabled="[true]" - kee="JAVA_PROJECTS" scope="PRJ" qualifier="SVW" name="Java projects" path="[null]"/> + <projects id="13" + uuid="FGHI" + uuid_path="EFGH.FGHI." + root_uuid="FGHI" + project_uuid="EFGH" + module_uuid="EFGH" + module_uuid_path=".EFGH.FGHI." + copy_component_uuid="[null]" + enabled="[true]" + kee="JAVA_PROJECTS" + scope="PRJ" + qualifier="SVW" + name="Java projects" + path="[null]"/> - <projects id="113" uuid="HIJK" root_uuid="EFGH" project_uuid="EFGH" module_uuid="FGHI" module_uuid_path=".EFGH.FGHI." copy_component_uuid="JKLM" enabled="[true]" - kee="VIEW2org.struts:struts" scope="FIL" qualifier="TRK" name="Struts" path="[null]"/> + <projects id="113" + uuid="HIJK" + uuid_path="EFGH.FGHI.HIJK." + root_uuid="EFGH" + project_uuid="EFGH" + module_uuid="FGHI" + module_uuid_path=".EFGH.FGHI." + copy_component_uuid="JKLM" + enabled="[true]" + kee="VIEW2org.struts:struts" + scope="FIL" + qualifier="TRK" + name="Struts" + path="[null]"/> <!-- View without project --> - <projects id="14" uuid="IJKL" root_uuid="IJKL" project_uuid="IJKL" module_uuid="[null]" module_uuid_path=".IJKL." copy_component_uuid="[null]" enabled="[true]" - kee="OTHER" scope="PRJ" qualifier="VW" name="Other projects" path="[null]"/> + <projects id="14" + uuid="IJKL" + uuid_path="IJKL.." + root_uuid="IJKL" + project_uuid="IJKL" + module_uuid="[null]" + module_uuid_path=".IJKL." + copy_component_uuid="[null]" + enabled="[true]" + kee="OTHER" + scope="PRJ" + qualifier="VW" + name="Other projects" + path="[null]"/> <!-- Real projects --> - <projects id="100" uuid="JKLM" root_uuid="JKLM" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - project_uuid="JKLM" module_uuid="[null]" module_uuid_path=".JKLM." - enabled="[true]" copy_component_uuid="[null]" path="[null]"/> - <projects id="101" uuid="KLMN" root_uuid="KLMN" scope="PRJ" qualifier="TRK" kee="org.elasticsearch:elasticsearch" name="Elasticsearch" - project_uuid="KLMN" module_uuid="[null]" module_uuid_path=".KLMN." - enabled="[true]" copy_component_uuid="[null]" path="[null]"/> + <projects id="100" + uuid="JKLM" + uuid_path="JKLM." + root_uuid="JKLM" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts" + project_uuid="JKLM" + module_uuid="[null]" + module_uuid_path=".JKLM." + enabled="[true]" + copy_component_uuid="[null]" + path="[null]"/> + <projects id="101" + uuid="KLMN" + uuid_path="KLMN." + root_uuid="KLMN" + scope="PRJ" + qualifier="TRK" + kee="org.elasticsearch:elasticsearch" + name="Elasticsearch" + project_uuid="KLMN" + module_uuid="[null]" + module_uuid_path=".KLMN." + enabled="[true]" + copy_component_uuid="[null]" + path="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/update-result.xml b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/update-result.xml index 6a23654e9ff..64a6fe4cea8 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/update-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/update-result.xml @@ -1,11 +1,26 @@ <dataset> - <projects id="1" kee="org.struts:struts-core:src/org/struts/RequestContext2.java" deprecated_kee="org.struts:struts-core:src/org/struts/RequestContext2.java" - name="RequestContext2.java" long_name="org.struts.RequestContext2" - uuid="GHIJ" project_uuid="DCBA" module_uuid="HGFE" module_uuid_path=".DCBA.HGFE." - qualifier="LIF" scope="LIF" language="java2" path="src/org/struts/RequestContext2.java" root_uuid="uuid_4" - description="description2" enabled="[false]" copy_component_uuid="uuid_6" developer_uuid="uuid_9" - authorization_updated_at="12345678910" created_at="2014-06-18" - /> + <projects id="1" + kee="org.struts:struts-core:src/org/struts/RequestContext2.java" + deprecated_kee="org.struts:struts-core:src/org/struts/RequestContext2.java" + name="RequestContext2.java" + long_name="org.struts.RequestContext2" + uuid="GHIJ" + uuid_path="GHIJ." + project_uuid="DCBA" + module_uuid="HGFE" + module_uuid_path=".DCBA.HGFE." + qualifier="LIF" + scope="LIF" + language="java2" + path="src/org/struts/RequestContext2.java" + root_uuid="uuid_4" + description="description2" + enabled="[false]" + copy_component_uuid="uuid_6" + developer_uuid="uuid_9" + authorization_updated_at="12345678910" + created_at="2014-06-18" + /> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/update.xml b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/update.xml index 68b1156822d..b944434940b 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/update.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoTest/update.xml @@ -1,11 +1,26 @@ <dataset> - <projects id="1" kee="org.struts:struts-core:src/org/struts/RequestContext.java" deprecated_kee="org.struts:struts-core:src/org/struts/RequestContext.java" - name="RequestContext.java" long_name="org.struts.RequestContext" - uuid="GHIJ" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH." - qualifier="FIL" scope="FIL" language="java" path="src/org/struts/RequestContext.java" root_uuid="uuid_3" - description="description" enabled="[true]" copy_component_uuid="uuid_5" developer_uuid="[null]" - authorization_updated_at="123456789" created_at="2014-06-18" - /> + <projects id="1" + kee="org.struts:struts-core:src/org/struts/RequestContext.java" + deprecated_kee="org.struts:struts-core:src/org/struts/RequestContext.java" + name="RequestContext.java" + long_name="org.struts.RequestContext" + uuid="GHIJ" + uuid_path="GHIJ." + project_uuid="ABCD" + module_uuid="EFGH" + module_uuid_path=".ABCD.EFGH." + qualifier="FIL" + scope="FIL" + language="java" + path="src/org/struts/RequestContext.java" + root_uuid="uuid_3" + description="description" + enabled="[true]" + copy_component_uuid="uuid_5" + developer_uuid="[null]" + authorization_updated_at="123456789" + created_at="2014-06-18" + /> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoWithDuplicatedKeysTest/schema.sql b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoWithDuplicatedKeysTest/schema.sql index 7a309ca3e32..8b56b010029 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoWithDuplicatedKeysTest/schema.sql +++ b/sonar-db/src/test/resources/org/sonar/db/component/ComponentDaoWithDuplicatedKeysTest/schema.sql @@ -2,6 +2,7 @@ CREATE TABLE "PROJECTS" ( "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "KEE" VARCHAR(400), "UUID" VARCHAR(50) NOT NULL, + "UUID_PATH" VARCHAR(4000) NOT NULL, "ROOT_UUID" VARCHAR(50) NOT NULL, "PROJECT_UUID" VARCHAR(50), "MODULE_UUID" VARCHAR(50), diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/fixture-including-ghost-projects-and-technical-project.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/fixture-including-ghost-projects-and-technical-project.xml index b3238a71341..8b14c356322 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/fixture-including-ghost-projects-and-technical-project.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/fixture-including-ghost-projects-and-technical-project.xml @@ -1,154 +1,412 @@ <dataset> <!-- root project --> - <projects id="1" root_uuid="ABCD" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - description="the description" long_name="Apache Struts" - uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path="." - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" + <projects id="1" + root_uuid="ABCD" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts" + description="the description" + long_name="Apache Struts" + uuid="ABCD" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path="." + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" authorization_updated_at="[null]"/> <snapshots id="1" uuid="u1" - component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path=""/> + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path=""/> <snapshots id="10" uuid="u10" - component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - status="P" islast="[false]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228136280000" build_date="1228136280000" - version="[null]" path=""/> + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + status="P" + islast="[false]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228136280000" + build_date="1228136280000" + version="[null]" + path=""/> <!-- project --> - <projects id="2" root_uuid="ABCD" kee="org.struts:struts-core" name="Struts Core" - scope="PRJ" qualifier="BRC" long_name="Struts Core" - uuid="EFGH" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD." - description="[null]" enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" + <projects id="2" + root_uuid="ABCD" + kee="org.struts:struts-core" + name="Struts Core" + scope="PRJ" + qualifier="BRC" + long_name="Struts Core" + uuid="EFGH" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path=".ABCD." + description="[null]" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" authorization_updated_at="[null]"/> <snapshots id="2" uuid="u2" - component_uuid="EFGH" parent_snapshot_id="1" root_component_uuid="ABCD" root_snapshot_id="1" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="BRC" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="1."/> + component_uuid="EFGH" + parent_snapshot_id="1" + root_component_uuid="ABCD" + root_snapshot_id="1" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="BRC" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="1."/> <!-- directory --> - <projects long_name="org.struts" id="3" scope="DIR" qualifier="PAC" kee="org.struts:struts:org.struts" - name="org.struts" root_uuid="ABCD" + <projects long_name="org.struts" + id="3" + scope="DIR" + qualifier="PAC" + kee="org.struts:struts:org.struts" + name="org.struts" + root_uuid="ABCD" description="[null]" - uuid="GHIJ" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH." - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" + uuid="GHIJ" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="EFGH" + module_uuid_path=".ABCD.EFGH." + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" authorization_updated_at="[null]"/> <snapshots id="3" uuid="u3" - component_uuid="GHIJ" parent_snapshot_id="2" root_component_uuid="ABCD" root_snapshot_id="1" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="DIR" qualifier="PAC" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="1.2."/> + component_uuid="GHIJ" + parent_snapshot_id="2" + root_component_uuid="ABCD" + root_snapshot_id="1" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="DIR" + qualifier="PAC" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="1.2."/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="4" scope="FIL" qualifier="CLA" + <projects long_name="org.struts.RequestContext" + id="4" + scope="FIL" + qualifier="CLA" kee="org.struts:struts:org.struts.RequestContext" - name="RequestContext" root_uuid="ABCD" - uuid="KLMN" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH." + name="RequestContext" + root_uuid="ABCD" + uuid="KLMN" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="EFGH" + module_uuid_path=".ABCD.EFGH." description="[null]" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" authorization_updated_at="[null]"/> <snapshots id="4" uuid="u4" - component_uuid="KLMN" parent_snapshot_id="3" root_component_uuid="ABCD" root_snapshot_id="1" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="FIL" qualifier="CLA" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="1.2.3."/> + component_uuid="KLMN" + parent_snapshot_id="3" + root_component_uuid="ABCD" + root_snapshot_id="1" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="FIL" + qualifier="CLA" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="1.2.3."/> <!-- technical project --> - <projects id="5" root_uuid="ABCD" scope="PRJ" qualifier="TRK" kee="COPYorg.struts:struts" name="Struts" - uuid="TECHPROJECT" project_uuid="[null]" module_uuid="[null]" module_uuid_path="." - description="the description" long_name="Apache Struts" - enabled="[true]" language="java" copy_component_uuid="ABCD" developer_uuid="[null]" authorization_updated_at="[null]"/> + <projects id="5" + root_uuid="ABCD" + scope="PRJ" + qualifier="TRK" + kee="COPYorg.struts:struts" + name="Struts" + uuid="TECHPROJECT" + uuid_path="NOT_USED" + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path="." + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="java" + copy_component_uuid="ABCD" + developer_uuid="[null]" + authorization_updated_at="[null]"/> <!-- project without snapshot status=P--> - <projects id="6" root_uuid="ABCD" scope="PRJ" qualifier="TRK" kee="org.apache.shindig" name="Shinding" - uuid="ONLYERRORS" project_uuid="[null]" module_uuid="[null]" module_uuid_path="." - description="the description" long_name="Shinding" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]"/> + <projects id="6" + root_uuid="ABCD" + scope="PRJ" + qualifier="TRK" + kee="org.apache.shindig" + name="Shinding" + uuid="ONLYERRORS" + uuid_path="NOT_USED" + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path="." + description="the description" + long_name="Shinding" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]"/> <snapshots id="6" uuid="u6" component_uuid="ONLYERRORS" - parent_snapshot_id="[null]" root_component_uuid="ONLYERRORS" root_snapshot_id="[null]" - status="U" islast="[false]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path=""/> + parent_snapshot_id="[null]" + root_component_uuid="ONLYERRORS" + root_snapshot_id="[null]" + status="U" + islast="[false]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path=""/> <snapshots id="7" uuid="u7" component_uuid="ONLYERRORS" - parent_snapshot_id="6" root_component_uuid="ONLYERRORS" root_snapshot_id="6" - status="U" islast="[false]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228309080000" build_date="1228309080000" - version="[null]" path=""/> + parent_snapshot_id="6" + root_component_uuid="ONLYERRORS" + root_snapshot_id="6" + status="U" + islast="[false]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228309080000" + build_date="1228309080000" + version="[null]" + path=""/> <!-- project without snapshot --> - <projects id="7" root_uuid="ABCD" kee="org.sample:sample" name="Sample" - scope="PRJ" qualifier="TRK" long_name="Sample" - uuid="NOSNAPSHOT" project_uuid="[null]" module_uuid="[null]" module_uuid_path="." - description="[null]" enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" + <projects id="7" + root_uuid="ABCD" + kee="org.sample:sample" + name="Sample" + scope="PRJ" + qualifier="TRK" + long_name="Sample" + uuid="NOSNAPSHOT" + uuid_path="NOT_USED" + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path="." + description="[null]" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" authorization_updated_at="[null]"/> <!-- project not enabled --> - <projects id="8" root_uuid="ABCD" scope="PRJ" qualifier="TRK" kee="org.apache:tika" name="Tika" - description="the description" long_name="Tika" - uuid="DISABLED" project_uuid="[null]" module_uuid="[null]" module_uuid_path="." - enabled="[false]" language="java" copy_component_uuid="[null]" developer_uuid="[null]"/> + <projects id="8" + root_uuid="ABCD" + scope="PRJ" + qualifier="TRK" + kee="org.apache:tika" + name="Tika" + description="the description" + long_name="Tika" + uuid="DISABLED" + uuid_path="NOT_USED" + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path="." + enabled="[false]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]"/> <snapshots id="8" uuid="u8" component_uuid="DISABLED" parent_snapshot_id="[null]" - root_component_uuid="DISABLED" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path=""/> + root_component_uuid="DISABLED" + root_snapshot_id="[null]" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path=""/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/fixture.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/fixture.xml index 7b250e47157..7a62069c356 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/fixture.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/fixture.xml @@ -1,15 +1,33 @@ <dataset> <!-- Struts projects is authorized for all user --> - <group_roles id="1" group_id="[null]" resource_id="1" role="user"/> + <group_roles id="1" + group_id="[null]" + resource_id="1" + role="user"/> <!-- root project --> - <projects id="1" root_uuid="ABCD" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path="." - description="the description" long_name="Apache Struts" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - created_at="2008-12-02" authorization_updated_at="123456789"/> + <projects id="1" + root_uuid="ABCD" + 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="." + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + created_at="2008-12-02" + authorization_updated_at="123456789"/> <snapshots id="1" uuid="u1" component_uuid="ABCD" @@ -19,13 +37,28 @@ status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path=""/> + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path=""/> <snapshots id="10" uuid="u10" component_uuid="ABCD" @@ -35,20 +68,49 @@ status="P" islast="[false]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228136280000" build_date="1228136280000" - version="[null]" path=""/> + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228136280000" + build_date="1228136280000" + version="[null]" + path=""/> <!-- module --> - <projects id="2" root_uuid="ABCD" kee="org.struts:struts-core" name="Struts Core" - uuid="BCDE" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD." - scope="PRJ" qualifier="BRC" long_name="Struts Core" - description="[null]" enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" - created_at="2008-12-02" authorization_updated_at="[null]"/> + <projects id="2" + root_uuid="ABCD" + kee="org.struts:struts-core" + name="Struts Core" + uuid="BCDE" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path=".ABCD." + scope="PRJ" + qualifier="BRC" + long_name="Struts Core" + description="[null]" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + created_at="2008-12-02" + authorization_updated_at="[null]"/> <snapshots id="2" uuid="u2" component_uuid="BCDE" @@ -58,21 +120,50 @@ status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="BRC" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="1."/> + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="BRC" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="1."/> <!-- directory --> - <projects long_name="org.struts" id="3" scope="DIR" qualifier="DIR" kee="org.struts:struts-core:src/org/struts" - uuid="CDEF" project_uuid="ABCD" module_uuid="BCDE" module_uuid_path=".ABCD.BCDE." - name="src/org/struts" root_uuid="BCDE" + <projects long_name="org.struts" + id="3" + scope="DIR" + qualifier="DIR" + kee="org.struts:struts-core:src/org/struts" + uuid="CDEF" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="BCDE" + module_uuid_path=".ABCD.BCDE." + name="src/org/struts" + root_uuid="BCDE" description="[null]" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="src/org/struts" - created_at="2008-12-02" authorization_updated_at="[null]"/> + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="src/org/struts" + created_at="2008-12-02" + authorization_updated_at="[null]"/> <snapshots id="3" uuid="u3" component_uuid="CDEF" @@ -82,23 +173,50 @@ status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="DIR" qualifier="PAC" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="1.2."/> + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="DIR" + qualifier="PAC" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="1.2."/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="4" scope="FIL" qualifier="FIL" + <projects long_name="org.struts.RequestContext" + id="4" + scope="FIL" + qualifier="FIL" kee="org.struts:struts-core:src/org/struts/RequestContext.java" - uuid="DEFG" project_uuid="ABCD" module_uuid="BCDE" module_uuid_path=".ABCD.BCDE." - name="RequestContext.java" root_uuid="BCDE" + uuid="DEFG" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="BCDE" + module_uuid_path=".ABCD.BCDE." + name="RequestContext.java" + root_uuid="BCDE" description="[null]" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" path="src/org/struts/RequestContext.java" - created_at="2008-12-02" authorization_updated_at="[null]"/> + created_at="2008-12-02" + authorization_updated_at="[null]"/> <snapshots id="4" uuid="u4" @@ -109,13 +227,28 @@ status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="FIL" qualifier="CLA" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="1.2.3."/> + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="FIL" + qualifier="CLA" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="1.2.3."/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/get_last_snapshot_by_component_uuid.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/get_last_snapshot_by_component_uuid.xml index 6a6e6ed94b9..6c8a84b0f21 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/get_last_snapshot_by_component_uuid.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/get_last_snapshot_by_component_uuid.xml @@ -1,95 +1,246 @@ <dataset> <!-- Struts projects is authorized for all user --> - <group_roles id="1" group_id="[null]" resource_id="1" role="user"/> + <group_roles id="1" + group_id="[null]" + resource_id="1" + role="user"/> <!-- root project --> - <projects id="1" root_id="[null]" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path="." - description="the description" long_name="Apache Struts" - enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" path="[null]" + <projects id="1" + root_id="[null]" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts" + uuid="ABCD" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path="." + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="java" + copy_resource_id="[null]" + person_id="[null]" + path="[null]" authorization_updated_at="[null]"/> <snapshots id="1" uuid="u1" - project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="[null]" - period1_mode="previous_analysis" period1_param="[null]" period1_date="[null]" - period2_mode="days" period2_param="30" period2_date="1316815200000" - period3_mode="days" period3_param="90" period3_date="1311631200000" - period4_mode="previous_analysis" period4_param="[null]" period4_date="[null]" - period5_mode="previous_version" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path=""/> + project_id="1" + parent_snapshot_id="[null]" + root_project_id="1" + root_snapshot_id="[null]" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="previous_analysis" + period1_param="[null]" + period1_date="[null]" + period2_mode="days" + period2_param="30" + period2_date="1316815200000" + period3_mode="days" + period3_param="90" + period3_date="1311631200000" + period4_mode="previous_analysis" + period4_param="[null]" + period4_date="[null]" + period5_mode="previous_version" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path=""/> <snapshots id="10" uuid="u10" - project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" - status="P" islast="[false]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228136280000" build_date="1228136280000" - version="[null]" path=""/> + project_id="1" + parent_snapshot_id="[null]" + root_project_id="1" + root_snapshot_id="[null]" + status="P" + islast="[false]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228136280000" + build_date="1228136280000" + version="[null]" + path=""/> <!-- module --> - <projects id="2" root_id="1" kee="org.struts:struts-core" name="Struts Core" - uuid="EFGH" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD." - scope="PRJ" qualifier="BRC" long_name="Struts Core" - description="[null]" enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" + <projects id="2" + root_id="1" + kee="org.struts:struts-core" + name="Struts Core" + uuid="EFGH" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path=".ABCD." + scope="PRJ" + qualifier="BRC" + long_name="Struts Core" + description="[null]" + enabled="[true]" + language="java" + copy_resource_id="[null]" + person_id="[null]" authorization_updated_at="[null]"/> <snapshots id="2" uuid="u2" - project_id="2" parent_snapshot_id="1" root_project_id="1" root_snapshot_id="1" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="BRC" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="1."/> + project_id="2" + parent_snapshot_id="1" + root_project_id="1" + root_snapshot_id="1" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="BRC" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="1."/> <!-- directory --> - <projects long_name="org.struts" id="3" scope="DIR" qualifier="DIR" kee="org.struts:struts-core:src/org/struts" - uuid="GHIJ" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH." - name="src/org/struts" root_id="2" + <projects long_name="org.struts" + id="3" + scope="DIR" + qualifier="DIR" + kee="org.struts:struts-core:src/org/struts" + uuid="GHIJ" + project_uuid="ABCD" + module_uuid="EFGH" + module_uuid_path=".ABCD.EFGH." + name="src/org/struts" + root_id="2" description="[null]" - enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" path="src/org/struts" + enabled="[true]" + language="java" + copy_resource_id="[null]" + person_id="[null]" + path="src/org/struts" authorization_updated_at="[null]"/> <snapshots id="3" uuid="u3" - project_id="3" parent_snapshot_id="2" root_project_id="1" root_snapshot_id="1" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="DIR" qualifier="PAC" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="1.2."/> + project_id="3" + parent_snapshot_id="2" + root_project_id="1" + root_snapshot_id="1" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="DIR" + qualifier="PAC" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="1.2."/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="4" scope="FIL" qualifier="FIL" + <projects long_name="org.struts.RequestContext" + id="4" + scope="FIL" + qualifier="FIL" kee="org.struts:struts-core:src/org/struts/RequestContext.java" - uuid="KLMN" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH." - name="RequestContext.java" root_id="2" + uuid="KLMN" + project_uuid="ABCD" + module_uuid="EFGH" + module_uuid_path=".ABCD.EFGH." + name="RequestContext.java" + root_id="2" description="[null]" - enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]" - path="src/org/struts/RequestContext.java" authorization_updated_at="[null]"/> + enabled="[true]" + language="java" + copy_resource_id="[null]" + person_id="[null]" + path="src/org/struts/RequestContext.java" + authorization_updated_at="[null]"/> <snapshots id="4" uuid="u4" - project_id="4" parent_snapshot_id="3" root_project_id="1" root_snapshot_id="1" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="FIL" qualifier="CLA" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="1.2.3."/> + project_id="4" + parent_snapshot_id="3" + root_project_id="1" + root_snapshot_id="1" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="FIL" + qualifier="CLA" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="1.2.3."/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date-result.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date-result.xml index 95b4c5b19cc..5766deb0c16 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date-result.xml @@ -1,9 +1,24 @@ <dataset> - <projects id="1" root_uuid="uuid_200" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path="." - scope="PRJ" qualifier="TRK" kee="old key" name="old name" - description="old name" long_name="old long name" - enabled="[false]" language="old" copy_component_uuid="uuid_2" developer_uuid="uuid_3" created_at="[null]" path="/old/foo/bar" + <projects id="1" + root_uuid="uuid_200" + uuid="ABCD" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path="." + scope="PRJ" + qualifier="TRK" + kee="old key" + name="old name" + description="old name" + long_name="old long name" + enabled="[false]" + language="old" + copy_component_uuid="uuid_2" + developer_uuid="uuid_3" + created_at="[null]" + path="/old/foo/bar" deprecated_kee="old deprecated key" authorization_updated_at="987654321"/> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date.xml index 239dcf719b1..4de09c833ce 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/update_authorization_date.xml @@ -1,9 +1,24 @@ <dataset> - <projects id="1" root_uuid="uuid_200" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path="." - scope="PRJ" qualifier="TRK" kee="old key" name="old name" - description="old name" long_name="old long name" - enabled="[false]" language="old" copy_component_uuid="uuid_2" developer_uuid="uuid_3" created_at="[null]" path="/old/foo/bar" + <projects id="1" + root_uuid="uuid_200" + uuid="ABCD" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path="." + scope="PRJ" + qualifier="TRK" + kee="old key" + name="old name" + description="old name" + long_name="old long name" + enabled="[false]" + language="old" + copy_component_uuid="uuid_2" + developer_uuid="uuid_3" + created_at="[null]" + path="/old/foo/bar" deprecated_kee="old deprecated key" authorization_updated_at="[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 221eb458280..6ce27f84f68 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,32 +1,184 @@ <dataset>IncreasePrecisionOfNumericsTest.update_column_types:48 <!-- Real projects --> - <projects id="1" uuid="ABCD" 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 id="2" uuid="BCDE" root_uuid="BCDE" project_uuid="BCDE" module_uuid_path=".BCDE." kee="project-two" copy_component_uuid="[null]" name="Project Two" qualifier="TRK" scope="PRJ"/> + <projects 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 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 id="3" uuid="CDEF" 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 id="4" uuid="DEFG" 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"/> + <projects 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 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 id="5" uuid="EFGH" root_uuid="EFGH" project_uuid="EFGH" module_uuid_path=".EFGH." kee="all-projects" copy_component_uuid="[null]" name="All projects" qualifier="VW" scope="PRJ"/> + <projects 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"/> + <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> 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 58553599c42..a21482b3613 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 @@ -1,81 +1,260 @@ <dataset> <!-- project "struts" -> module "struts-core" -> package org.struts -> file "RequestContext" --> - <projects 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="." + <projects 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]"/> + enabled="[true]" + language="java" + copy_resource_id="[null]" + person_id="[null]"/> - <projects long_name="[null]" id="2" scope="PRJ" qualifier="BRC" kee="org.struts:struts-core" name="Struts Core" - uuid="BCDE" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path=".ABCD." + <projects 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]"/> + 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 long_name="org.struts" id="3" scope="DIR" qualifier="PAC" kee="org.struts:struts-core:org.struts" - uuid="CDEF" project_uuid="ABCD" module_uuid="BCDE" module_uuid_path=".ABCD.BCDE" - name="org.struts" root_id="2" + <projects long_name="org.struts" + id="3" + scope="DIR" + qualifier="PAC" + 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]"/> + enabled="[true]" + language="java" + copy_resource_id="[null]" + person_id="[null]"/> - <projects long_name="org.struts.RequestContext" id="4" scope="CLA" qualifier="CLA" - uuid="DEFG" project_uuid="ABCD" module_uuid="BCDE" module_uuid_path=".ABCD.BCDE" + <projects long_name="org.struts.RequestContext" + id="4" + scope="CLA" + qualifier="CLA" + 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" + name="RequestContext" + root_id="2" description="[null]" - enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" + language="java" + copy_resource_id="[null]" + person_id="[null]"/> <snapshots purge_status="[null]" id="1" uuid="u1" - islast="[true]" root_component_uuid="ABCD" project_id="1"/> + islast="[true]" + root_component_uuid="ABCD" + project_id="1"/> <snapshots purge_status="[null]" id="2" uuid="u2" - islast="[true]" root_component_uuid="ABCD" project_id="2"/> + islast="[true]" + root_component_uuid="ABCD" + project_id="2"/> <snapshots purge_status="[null]" id="3" uuid="u3" - islast="[true]" root_component_uuid="ABCD" project_id="3"/> + 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"/> + 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="CLA"/> - <resource_index kee="equestcontext" position="1" name_size="14" component_uuid="DEFG" root_component_uuid="ABCD" qualifier="CLA"/> - <resource_index kee="questcontext" position="2" name_size="14" component_uuid="DEFG" root_component_uuid="ABCD" qualifier="CLA"/> - <resource_index kee="uestcontext" position="3" name_size="14" component_uuid="DEFG" root_component_uuid="ABCD" qualifier="CLA"/> - <resource_index kee="estcontext" position="4" name_size="14" component_uuid="DEFG" root_component_uuid="ABCD" qualifier="CLA"/> - <resource_index kee="stcontext" position="5" name_size="14" component_uuid="DEFG" root_component_uuid="ABCD" qualifier="CLA"/> - <resource_index kee="tcontext" position="6" name_size="14" component_uuid="DEFG" root_component_uuid="ABCD" qualifier="CLA"/> - <resource_index kee="context" position="7" name_size="14" component_uuid="DEFG" root_component_uuid="ABCD" qualifier="CLA"/> - <resource_index kee="ontext" position="8" name_size="14" component_uuid="DEFG" root_component_uuid="ABCD" qualifier="CLA"/> - <resource_index kee="ntext" position="9" name_size="14" component_uuid="DEFG" root_component_uuid="ABCD" qualifier="CLA"/> - <resource_index kee="text" position="10" name_size="14" component_uuid="DEFG" root_component_uuid="ABCD" qualifier="CLA"/> - <resource_index kee="ext" position="11" name_size="14" component_uuid="DEFG" root_component_uuid="ABCD" qualifier="CLA"/> + <resource_index kee="requestcontext" + position="0" + name_size="14" + component_uuid="DEFG" + root_component_uuid="ABCD" + qualifier="CLA"/> + <resource_index kee="equestcontext" + position="1" + name_size="14" + component_uuid="DEFG" + root_component_uuid="ABCD" + qualifier="CLA"/> + <resource_index kee="questcontext" + position="2" + name_size="14" + component_uuid="DEFG" + root_component_uuid="ABCD" + qualifier="CLA"/> + <resource_index kee="uestcontext" + position="3" + name_size="14" + component_uuid="DEFG" + root_component_uuid="ABCD" + qualifier="CLA"/> + <resource_index kee="estcontext" + position="4" + name_size="14" + component_uuid="DEFG" + root_component_uuid="ABCD" + qualifier="CLA"/> + <resource_index kee="stcontext" + position="5" + name_size="14" + component_uuid="DEFG" + root_component_uuid="ABCD" + qualifier="CLA"/> + <resource_index kee="tcontext" + position="6" + name_size="14" + component_uuid="DEFG" + root_component_uuid="ABCD" + qualifier="CLA"/> + <resource_index kee="context" + position="7" + name_size="14" + component_uuid="DEFG" + root_component_uuid="ABCD" + qualifier="CLA"/> + <resource_index kee="ontext" + position="8" + name_size="14" + component_uuid="DEFG" + root_component_uuid="ABCD" + qualifier="CLA"/> + <resource_index kee="ntext" + position="9" + name_size="14" + component_uuid="DEFG" + root_component_uuid="ABCD" + qualifier="CLA"/> + <resource_index kee="text" + position="10" + name_size="14" + component_uuid="DEFG" + root_component_uuid="ABCD" + qualifier="CLA"/> + <resource_index kee="ext" + position="11" + name_size="14" + component_uuid="DEFG" + root_component_uuid="ABCD" + qualifier="CLA"/> <!-- 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"/> + <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"/> + <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> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexMultiModulesProject.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexMultiModulesProject.xml index ff43af42c18..69706bb423c 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexMultiModulesProject.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexMultiModulesProject.xml @@ -1,46 +1,93 @@ <dataset> <!-- project "struts" -> module "struts-core" -> package org.struts -> file "RequestContext" --> - <projects 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="." + <projects 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" /> + enabled="[true]" + language="java"/> - <projects long_name="[null]" id="2" scope="PRJ" qualifier="BRC" kee="org.struts:struts-core" name="Struts Core" - uuid="BCDE" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path=".ABCD." + <projects 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" /> + enabled="[true]" + language="java"/> <!-- note that the root_id of package/file is wrong. It references the module but not the root project --> - <projects long_name="org.struts" id="3" scope="DIR" qualifier="PAC" kee="org.struts:struts-core:org.struts" - uuid="CDEF" project_uuid="ABCD" module_uuid="BCDE" module_uuid_path=".ABCD.BCDE" - name="org.struts" root_uuid="BCDE" + <projects long_name="org.struts" + id="3" + scope="DIR" + qualifier="PAC" + 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" /> + enabled="[true]" + language="java"/> - <projects long_name="org.struts.RequestContext" id="4" scope="FIL" qualifier="CLA" - uuid="DEFG" project_uuid="ABCD" module_uuid="BCDE" module_uuid_path=".ABCD.BCDE" + <projects long_name="org.struts.RequestContext" + id="4" + scope="FIL" + qualifier="CLA" + 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" + name="RequestContext" + root_uuid="BCDE" description="[null]" - enabled="[true]" language="java" /> + enabled="[true]" + language="java"/> <snapshots purge_status="[null]" id="1" uuid="u1" - islast="[true]" root_component_uuid="ABCD" component_uuid="ABCD"/> + islast="[true]" + root_component_uuid="ABCD" + component_uuid="ABCD"/> <snapshots purge_status="[null]" id="2" uuid="u2" - islast="[true]" root_component_uuid="ABCD" component_uuid="BCDE"/> + islast="[true]" + root_component_uuid="ABCD" + component_uuid="BCDE"/> <snapshots purge_status="[null]" id="3" uuid="u3" - islast="[true]" root_component_uuid="ABCD" component_uuid="CDEF"/> + islast="[true]" + root_component_uuid="ABCD" + component_uuid="CDEF"/> <snapshots purge_status="[null]" id="4" uuid="u4" - islast="[true]" root_component_uuid="ABCD" component_uuid="DEFG"/> + islast="[true]" + root_component_uuid="ABCD" + component_uuid="DEFG"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexProjects-result.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexProjects-result.xml index 9b08be4a746..8e9ee106f7e 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexProjects-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexProjects-result.xml @@ -1,61 +1,184 @@ <dataset> <!-- project --> - <projects 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="." + <projects 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]"/> + enabled="[true]" + language="java" + copy_resource_id="[null]" + person_id="[null]"/> <!-- directory --> - <projects long_name="org.struts" id="2" scope="DIR" qualifier="PAC" kee="org.struts:struts:org.struts" - uuid="BCDE" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path=".ABCD." - name="org.struts" root_id="1" + <projects 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]"/> + enabled="[true]" + language="java" + copy_resource_id="[null]" + person_id="[null]"/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="3" scope="CLA" qualifier="CLA" - uuid="CDEF" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path=".ABCD." + <projects 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" + name="RequestContext" + root_id="1" description="[null]" - enabled="[true]" language="java" copy_resource_id="[null]" person_id="[null]"/> + enabled="[true]" + language="java" + copy_resource_id="[null]" + person_id="[null]"/> <snapshots purge_status="[null]" id="1" uuid="u1" - islast="[true]" root_project_id="1" project_id="1" scope="PRJ" + islast="[true]" + root_project_id="1" + project_id="1" + scope="PRJ" qualifier="TRK"/> <snapshots purge_status="[null]" id="2" uuid="u2" - islast="[true]" root_project_id="1" project_id="2" scope="DIR" + islast="[true]" + root_project_id="1" + project_id="2" + scope="DIR" qualifier="PAC"/> <snapshots purge_status="[null]" id="3" uuid="u3" - islast="[true]" root_project_id="1" project_id="3" scope="CLA" + islast="[true]" + root_project_id="1" + project_id="3" + scope="CLA" qualifier="CLA"/> <!-- 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"/> + <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"/> + <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> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexProjects.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexProjects.xml index 0043b4ced0b..47c28bf4459 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexProjects.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldIndexProjects.xml @@ -1,31 +1,80 @@ <dataset> <!-- project --> - <projects 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="." + <projects 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]"/> + enabled="[true]" + language="java" + copy_resource_id="[null]" + person_id="[null]"/> <!-- directory --> - <projects long_name="org.struts" id="2" scope="DIR" qualifier="PAC" kee="org.struts:struts:org.struts" - uuid="BCDE" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path=".ABCD." - name="org.struts" root_id="1" + <projects 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]"/> + enabled="[true]" + language="java" + copy_resource_id="[null]" + person_id="[null]"/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="3" scope="FIL" qualifier="CLA" + <projects long_name="org.struts.RequestContext" + id="3" + scope="FIL" + qualifier="CLA" kee="org.struts:struts:org.struts.RequestContext" - uuid="CDEF" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path=".ABCD." - name="RequestContext" root_id="1" + 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]"/> + 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" + <snapshots purge_status="[null]" + id="1" + islast="[true]" + root_project_id="1" + project_id="1" + scope="PRJ" qualifier="TRK"/> - <snapshots purge_status="[null]" id="2" islast="[true]" root_project_id="1" project_id="2" scope="DIR" + <snapshots purge_status="[null]" + id="2" + islast="[true]" + root_project_id="1" + project_id="2" + scope="DIR" qualifier="PAC"/> - <snapshots purge_status="[null]" id="3" islast="[true]" root_project_id="1" project_id="3" scope="FIL" + <snapshots purge_status="[null]" + id="3" + islast="[true]" + root_project_id="1" + project_id="3" + scope="FIL" qualifier="CLA"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldNotIndexPackages.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldNotIndexPackages.xml index 60d7f6aa5ae..ee07faf3fc8 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldNotIndexPackages.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceIndexDaoTest/shouldNotIndexPackages.xml @@ -1,41 +1,78 @@ <dataset> <!-- project --> - <projects 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="." + <projects 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" /> + enabled="[true]" + language="java"/> <!-- directory --> - <projects long_name="org.struts" id="2" scope="DIR" qualifier="PAC" kee="org.struts:struts:org.struts" - uuid="BCDE" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path=".ABCD." - name="org.struts" root_uuid="ABCD" + <projects 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_uuid="ABCD" description="[null]" - enabled="[true]" language="java" /> + enabled="[true]" + language="java"/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="3" scope="FIL" qualifier="CLA" + <projects long_name="org.struts.RequestContext" + id="3" + scope="FIL" + qualifier="CLA" kee="org.struts:struts:org.struts.RequestContext" - uuid="CDEF" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path=".ABCD." - name="RequestContext" root_uuid="1" + 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" /> + enabled="[true]" + language="java"/> <snapshots purge_status="[null]" id="1" uuid="u1" - islast="[true]" root_component_uuid="ABCD" component_uuid="ABCD" scope="PRJ" + islast="[true]" + root_component_uuid="ABCD" + component_uuid="ABCD" + scope="PRJ" qualifier="TRK"/> <snapshots purge_status="[null]" id="2" uuid="u2" - islast="[true]" root_component_uuid="ABCD" component_uuid="BCDE" scope="DIR" + islast="[true]" + root_component_uuid="ABCD" + component_uuid="BCDE" + scope="DIR" qualifier="PAC"/> <snapshots purge_status="[null]" id="3" islast="[true]" uuid="u3" - root_component_uuid="ABCD" component_uuid="CDEF" scope="FIL" + root_component_uuid="ABCD" + component_uuid="CDEF" + scope="FIL" qualifier="CLA"/> </dataset> 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 6cd09bb7cf9..299bf889424 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 @@ -1,21 +1,58 @@ <dataset> - <projects long_name="[null]" id="1" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="AS" - uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path="." + <projects 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"/> + enabled="[true]" + language="java"/> <snapshots purge_status="[null]" id="1" uuid="u1" - islast="[true]" root_component_uuid="ABCD" component_uuid="ABCD" scope="PRJ" + islast="[true]" + root_component_uuid="ABCD" + component_uuid="ABCD" + scope="PRJ" qualifier="TRK"/> <!-- 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"/> + <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> 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 320106fb845..398708f17d1 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 @@ -1,18 +1,37 @@ <dataset> - <projects long_name="[null]" id="1" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="AS" - uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path="." + <projects 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" /> + enabled="[true]" + language="java"/> <snapshots purge_status="[null]" id="1" uuid="u1" - islast="[true]" root_component_uuid="ABCD" component_uuid="ABCD" scope="PRJ" + islast="[true]" + root_component_uuid="ABCD" + component_uuid="ABCD" + scope="PRJ" qualifier="TRK"/> <!-- 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"/> + <resource_index id="1" + kee="st" + position="0" + name_size="2" + component_uuid="ABCD" + root_component_uuid="ABCD" + qualifier="TRK"/> </dataset> 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 a4981c2ff93..a0ce846a5f8 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 @@ -1,26 +1,97 @@ <dataset> - <projects long_name="[null]" id="1" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Apache Struts" - uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path="." + <projects 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]"/> + enabled="[true]" + language="java" + copy_resource_id="[null]" + person_id="[null]"/> - <snapshots purge_status="[null]" id="1" + <snapshots purge_status="[null]" + id="1" uuid="u1" - islast="[true]" root_project_id="1" project_id="1" scope="PRJ" + islast="[true]" + root_project_id="1" + project_id="1" + scope="PRJ" qualifier="TRK"/> - <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"/> + <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> 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 31c50efeb96..7bf937a81b3 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 @@ -1,21 +1,58 @@ <dataset> - <projects long_name="[null]" id="1" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Apache Struts" - uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path="." + <projects 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" /> + enabled="[true]" + language="java"/> <snapshots purge_status="[null]" id="1" uuid="u1" - islast="[true]" root_component_uuid="ABCD" component_uuid="ABCD" scope="PRJ" + islast="[true]" + root_component_uuid="ABCD" + component_uuid="ABCD" + scope="PRJ" qualifier="TRK"/> <!-- 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"/> + <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> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shared.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shared.xml index 9e8d45b55c0..9ee0181a4d9 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shared.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shared.xml @@ -1,72 +1,174 @@ <dataset> <!-- root project --> - <projects id="1" root_uuid="A" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" uuid="A" - project_uuid="A" module_uuid="[null]" module_uuid_path="." - description="[null]" long_name="Apache Struts" - enabled="[true]" language="java" created_at="[null]" - path="[null]" deprecated_kee="org.struts:struts" + <projects id="1" + root_uuid="A" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts" + uuid="A" + uuid_path="A." + project_uuid="A" + module_uuid="[null]" + module_uuid_path="." + description="[null]" + long_name="Apache Struts" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="org.struts:struts" authorization_updated_at="[null]"/> -² + ² <!-- **************** First sub project **************** --> - <projects id="2" root_uuid="A" kee="org.struts:struts-core" name="Struts Core" uuid="B" project_uuid="A" - module_uuid="[null]" module_uuid_path=".A." - scope="PRJ" qualifier="BRC" long_name="Struts Core" - description="[null]" enabled="[true]" language="java" - created_at="[null]" path="[null]" deprecated_kee="org.struts:struts-core" + <projects id="2" + root_uuid="A" + kee="org.struts:struts-core" + name="Struts Core" + uuid="B" + uuid_path="A.B." + project_uuid="A" + module_uuid="[null]" + module_uuid_path=".A." + scope="PRJ" + qualifier="BRC" + long_name="Struts Core" + description="[null]" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="org.struts:struts-core" authorization_updated_at="[null]"/> <!-- directory --> - <projects long_name="org.struts" id="3" scope="DIR" qualifier="DIR" kee="org.struts:struts-core:/src/org/struts" - name="org.struts" root_uuid="B" uuid="C" project_uuid="A" module_uuid="B" module_uuid_path=".A.B." + <projects long_name="org.struts" + id="3" + scope="DIR" + qualifier="DIR" + kee="org.struts:struts-core:/src/org/struts" + name="org.struts" + root_uuid="B" + uuid="C" + uuid_path="A.B.C." + project_uuid="A" + module_uuid="B" + module_uuid_path=".A.B." description="[null]" - enabled="[true]" language="java" created_at="[null]" - path="[null]" deprecated_kee="org.struts:struts-core:org.struts" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="org.struts:struts-core:org.struts" authorization_updated_at="[null]"/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="4" scope="FIL" qualifier="CLA" + <projects long_name="org.struts.RequestContext" + id="4" + scope="FIL" + qualifier="CLA" kee="org.struts:struts-core:/src/org/struts/RequestContext.java" - name="RequestContext" root_uuid="B" uuid="D" project_uuid="A" module_uuid="B" module_uuid_path=".A.B." + name="RequestContext" + root_uuid="B" + uuid="D" + uuid_path="A.B.C.D." + project_uuid="A" + module_uuid="B" + module_uuid_path=".A.B." description="[null]" - enabled="[true]" language="java" created_at="[null]" - path="[null]" deprecated_kee="org.struts:struts-core:org.struts.RequestContext" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="org.struts:struts-core:org.struts.RequestContext" authorization_updated_at="[null]"/> <!-- **************** Second sub project **************** --> - <projects id="5" root_uuid="A" kee="org.struts:struts-ui" name="Struts UI" uuid="E" project_uuid="[null]" - module_uuid="[null]" module_uuid_path=".E." - scope="PRJ" qualifier="BRC" long_name="Struts UI" - description="[null]" enabled="[true]" language="java" - created_at="[null]" path="[null]" deprecated_kee="org.struts:struts-ui" + <projects id="5" + root_uuid="A" + kee="org.struts:struts-ui" + name="Struts UI" + uuid="E" + uuid_path="A.E." + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path=".E." + scope="PRJ" + qualifier="BRC" + long_name="Struts UI" + description="[null]" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="org.struts:struts-ui" authorization_updated_at="[null]"/> <!-- directory --> - <projects long_name="org.struts" id="6" scope="DIR" qualifier="DIR" kee="org.struts:struts-ui:/src/org/struts" - name="org.struts" root_uuid="E" uuid="F" project_uuid="[null]" module_uuid="[null]" module_uuid_path=".E." + <projects long_name="org.struts" + id="6" + scope="DIR" + qualifier="DIR" + kee="org.struts:struts-ui:/src/org/struts" + name="org.struts" + root_uuid="E" + uuid="F" + uuid_path="A.E.F." + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path=".E." description="[null]" - enabled="[true]" language="java" created_at="[null]" - path="[null]" deprecated_kee="org.struts:struts-ui:org.struts" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="org.struts:struts-ui:org.struts" authorization_updated_at="[null]"/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="7" scope="FIL" qualifier="CLA" + <projects long_name="org.struts.RequestContext" + id="7" + scope="FIL" + qualifier="CLA" kee="org.struts:struts-ui:/src/org/struts/RequestContext.java" - name="RequestContext" root_uuid="E" uuid="G" project_uuid="[null]" module_uuid="[null]" module_uuid_path=".E." + name="RequestContext" + root_uuid="E" + uuid="G" + uuid_path="A.E.F.G." + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path=".E." description="[null]" - enabled="[true]" language="java" created_at="[null]" - path="[null]" deprecated_kee="org.struts:struts-ui:org.struts.RequestContext" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="org.struts:struts-ui:org.struts.RequestContext" authorization_updated_at="[null]"/> <!-- **************** Another independent project **************** --> - <projects id="8" root_uuid="A" kee="foo:struts-core" name="Foo Struts Core" uuid="H" project_uuid="[null]" - module_uuid="[null]" module_uuid_path=".H." - scope="PRJ" qualifier="BRC" long_name="Foo Struts Core" - description="[null]" enabled="[true]" language="java" - created_at="[null]" path="[null]" deprecated_kee="foo:struts-core" + <projects id="8" + root_uuid="A" + kee="foo:struts-core" + name="Foo Struts Core" + uuid="H" + uuid_path="H." + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path=".H." + scope="PRJ" + qualifier="BRC" + long_name="Foo Struts Core" + description="[null]" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="foo:struts-core" authorization_updated_at="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shouldBulkUpdateKey-result.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shouldBulkUpdateKey-result.xml index 6227c606fc2..b990ddeae8f 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shouldBulkUpdateKey-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shouldBulkUpdateKey-result.xml @@ -1,73 +1,190 @@ <dataset> <!-- root project --> - <projects id="1" root_uuid="A" scope="PRJ" qualifier="TRK" kee="org.apache.struts:struts" name="Struts" uuid="A" - project_uuid="A" module_uuid="[null]" module_uuid_path="." - description="[null]" long_name="Apache Struts" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" created_at="[null]" - path="[null]" deprecated_kee="org.apache.struts:struts" + <projects id="1" + root_uuid="A" + scope="PRJ" + qualifier="TRK" + kee="org.apache.struts:struts" + name="Struts" + uuid="A" + uuid_path="A." + project_uuid="A" + module_uuid="[null]" + module_uuid_path="." + description="[null]" + long_name="Apache Struts" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + created_at="[null]" + path="[null]" + deprecated_kee="org.apache.struts:struts" authorization_updated_at="[null]"/> <!-- **************** First sub project **************** --> - <projects id="2" root_uuid="A" kee="org.apache.struts:struts-core" name="Struts Core" uuid="B" project_uuid="A" - module_uuid="[null]" module_uuid_path=".A." - scope="PRJ" qualifier="BRC" long_name="Struts Core" - description="[null]" enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" - created_at="[null]" path="[null]" deprecated_kee="org.apache.struts:struts-core" + <projects id="2" + root_uuid="A" + kee="org.apache.struts:struts-core" + name="Struts Core" + uuid="B" + uuid_path="A.B." + project_uuid="A" + module_uuid="[null]" + module_uuid_path=".A." + scope="PRJ" + qualifier="BRC" + long_name="Struts Core" + description="[null]" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + created_at="[null]" + path="[null]" + deprecated_kee="org.apache.struts:struts-core" authorization_updated_at="[null]"/> <!-- directory --> - <projects long_name="org.struts" id="3" scope="DIR" qualifier="DIR" + <projects long_name="org.struts" + id="3" + scope="DIR" + qualifier="DIR" kee="org.apache.struts:struts-core:/src/org/struts" - name="org.struts" root_uuid="B" uuid="C" project_uuid="A" module_uuid="B" module_uuid_path=".A.B." + name="org.struts" + root_uuid="B" + uuid="C" + uuid_path="A.B.C." + project_uuid="A" + module_uuid="B" + module_uuid_path=".A.B." description="[null]" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" created_at="[null]" - path="[null]" deprecated_kee="org.apache.struts:struts-core:org.struts" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + created_at="[null]" + path="[null]" + deprecated_kee="org.apache.struts:struts-core:org.struts" authorization_updated_at="[null]"/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="4" scope="FIL" qualifier="CLA" + <projects long_name="org.struts.RequestContext" + id="4" + scope="FIL" + qualifier="CLA" kee="org.apache.struts:struts-core:/src/org/struts/RequestContext.java" - name="RequestContext" root_uuid="B" uuid="D" project_uuid="A" module_uuid="B" module_uuid_path=".A.B." + name="RequestContext" + root_uuid="B" + uuid="D" + uuid_path="A.B.C.D." + project_uuid="A" + module_uuid="B" + module_uuid_path=".A.B." description="[null]" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" created_at="[null]" - path="[null]" deprecated_kee="org.apache.struts:struts-core:org.struts.RequestContext" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + created_at="[null]" + path="[null]" + deprecated_kee="org.apache.struts:struts-core:org.struts.RequestContext" authorization_updated_at="[null]"/> <!-- **************** Second sub project **************** --> - <projects id="5" root_uuid="A" kee="org.apache.struts:struts-ui" name="Struts UI" uuid="E" project_uuid="[null]" - module_uuid="[null]" module_uuid_path=".E." - scope="PRJ" qualifier="BRC" long_name="Struts UI" - description="[null]" enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" - created_at="[null]" path="[null]" deprecated_kee="org.apache.struts:struts-ui" + <projects id="5" + root_uuid="A" + kee="org.apache.struts:struts-ui" + name="Struts UI" + uuid="E" + uuid_path="A.E." + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path=".E." + scope="PRJ" + qualifier="BRC" + long_name="Struts UI" + description="[null]" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + created_at="[null]" + path="[null]" + deprecated_kee="org.apache.struts:struts-ui" authorization_updated_at="[null]"/> <!-- directory --> - <projects long_name="org.struts" id="6" scope="DIR" qualifier="DIR" kee="org.apache.struts:struts-ui:/src/org/struts" - name="org.struts" root_uuid="E" uuid="F" project_uuid="[null]" module_uuid="[null]" module_uuid_path=".E." + <projects long_name="org.struts" + id="6" + scope="DIR" + qualifier="DIR" + kee="org.apache.struts:struts-ui:/src/org/struts" + name="org.struts" + root_uuid="E" + uuid="F" + uuid_path="A.E.F." + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path=".E." description="[null]" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" created_at="[null]" - path="[null]" deprecated_kee="org.apache.struts:struts-ui:org.struts" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + created_at="[null]" + path="[null]" + deprecated_kee="org.apache.struts:struts-ui:org.struts" authorization_updated_at="[null]"/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="7" scope="FIL" qualifier="CLA" + <projects long_name="org.struts.RequestContext" + id="7" + scope="FIL" + qualifier="CLA" kee="org.apache.struts:struts-ui:/src/org/struts/RequestContext.java" - name="RequestContext" root_uuid="E" uuid="G" project_uuid="[null]" module_uuid="[null]" module_uuid_path=".E." + name="RequestContext" + root_uuid="E" + uuid="G" + uuid_path="A.E.F.G." + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path=".E." description="[null]" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" created_at="[null]" - path="[null]" deprecated_kee="org.apache.struts:struts-ui:org.struts.RequestContext" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + created_at="[null]" + path="[null]" + deprecated_kee="org.apache.struts:struts-ui:org.struts.RequestContext" authorization_updated_at="[null]"/> <!-- **************** Another independent project **************** --> - <projects id="8" root_uuid="A" kee="foo:struts-core" name="Foo Struts Core" uuid="H" project_uuid="[null]" - module_uuid="[null]" module_uuid_path=".H." - scope="PRJ" qualifier="BRC" long_name="Foo Struts Core" - description="[null]" enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" - created_at="[null]" path="[null]" deprecated_kee="foo:struts-core" + <projects id="8" + root_uuid="A" + kee="foo:struts-core" + name="Foo Struts Core" + uuid="H" + uuid_path="H." + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path=".H." + scope="PRJ" + qualifier="BRC" + long_name="Foo Struts Core" + description="[null]" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + created_at="[null]" + path="[null]" + deprecated_kee="foo:struts-core" authorization_updated_at="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shouldBulkUpdateKeyOnOnlyOneSubmodule-result.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shouldBulkUpdateKeyOnOnlyOneSubmodule-result.xml index 1f15cb2d042..59f46c562df 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shouldBulkUpdateKeyOnOnlyOneSubmodule-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shouldBulkUpdateKeyOnOnlyOneSubmodule-result.xml @@ -1,72 +1,190 @@ <dataset> <!-- root project --> - <projects id="1" root_uuid="A" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" uuid="A" - project_uuid="A" module_uuid="[null]" module_uuid_path="." - description="[null]" long_name="Apache Struts" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" created_at="[null]" - path="[null]" deprecated_kee="org.struts:struts" + <projects id="1" + root_uuid="A" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts" + uuid="A" + uuid_path="A." + project_uuid="A" + module_uuid="[null]" + module_uuid_path="." + description="[null]" + long_name="Apache Struts" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + created_at="[null]" + path="[null]" + deprecated_kee="org.struts:struts" authorization_updated_at="[null]"/> <!-- **************** First sub project **************** --> - <projects id="2" root_uuid="A" kee="org.struts:struts-core" name="Struts Core" uuid="B" project_uuid="A" - module_uuid="[null]" module_uuid_path=".A." - scope="PRJ" qualifier="BRC" long_name="Struts Core" - description="[null]" enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" - created_at="[null]" path="[null]" deprecated_kee="org.struts:struts-core" + <projects id="2" + root_uuid="A" + kee="org.struts:struts-core" + name="Struts Core" + uuid="B" + uuid_path="A.B." + project_uuid="A" + module_uuid="[null]" + module_uuid_path=".A." + scope="PRJ" + qualifier="BRC" + long_name="Struts Core" + description="[null]" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + created_at="[null]" + path="[null]" + deprecated_kee="org.struts:struts-core" authorization_updated_at="[null]"/> <!-- directory --> - <projects long_name="org.struts" id="3" scope="DIR" qualifier="DIR" kee="org.struts:struts-core:/src/org/struts" - name="org.struts" root_uuid="B" uuid="C" project_uuid="A" module_uuid="B" module_uuid_path=".A.B." + <projects long_name="org.struts" + id="3" + scope="DIR" + qualifier="DIR" + kee="org.struts:struts-core:/src/org/struts" + name="org.struts" + root_uuid="B" + uuid="C" + uuid_path="A.B.C." + project_uuid="A" + module_uuid="B" + module_uuid_path=".A.B." description="[null]" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" created_at="[null]" - path="[null]" deprecated_kee="org.struts:struts-core:org.struts" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + created_at="[null]" + path="[null]" + deprecated_kee="org.struts:struts-core:org.struts" authorization_updated_at="[null]"/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="4" scope="FIL" qualifier="CLA" + <projects long_name="org.struts.RequestContext" + id="4" + scope="FIL" + qualifier="CLA" kee="org.struts:struts-core:/src/org/struts/RequestContext.java" - name="RequestContext" root_uuid="B" uuid="D" project_uuid="A" module_uuid="B" module_uuid_path=".A.B." + name="RequestContext" + root_uuid="B" + uuid="D" + uuid_path="A.B.C.D." + project_uuid="A" + module_uuid="B" + module_uuid_path=".A.B." description="[null]" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" created_at="[null]" - path="[null]" deprecated_kee="org.struts:struts-core:org.struts.RequestContext" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + created_at="[null]" + path="[null]" + deprecated_kee="org.struts:struts-core:org.struts.RequestContext" authorization_updated_at="[null]"/> <!-- **************** Second sub project **************** --> - <projects id="5" root_uuid="A" kee="org.struts:struts-web" name="Struts UI" uuid="E" project_uuid="[null]" - module_uuid="[null]" module_uuid_path=".E." - scope="PRJ" qualifier="BRC" long_name="Struts UI" - description="[null]" enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" - created_at="[null]" path="[null]" deprecated_kee="org.struts:struts-web" + <projects id="5" + root_uuid="A" + kee="org.struts:struts-web" + name="Struts UI" + uuid="E" + uuid_path="A.E." + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path=".E." + scope="PRJ" + qualifier="BRC" + long_name="Struts UI" + description="[null]" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + created_at="[null]" + path="[null]" + deprecated_kee="org.struts:struts-web" authorization_updated_at="[null]"/> <!-- directory --> - <projects long_name="org.struts" id="6" scope="DIR" qualifier="DIR" kee="org.struts:struts-web:/src/org/struts" - name="org.struts" root_uuid="E" uuid="F" project_uuid="[null]" module_uuid="[null]" module_uuid_path=".E." + <projects long_name="org.struts" + id="6" + scope="DIR" + qualifier="DIR" + kee="org.struts:struts-web:/src/org/struts" + name="org.struts" + root_uuid="E" + uuid="F" + uuid_path="A.E.F." + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path=".E." description="[null]" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" created_at="[null]" - path="[null]" deprecated_kee="org.struts:struts-web:org.struts" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + created_at="[null]" + path="[null]" + deprecated_kee="org.struts:struts-web:org.struts" authorization_updated_at="[null]"/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="7" scope="FIL" qualifier="CLA" + <projects long_name="org.struts.RequestContext" + id="7" + scope="FIL" + qualifier="CLA" kee="org.struts:struts-web:/src/org/struts/RequestContext.java" - name="RequestContext" root_uuid="E" uuid="G" project_uuid="[null]" module_uuid="[null]" module_uuid_path=".E." + name="RequestContext" + root_uuid="E" + uuid="G" + uuid_path="A.E.F.G." + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path=".E." description="[null]" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" created_at="[null]" - path="[null]" deprecated_kee="org.struts:struts-web:org.struts.RequestContext" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + created_at="[null]" + path="[null]" + deprecated_kee="org.struts:struts-web:org.struts.RequestContext" authorization_updated_at="[null]"/> <!-- **************** Another independent project **************** --> - <projects id="8" root_uuid="A" kee="foo:struts-core" name="Foo Struts Core" uuid="H" project_uuid="[null]" - module_uuid="[null]" module_uuid_path=".H." - scope="PRJ" qualifier="BRC" long_name="Foo Struts Core" - description="[null]" enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" - created_at="[null]" path="[null]" deprecated_kee="foo:struts-core" + <projects id="8" + root_uuid="A" + kee="foo:struts-core" + name="Foo Struts Core" + uuid="H" + uuid_path="H." + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path=".H." + scope="PRJ" + qualifier="BRC" + long_name="Foo Struts Core" + description="[null]" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + created_at="[null]" + path="[null]" + deprecated_kee="foo:struts-core" authorization_updated_at="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shouldNotUpdateAllSubmodules-result.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shouldNotUpdateAllSubmodules-result.xml index 85e1a75fe6c..5c768d3e957 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shouldNotUpdateAllSubmodules-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shouldNotUpdateAllSubmodules-result.xml @@ -1,64 +1,154 @@ <dataset> <!-- root project --> - <projects id="1" root_uuid="A" scope="PRJ" qualifier="TRK" kee="org.apache.struts:struts" name="Struts" uuid="A" - project_uuid="A" module_uuid="[null]" module_uuid_path="." - description="[null]" long_name="Apache Struts" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" created_at="[null]" - path="[null]" deprecated_kee="org.apache.struts:struts" + <projects id="1" + root_uuid="A" + scope="PRJ" + qualifier="TRK" + kee="org.apache.struts:struts" + name="Struts" + uuid="A" + uuid_path="A." + project_uuid="A" + module_uuid="[null]" + module_uuid_path="." + description="[null]" + long_name="Apache Struts" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + created_at="[null]" + path="[null]" + deprecated_kee="org.apache.struts:struts" authorization_updated_at="[null]"/> <!-- **************** First sub project **************** --> - <projects id="2" root_uuid="A" kee="org.apache.struts:struts-core" name="Struts Core" uuid="B" project_uuid="A" - module_uuid="[null]" module_uuid_path=".A." - scope="PRJ" qualifier="BRC" long_name="Struts Core" - description="[null]" enabled="[true]" language="java" - created_at="[null]" path="[null]" deprecated_kee="org.apache.struts:struts-core" + <projects id="2" + root_uuid="A" + kee="org.apache.struts:struts-core" + name="Struts Core" + uuid="B" + uuid_path="A.B." + project_uuid="A" + module_uuid="[null]" + module_uuid_path=".A." + scope="PRJ" + qualifier="BRC" + long_name="Struts Core" + description="[null]" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="org.apache.struts:struts-core" authorization_updated_at="[null]"/> <!-- directory --> - <projects long_name="org.struts" id="3" scope="DIR" qualifier="PAC" + <projects long_name="org.struts" + id="3" + scope="DIR" + qualifier="PAC" kee="org.apache.struts:struts-core:/src/org/struts" - name="org.struts" root_uuid="B" uuid="C" project_uuid="A" module_uuid="B" module_uuid_path=".A.B." + name="org.struts" + root_uuid="B" + uuid="C" + uuid_path="A.B.C." + project_uuid="A" + module_uuid="B" + module_uuid_path=".A.B." description="[null]" - enabled="[true]" language="java" created_at="[null]" - path="[null]" deprecated_kee="org.apache.struts:struts-core:org.struts" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="org.apache.struts:struts-core:org.struts" authorization_updated_at="[null]"/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="4" scope="FIL" qualifier="CLA" + <projects long_name="org.struts.RequestContext" + id="4" + scope="FIL" + qualifier="CLA" kee="org.apache.struts:struts-core:/src/org/struts/RequestContext.java" - name="RequestContext" root_uuid="B" uuid="D" project_uuid="A" module_uuid="B" module_uuid_path=".A.B." + name="RequestContext" + root_uuid="B" + uuid="D" + uuid_path="A.B.C.D." + project_uuid="A" + module_uuid="B" + module_uuid_path=".A.B." description="[null]" - enabled="[true]" language="java" created_at="[null]" - path="[null]" deprecated_kee="org.apache.struts:struts-core:org.struts.RequestContext" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="org.apache.struts:struts-core:org.struts.RequestContext" authorization_updated_at="[null]"/> <!-- **************** Second sub project THAT HAS A DIFFERENT GROUP ID => MUST NOT BE UPDATED **************** --> - <projects id="5" root_uuid="A" kee="foo:struts-ui" name="Struts UI" uuid="E" project_uuid="[null]" module_uuid="[null]" + <projects id="5" + root_uuid="A" + kee="foo:struts-ui" + name="Struts UI" + uuid="E" + uuid_path="A.E." + project_uuid="[null]" + module_uuid="[null]" module_uuid_path=".E." - scope="PRJ" qualifier="BRC" long_name="Struts UI" - description="[null]" enabled="[true]" language="java" - created_at="[null]" path="[null]" deprecated_kee="foo:struts-ui" + scope="PRJ" + qualifier="BRC" + long_name="Struts UI" + description="[null]" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="foo:struts-ui" authorization_updated_at="[null]"/> <!-- directory --> - <projects long_name="org.struts" id="6" scope="DIR" qualifier="PAC" kee="foo:struts-ui:/src/org/struts" - name="org.struts" root_uuid="E" uuid="F" project_uuid="[null]" module_uuid="[null]" module_uuid_path=".E." + <projects long_name="org.struts" + id="6" + scope="DIR" + qualifier="PAC" + kee="foo:struts-ui:/src/org/struts" + name="org.struts" + root_uuid="E" + uuid="F" + uuid_path="A.E.F." + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path=".E." description="[null]" - enabled="[true]" language="java" created_at="[null]" - path="[null]" deprecated_kee="foo:struts-ui:org.struts" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="foo:struts-ui:org.struts" authorization_updated_at="[null]"/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="7" scope="FIL" qualifier="CLA" + <projects long_name="org.struts.RequestContext" + id="7" + scope="FIL" + qualifier="CLA" kee="foo:struts-ui:/src/org/struts/RequestContext.java" - name="RequestContext" root_uuid="E" uuid="G" project_uuid="[null]" module_uuid="[null]" module_uuid_path=".E." + name="RequestContext" + root_uuid="E" + uuid="G" + uuid_path="A.E.F.G." + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path=".E." description="[null]" - enabled="[true]" language="java" created_at="[null]" - path="[null]" deprecated_kee="foo:struts-ui:org.struts.RequestContext" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="foo:struts-ui:org.struts.RequestContext" authorization_updated_at="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shouldNotUpdateAllSubmodules.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shouldNotUpdateAllSubmodules.xml index 226d5faaa08..c9435636334 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shouldNotUpdateAllSubmodules.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shouldNotUpdateAllSubmodules.xml @@ -1,63 +1,152 @@ <dataset> <!-- root project --> - <projects id="1" root_uuid="A" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" uuid="A" - project_uuid="A" module_uuid="[null]" module_uuid_path="." - description="[null]" long_name="Apache Struts" - enabled="[true]" language="java" created_at="[null]" - path="[null]" deprecated_kee="org.struts:struts" + <projects id="1" + root_uuid="A" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts" + uuid="A" + uuid_path="A." + project_uuid="A" + module_uuid="[null]" + module_uuid_path="." + description="[null]" + long_name="Apache Struts" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="org.struts:struts" authorization_updated_at="[null]"/> <!-- **************** First sub project **************** --> - <projects id="2" root_uuid="A" kee="org.struts:struts-core" name="Struts Core" uuid="B" project_uuid="A" - module_uuid="[null]" module_uuid_path=".A." - scope="PRJ" qualifier="BRC" long_name="Struts Core" - description="[null]" enabled="[true]" language="java" - created_at="[null]" path="[null]" deprecated_kee="org.struts:struts-core" + <projects id="2" + root_uuid="A" + kee="org.struts:struts-core" + name="Struts Core" + uuid="B" + uuid_path="A.B." + project_uuid="A" + module_uuid="[null]" + module_uuid_path=".A." + scope="PRJ" + qualifier="BRC" + long_name="Struts Core" + description="[null]" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="org.struts:struts-core" authorization_updated_at="[null]"/> <!-- directory --> - <projects long_name="org.struts" id="3" scope="DIR" qualifier="PAC" kee="org.struts:struts-core:/src/org/struts" - name="org.struts" root_uuid="B" uuid="C" project_uuid="A" module_uuid="B" module_uuid_path=".A.B." + <projects long_name="org.struts" + id="3" + scope="DIR" + qualifier="PAC" + kee="org.struts:struts-core:/src/org/struts" + name="org.struts" + root_uuid="B" + uuid="C" + uuid_path="A.B.C." + project_uuid="A" + module_uuid="B" + module_uuid_path=".A.B." description="[null]" - enabled="[true]" language="java" created_at="[null]" - path="[null]" deprecated_kee="org.struts:struts-core:org.struts" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="org.struts:struts-core:org.struts" authorization_updated_at="[null]"/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="4" scope="FIL" qualifier="CLA" + <projects long_name="org.struts.RequestContext" + id="4" + scope="FIL" + qualifier="CLA" kee="org.struts:struts-core:/src/org/struts/RequestContext.java" - name="RequestContext" root_uuid="B" uuid="D" project_uuid="A" module_uuid="B" module_uuid_path=".A.B." + name="RequestContext" + root_uuid="B" + uuid="D" + uuid_path="A.B.C.D." + project_uuid="A" + module_uuid="B" + module_uuid_path=".A.B." description="[null]" - enabled="[true]" language="java" created_at="[null]" - path="[null]" deprecated_kee="org.struts:struts-core:org.struts.RequestContext" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="org.struts:struts-core:org.struts.RequestContext" authorization_updated_at="[null]"/> <!-- **************** Second sub project THAT HAS A DIFFERENT GROUP ID => MUST NOT BE UPDATED **************** --> - <projects id="5" root_uuid="A" kee="foo:struts-ui" name="Struts UI" uuid="E" project_uuid="[null]" module_uuid="[null]" + <projects id="5" + root_uuid="A" + kee="foo:struts-ui" + name="Struts UI" + uuid="E" + uuid_path="A.E." + project_uuid="[null]" + module_uuid="[null]" module_uuid_path=".E." - scope="PRJ" qualifier="BRC" long_name="Struts UI" - description="[null]" enabled="[true]" language="java" - created_at="[null]" path="[null]" deprecated_kee="foo:struts-ui" + scope="PRJ" + qualifier="BRC" + long_name="Struts UI" + description="[null]" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="foo:struts-ui" authorization_updated_at="[null]"/> <!-- directory --> - <projects long_name="org.struts" id="6" scope="DIR" qualifier="PAC" kee="foo:struts-ui:/src/org/struts" - name="org.struts" root_uuid="E" uuid="F" project_uuid="[null]" module_uuid="[null]" module_uuid_path=".E." + <projects long_name="org.struts" + id="6" + scope="DIR" + qualifier="PAC" + kee="foo:struts-ui:/src/org/struts" + name="org.struts" + root_uuid="E" + uuid="F" + uuid_path="A.E.F." + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path=".E." description="[null]" - enabled="[true]" language="java" created_at="[null]" - path="[null]" deprecated_kee="foo:struts-ui:org.struts" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="foo:struts-ui:org.struts" authorization_updated_at="[null]"/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="7" scope="FIL" qualifier="CLA" + <projects long_name="org.struts.RequestContext" + id="7" + scope="FIL" + qualifier="CLA" kee="foo:struts-ui:/src/org/struts/RequestContext.java" - name="RequestContext" root_uuid="E" uuid="G" project_uuid="[null]" module_uuid="[null]" module_uuid_path=".E." + name="RequestContext" + root_uuid="E" + uuid="G" + uuid_path="A.E.F.G." + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path=".E." description="[null]" - enabled="[true]" language="java" created_at="[null]" - path="[null]" deprecated_kee="foo:struts-ui:org.struts.RequestContext" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="foo:struts-ui:org.struts.RequestContext" authorization_updated_at="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shouldUpdateKey-result.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shouldUpdateKey-result.xml index b5e560f47e5..ea851c10683 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shouldUpdateKey-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/ResourceKeyUpdaterDaoTest/shouldUpdateKey-result.xml @@ -1,74 +1,178 @@ <dataset> <!-- root project --> - <projects id="1" root_uuid="A" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" uuid="A" - project_uuid="A" module_uuid="[null]" module_uuid_path="." - description="[null]" long_name="Apache Struts" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" created_at="[null]" - path="[null]" deprecated_kee="org.struts:struts" + <projects id="1" + root_uuid="A" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts" + uuid="A" + uuid_path="A." + project_uuid="A" + module_uuid="[null]" + module_uuid_path="." + description="[null]" + long_name="Apache Struts" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + created_at="[null]" + path="[null]" + deprecated_kee="org.struts:struts" authorization_updated_at="[null]"/> <!-- **************** First sub project **************** --> <!-- ONLY THIS PROJECT MUST HAVE BEEN UPDATED --> <!-- --> - <projects id="2" root_uuid="A" kee="struts:core" name="Struts Core" uuid="B" project_uuid="A" module_uuid="[null]" + <projects id="2" + root_uuid="A" + kee="struts:core" + name="Struts Core" + uuid="B" + uuid_path="A.B." + project_uuid="A" + module_uuid="[null]" module_uuid_path=".A." - scope="PRJ" qualifier="BRC" long_name="Struts Core" - description="[null]" enabled="[true]" language="java" - created_at="[null]" path="[null]" deprecated_kee="struts:core" + scope="PRJ" + qualifier="BRC" + long_name="Struts Core" + description="[null]" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="struts:core" authorization_updated_at="[null]"/> <!-- directory --> - <projects long_name="org.struts" id="3" scope="DIR" qualifier="DIR" kee="struts:core:/src/org/struts" - name="org.struts" root_uuid="B" uuid="C" project_uuid="A" module_uuid="B" module_uuid_path=".A.B." + <projects long_name="org.struts" + id="3" + scope="DIR" + qualifier="DIR" + kee="struts:core:/src/org/struts" + name="org.struts" + root_uuid="B" + uuid="C" + uuid_path="A.B.C." + project_uuid="A" + module_uuid="B" + module_uuid_path=".A.B." description="[null]" - enabled="[true]" language="java" created_at="[null]" - path="[null]" deprecated_kee="struts:core:org.struts" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="struts:core:org.struts" authorization_updated_at="[null]"/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="4" scope="FIL" qualifier="CLA" + <projects long_name="org.struts.RequestContext" + id="4" + scope="FIL" + qualifier="CLA" kee="struts:core:/src/org/struts/RequestContext.java" - name="RequestContext" root_uuid="B" uuid="D" project_uuid="A" module_uuid="B" module_uuid_path=".A.B." + name="RequestContext" + root_uuid="B" + uuid="D" + uuid_path="A.B.C.D." + project_uuid="A" + module_uuid="B" + module_uuid_path=".A.B." description="[null]" - enabled="[true]" language="java" created_at="[null]" - path="[null]" deprecated_kee="struts:core:org.struts.RequestContext" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="struts:core:org.struts.RequestContext" authorization_updated_at="[null]"/> <!-- **************** Second sub project **************** --> - <projects id="5" root_uuid="A" kee="org.struts:struts-ui" name="Struts UI" uuid="E" project_uuid="[null]" - module_uuid="[null]" module_uuid_path=".E." - scope="PRJ" qualifier="BRC" long_name="Struts UI" - description="[null]" enabled="[true]" language="java" - created_at="[null]" path="[null]" deprecated_kee="org.struts:struts-ui" + <projects id="5" + root_uuid="A" + kee="org.struts:struts-ui" + name="Struts UI" + uuid="E" + uuid_path="A.E." + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path=".E." + scope="PRJ" + qualifier="BRC" + long_name="Struts UI" + description="[null]" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="org.struts:struts-ui" authorization_updated_at="[null]"/> <!-- directory --> - <projects long_name="org.struts" id="6" scope="DIR" qualifier="DIR" kee="org.struts:struts-ui:/src/org/struts" - name="org.struts" root_uuid="E" uuid="F" project_uuid="[null]" module_uuid="[null]" module_uuid_path=".E." + <projects long_name="org.struts" + id="6" + scope="DIR" + qualifier="DIR" + kee="org.struts:struts-ui:/src/org/struts" + name="org.struts" + root_uuid="E" + uuid="F" + uuid_path="A.E.F." + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path=".E." description="[null]" - enabled="[true]" language="java" created_at="[null]" - path="[null]" deprecated_kee="org.struts:struts-ui:org.struts" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="org.struts:struts-ui:org.struts" authorization_updated_at="[null]"/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="7" scope="FIL" qualifier="CLA" + <projects long_name="org.struts.RequestContext" + id="7" + scope="FIL" + qualifier="CLA" kee="org.struts:struts-ui:/src/org/struts/RequestContext.java" - name="RequestContext" root_uuid="E" uuid="G" project_uuid="[null]" module_uuid="[null]" module_uuid_path=".E." + name="RequestContext" + root_uuid="E" + uuid="G" + uuid_path="A.E.F.G." + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path=".E." description="[null]" - enabled="[true]" language="java" created_at="[null]" - path="[null]" deprecated_kee="org.struts:struts-ui:org.struts.RequestContext" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="org.struts:struts-ui:org.struts.RequestContext" authorization_updated_at="[null]"/> <!-- **************** Another independent project **************** --> - <projects id="8" root_uuid="A" kee="foo:struts-core" name="Foo Struts Core" uuid="H" project_uuid="[null]" - module_uuid="[null]" module_uuid_path=".H." - scope="PRJ" qualifier="BRC" long_name="Foo Struts Core" - description="[null]" enabled="[true]" language="java" - created_at="[null]" path="[null]" deprecated_kee="foo:struts-core" + <projects id="8" + root_uuid="A" + kee="foo:struts-core" + name="Foo Struts Core" + uuid="H" + uuid_path="H." + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path=".H." + scope="PRJ" + qualifier="BRC" + long_name="Foo Struts Core" + description="[null]" + enabled="[true]" + language="java" + created_at="[null]" + path="[null]" + deprecated_kee="foo:struts-core" authorization_updated_at="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/SnapshotDaoTest/has_last_snapshot_by_component_uuid.xml b/sonar-db/src/test/resources/org/sonar/db/component/SnapshotDaoTest/has_last_snapshot_by_component_uuid.xml index fbdd4fc6bc9..db3e78e5600 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/SnapshotDaoTest/has_last_snapshot_by_component_uuid.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/SnapshotDaoTest/has_last_snapshot_by_component_uuid.xml @@ -8,6 +8,7 @@ kee="org.struts:struts" name="Struts" uuid="ABCD" + uuid_path="ABCD." project_uuid="ABCD" module_uuid="[null]" module_uuid_path="." @@ -18,21 +19,38 @@ copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - authorization_updated_at="[null]" /> + authorization_updated_at="[null]"/> <snapshots id="1" uuid="u1" component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path=""/> + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path=""/> <snapshots id="10" uuid="u10" component_uuid="ABCD" @@ -66,16 +84,44 @@ path=""/> <!-- No snapshot --> - <projects id="2" root_uuid="ABCD" kee="org.struts:struts-core" name="Struts Core" - uuid="EFGH" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD." - scope="PRJ" qualifier="BRC" long_name="Struts Core" - description="[null]" enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" authorization_updated_at="[null]" /> + <projects id="2" + root_uuid="ABCD" + kee="org.struts:struts-core" + name="Struts Core" + uuid="EFGH" + uuid_path="ABCD.EFGH." + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path=".ABCD." + scope="PRJ" + qualifier="BRC" + long_name="Struts Core" + description="[null]" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]"/> <!-- No last snapshot --> - <projects id="3" root_uuid="ABCD" kee="org.struts:struts-data" name="Struts Data" - uuid="FGHI" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH." - scope="PRJ" qualifier="BRC" long_name="Struts Data" - description="[null]" enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" authorization_updated_at="[null]" /> + <projects id="3" + root_uuid="ABCD" + kee="org.struts:struts-data" + name="Struts Data" + uuid="FGHI" + uuid_path="ABCD.EFGH.FGHI." + project_uuid="ABCD" + module_uuid="EFGH" + module_uuid_path=".ABCD.EFGH." + scope="PRJ" + qualifier="BRC" + long_name="Struts Data" + description="[null]" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]"/> <snapshots id="3" uuid="u3" component_uuid="FGHI" diff --git a/sonar-db/src/test/resources/org/sonar/db/component/SnapshotDaoTest/select_previous_version_snapshots.xml b/sonar-db/src/test/resources/org/sonar/db/component/SnapshotDaoTest/select_previous_version_snapshots.xml index 5dd22487230..9ad6c3e904c 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/SnapshotDaoTest/select_previous_version_snapshots.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/SnapshotDaoTest/select_previous_version_snapshots.xml @@ -8,6 +8,7 @@ name="project" root_uuid="ABCD" uuid="ABCD" + uuid_path="NOT_USED" description="[null]" enabled="[true]" language="java" diff --git a/sonar-db/src/test/resources/org/sonar/db/component/SnapshotDaoTest/select_snapshots_by_query.xml b/sonar-db/src/test/resources/org/sonar/db/component/SnapshotDaoTest/select_snapshots_by_query.xml index 57e173e018e..953c02f906f 100644 --- a/sonar-db/src/test/resources/org/sonar/db/component/SnapshotDaoTest/select_snapshots_by_query.xml +++ b/sonar-db/src/test/resources/org/sonar/db/component/SnapshotDaoTest/select_snapshots_by_query.xml @@ -1,104 +1,274 @@ <dataset> <!-- PROJECT_ID = 1 --> - <projects id="1" root_uuid="ABCD" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path="." - description="the description" long_name="Apache Struts" - enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" + <projects id="1" + root_uuid="ABCD" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts" + uuid="ABCD" + uuid_path="ABCD." + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path="." + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" authorization_updated_at="[null]"/> <snapshots id="1" uuid="u1" component_uuid="ABCD" - parent_snapshot_id="2" root_component_uuid="ABCD" root_snapshot_id="1" - status="P" islast="[true]" purge_status="1" - period1_mode="days1" period1_param="30" period1_date="1316815200000" - period2_mode="days2" period2_param="31" period2_date="1316901600000" - period3_mode="days3" period3_param="32" period3_date="1316988000000" - period4_mode="days4" period4_param="33" period4_date="1317074400000" - period5_mode="days5" period5_param="34" period5_date="1317160800000" - depth="1" scope="PRJ" qualifier="PAC" created_at="1228172400001" build_date="1317247200000" - version="2.0-SNAPSHOT" path="1.2."/> + parent_snapshot_id="2" + root_component_uuid="ABCD" + root_snapshot_id="1" + status="P" + islast="[true]" + purge_status="1" + period1_mode="days1" + period1_param="30" + period1_date="1316815200000" + period2_mode="days2" + period2_param="31" + period2_date="1316901600000" + period3_mode="days3" + period3_param="32" + period3_date="1316988000000" + period4_mode="days4" + period4_param="33" + period4_date="1317074400000" + period5_mode="days5" + period5_param="34" + period5_date="1317160800000" + depth="1" + scope="PRJ" + qualifier="PAC" + created_at="1228172400001" + build_date="1317247200000" + version="2.0-SNAPSHOT" + path="1.2."/> <snapshots id="2" uuid="u2" component_uuid="ABCD" - parent_snapshot_id="2" root_component_uuid="ABCD" root_snapshot_id="3" - status="P" islast="[false]" purge_status="1" - period1_mode="days1" period1_param="30" period1_date="1316815200000" - period2_mode="days2" period2_param="31" period2_date="1316901600000" - period3_mode="days3" period3_param="32" period3_date="1316988000000" - period4_mode="days4" period4_param="33" period4_date="1317074400000" - period5_mode="days5" period5_param="34" period5_date="1317160800000" - depth="1" scope="DIR" qualifier="PAC" created_at="1228172400002" build_date="1317247200000" - version="2.1-SNAPSHOT" path="1.2."/> + parent_snapshot_id="2" + root_component_uuid="ABCD" + root_snapshot_id="3" + status="P" + islast="[false]" + purge_status="1" + period1_mode="days1" + period1_param="30" + period1_date="1316815200000" + period2_mode="days2" + period2_param="31" + period2_date="1316901600000" + period3_mode="days3" + period3_param="32" + period3_date="1316988000000" + period4_mode="days4" + period4_param="33" + period4_date="1317074400000" + period5_mode="days5" + period5_param="34" + period5_date="1317160800000" + depth="1" + scope="DIR" + qualifier="PAC" + created_at="1228172400002" + build_date="1317247200000" + version="2.1-SNAPSHOT" + path="1.2."/> <snapshots id="3" uuid="u3" component_uuid="ABCD" - parent_snapshot_id="2" root_component_uuid="ABCD" root_snapshot_id="3" - status="P" islast="[false]" purge_status="1" - period1_mode="days1" period1_param="30" period1_date="1316815200000" - period2_mode="days2" period2_param="31" period2_date="1316901600000" - period3_mode="days3" period3_param="32" period3_date="1316988000000" - period4_mode="days4" period4_param="33" period4_date="1317074400000" - period5_mode="days5" period5_param="34" period5_date="1317160800000" - depth="1" scope="DIR" qualifier="PAC" created_at="1228172400003" build_date="1317247200000" - version="2.2-SNAPSHOT" path="1.2."/> + parent_snapshot_id="2" + root_component_uuid="ABCD" + root_snapshot_id="3" + status="P" + islast="[false]" + purge_status="1" + period1_mode="days1" + period1_param="30" + period1_date="1316815200000" + period2_mode="days2" + period2_param="31" + period2_date="1316901600000" + period3_mode="days3" + period3_param="32" + period3_date="1316988000000" + period4_mode="days4" + period4_param="33" + period4_date="1317074400000" + period5_mode="days5" + period5_param="34" + period5_date="1317160800000" + depth="1" + scope="DIR" + qualifier="PAC" + created_at="1228172400003" + build_date="1317247200000" + version="2.2-SNAPSHOT" + path="1.2."/> <!-- PROJECT_ID = 2 --> - <projects id="2" root_uuid="ABCD" kee="org.struts:struts-core" name="Struts Core" - uuid="EFGH" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD." - scope="PRJ" qualifier="BRC" long_name="Struts Core" - description="[null]" enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" + <projects id="2" + root_uuid="ABCD" + kee="org.struts:struts-core" + name="Struts Core" + uuid="EFGH" + uuid_path="ABCD.EFGH." + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path=".ABCD." + scope="PRJ" + qualifier="BRC" + long_name="Struts Core" + description="[null]" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" authorization_updated_at="[null]"/> <snapshots id="4" uuid="u4" - component_uuid="EFGH" parent_snapshot_id="2" root_component_uuid="ABCD" root_snapshot_id="3" - status="P" islast="[true]" purge_status="1" - period1_mode="days1" period1_param="30" period1_date="1316815200000" - period2_mode="days2" period2_param="31" period2_date="1316901600000" - period3_mode="days3" period3_param="32" period3_date="1316988000000" - period4_mode="days4" period4_param="33" period4_date="1317074400000" - period5_mode="days5" period5_param="34" period5_date="1317160800000" - depth="1" scope="DIR" qualifier="PAC" created_at="1228172400000" build_date="1317247200000" - version="2.1-SNAPSHOT" path="1.2."/> + component_uuid="EFGH" + parent_snapshot_id="2" + root_component_uuid="ABCD" + root_snapshot_id="3" + status="P" + islast="[true]" + purge_status="1" + period1_mode="days1" + period1_param="30" + period1_date="1316815200000" + period2_mode="days2" + period2_param="31" + period2_date="1316901600000" + period3_mode="days3" + period3_param="32" + period3_date="1316988000000" + period4_mode="days4" + period4_param="33" + period4_date="1317074400000" + period5_mode="days5" + period5_param="34" + period5_date="1317160800000" + depth="1" + scope="DIR" + qualifier="PAC" + created_at="1228172400000" + build_date="1317247200000" + version="2.1-SNAPSHOT" + path="1.2."/> <!-- Unprocessed snapshot --> <snapshots id="5" uuid="u5" - component_uuid="EFGH" parent_snapshot_id="2" root_component_uuid="ABCD" root_snapshot_id="3" - status="U" islast="[true]" purge_status="1" - period1_mode="days1" period1_param="30" period1_date="1316815200000" - period2_mode="days2" period2_param="31" period2_date="1316901600000" - period3_mode="days3" period3_param="32" period3_date="1316988000000" - period4_mode="days4" period4_param="33" period4_date="1317074400000" - period5_mode="days5" period5_param="34" period5_date="1317160800000" - depth="1" scope="DIR" qualifier="PAC" created_at="1228172400000" build_date="1317247200000" - version="2.1-SNAPSHOT" path="1.2."/> + component_uuid="EFGH" + parent_snapshot_id="2" + root_component_uuid="ABCD" + root_snapshot_id="3" + status="U" + islast="[true]" + purge_status="1" + period1_mode="days1" + period1_param="30" + period1_date="1316815200000" + period2_mode="days2" + period2_param="31" + period2_date="1316901600000" + period3_mode="days3" + period3_param="32" + period3_date="1316988000000" + period4_mode="days4" + period4_param="33" + period4_date="1317074400000" + period5_mode="days5" + period5_param="34" + period5_date="1317160800000" + depth="1" + scope="DIR" + qualifier="PAC" + created_at="1228172400000" + build_date="1317247200000" + version="2.1-SNAPSHOT" + path="1.2."/> <!-- PROJECT_ID = 3 - no last snapshot --> - <projects id="3" root_uuid="ABCD" kee="org.struts:struts-data" name="Struts Data" - uuid="FGHI" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH." - scope="PRJ" qualifier="BRC" long_name="Struts Data" - description="[null]" enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" + <projects id="3" + root_uuid="ABCD" + kee="org.struts:struts-data" + name="Struts Data" + uuid="FGHI" + uuid_path="ABCD.EFGH.FGHI." + project_uuid="ABCD" + module_uuid="EFGH" + module_uuid_path=".ABCD.EFGH." + scope="PRJ" + qualifier="BRC" + long_name="Struts Data" + description="[null]" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" authorization_updated_at="[null]"/> <snapshots id="6" uuid="u6" - component_uuid="FGHI" parent_snapshot_id="2" root_component_uuid="ABCD" root_snapshot_id="3" - status="P" islast="[false]" purge_status="1" - period1_mode="days1" period1_param="30" period1_date="1316815200000" - period2_mode="days2" period2_param="31" period2_date="1316901600000" - period3_mode="days3" period3_param="32" period3_date="1316988000000" - period4_mode="days4" period4_param="33" period4_date="1317074400000" - period5_mode="days5" period5_param="34" period5_date="1317160800000" - depth="1" scope="DIR" qualifier="PAC" created_at="1228172400000" build_date="1317247200000" - version="2.1-SNAPSHOT" path="1.2."/> + component_uuid="FGHI" + parent_snapshot_id="2" + root_component_uuid="ABCD" + root_snapshot_id="3" + status="P" + islast="[false]" + purge_status="1" + period1_mode="days1" + period1_param="30" + period1_date="1316815200000" + period2_mode="days2" + period2_param="31" + period2_date="1316901600000" + period3_mode="days3" + period3_param="32" + period3_date="1316988000000" + period4_mode="days4" + period4_param="33" + period4_date="1317074400000" + period5_mode="days5" + period5_param="34" + period5_date="1317160800000" + depth="1" + scope="DIR" + qualifier="PAC" + created_at="1228172400000" + build_date="1317247200000" + version="2.1-SNAPSHOT" + path="1.2."/> <!-- PROJECT_ID = 4 - no snapshot --> - <projects id="4" root_uuid="ABCD" kee="org.struts:struts-deprecated" name="Struts Deprecated" - uuid="GHIJ" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH." - scope="PRJ" qualifier="BRC" long_name="Struts Deprecated" - description="[null]" enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" + <projects id="4" + root_uuid="ABCD" + kee="org.struts:struts-deprecated" + name="Struts Deprecated" + uuid="GHIJ" + uuid_path="ABCD.EFGH.GHIJ." + project_uuid="ABCD" + module_uuid="EFGH" + module_uuid_path=".ABCD.EFGH." + scope="PRJ" + qualifier="BRC" + long_name="Struts Deprecated" + description="[null]" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" authorization_updated_at="[null]"/> diff --git a/sonar-db/src/test/resources/org/sonar/db/duplication/DuplicationDaoTest/insert-result.xml b/sonar-db/src/test/resources/org/sonar/db/duplication/DuplicationDaoTest/insert-result.xml index 085383822a8..2fa5c3f8070 100644 --- a/sonar-db/src/test/resources/org/sonar/db/duplication/DuplicationDaoTest/insert-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/duplication/DuplicationDaoTest/insert-result.xml @@ -12,7 +12,13 @@ status="U" islast="0" project_id="1"/> - <projects id="1" uuid="1" kee="foo" enabled="1" scope="FIL" qualifier="CLA"/> + <projects uuid="1" + uuid_path="NOT_USED" + kee="foo" + enabled="1" + scope="FIL" + qualifier="CLA" + id="1"/> <duplications_index id="1" analysis_uuid="u1" diff --git a/sonar-db/src/test/resources/org/sonar/db/duplication/DuplicationDaoTest/insert.xml b/sonar-db/src/test/resources/org/sonar/db/duplication/DuplicationDaoTest/insert.xml index b34f689f680..0a9486ebc5b 100644 --- a/sonar-db/src/test/resources/org/sonar/db/duplication/DuplicationDaoTest/insert.xml +++ b/sonar-db/src/test/resources/org/sonar/db/duplication/DuplicationDaoTest/insert.xml @@ -14,6 +14,13 @@ islast="0" component_uuid="uuid_1" root_component_uuid="uuid_1"/> - <projects id="1" uuid="uuid_1" root_uuid="uuid_root" kee="foo" enabled="1" scope="FIL" qualifier="CLA"/> + <projects uuid="uuid_1" + uuid_path="NOT_USED" + root_uuid="uuid_root" + kee="foo" + enabled="1" + scope="FIL" + qualifier="CLA" + id="1"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/duplication/DuplicationDaoTest/select_candidates.xml b/sonar-db/src/test/resources/org/sonar/db/duplication/DuplicationDaoTest/select_candidates.xml index 1bc298a72d0..ab41024ed87 100644 --- a/sonar-db/src/test/resources/org/sonar/db/duplication/DuplicationDaoTest/select_candidates.xml +++ b/sonar-db/src/test/resources/org/sonar/db/duplication/DuplicationDaoTest/select_candidates.xml @@ -16,6 +16,7 @@ root_component_uuid="uuid_root_1"/> <projects id="1" uuid="uuid_1" + uuid_path="NOT_USED" root_uuid="uuid_root_1" kee="bar-old" enabled="[true]" @@ -39,6 +40,7 @@ root_component_uuid="uuid_root_2"/> <projects id="2" uuid="uuid_2" + uuid_path="NOT_USED" root_uuid="uuid_root_2" kee="bar-last" enabled="[true]" @@ -62,6 +64,7 @@ root_component_uuid="uuid_root_3"/> <projects id="3" uuid="uuid_3" + uuid_path="NOT_USED" root_uuid="uuid_root_3" kee="foo-old" enabled="[true]" @@ -85,6 +88,7 @@ root_component_uuid="uuid_root_4"/> <projects id="4" uuid="uuid_4" + uuid_path="NOT_USED" root_uuid="uuid_root_4" kee="foo-last" enabled="[true]" @@ -108,6 +112,7 @@ root_component_uuid="uuid_root_5"/> <projects id="5" uuid="uuid_5" + uuid_path="NOT_USED" root_uuid="uuid_root_5" kee="foo" enabled="[true]" @@ -124,6 +129,7 @@ root_component_uuid="uuid_root_1"/> <projects id="6" uuid="uuid_6" + uuid_path="NOT_USED" root_uuid="uuid_root_1" kee="baz" enabled="[true]" diff --git a/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/shared.xml b/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/shared.xml index 306aa5b1217..4cf2e289b79 100644 --- a/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/shared.xml +++ b/sonar-db/src/test/resources/org/sonar/db/issue/IssueDaoTest/shared.xml @@ -1,26 +1,91 @@ <dataset> - <group_roles id="1" group_id="[null]" resource_id="399" role="user"/> + <group_roles id="1" + group_id="[null]" + resource_id="399" + role="user"/> - <projects id="399" uuid="ABCD" root_uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path="." kee="struts" - qualifier="TRK" scope="PRJ"/> - <projects id="400" uuid="BCDE" root_uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD." kee="struts-core" - qualifier="BRC" scope="PRJ"/> - <projects id="401" uuid="CDEF" root_uuid="BCDE" project_uuid="ABCD" module_uuid="BCDE" module_uuid_path=".ABCD.BCDE." kee="Action.java" - qualifier="CLA" scope="PRJ"/> - <projects id="402" uuid="DEFG" root_uuid="CDEF" project_uuid="ABCD" module_uuid="BCDE" module_uuid_path=".ABCD.BCDE." kee="Filter.java" - qualifier="CLA" scope="PRJ"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + root_uuid="ABCD" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path="." + kee="struts" + qualifier="TRK" + scope="PRJ" + id="399"/> + <projects uuid="BCDE" + uuid_path="NOT_USED" + root_uuid="ABCD" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path=".ABCD." + kee="struts-core" + qualifier="BRC" + scope="PRJ" + id="400"/> + <projects uuid="CDEF" + uuid_path="NOT_USED" + root_uuid="BCDE" + project_uuid="ABCD" + module_uuid="BCDE" + module_uuid_path=".ABCD.BCDE." + kee="Action.java" + qualifier="CLA" + scope="PRJ" + id="401"/> + <projects uuid="DEFG" + uuid_path="NOT_USED" + root_uuid="CDEF" + project_uuid="ABCD" + module_uuid="BCDE" + module_uuid_path=".ABCD.BCDE." + kee="Filter.java" + qualifier="CLA" + scope="PRJ" + id="402"/> - <snapshots id="100" component_uuid="ABCD" root_snapshot_id="[null]" parent_snapshot_id="[null]" root_component_uuid="ABCD" - path="" islast="[true]"/> - <snapshots id="101" component_uuid="BCDE" root_snapshot_id="100" parent_snapshot_id="100" root_component_uuid="ABCD" path="100." + <snapshots id="100" + component_uuid="ABCD" + root_snapshot_id="[null]" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + path="" + islast="[true]"/> + <snapshots id="101" + component_uuid="BCDE" + root_snapshot_id="100" + parent_snapshot_id="100" + root_component_uuid="ABCD" + path="100." + islast="[true]"/> + <snapshots id="102" + component_uuid="CDEF" + root_snapshot_id="100" + parent_snapshot_id="101" + root_component_uuid="ABCD" + path="100.101." + islast="[true]"/> + <snapshots id="103" + component_uuid="DEFG" + root_snapshot_id="100" + parent_snapshot_id="101" + root_component_uuid="ABCD" + path="100.101." islast="[true]"/> - <snapshots id="102" component_uuid="CDEF" root_snapshot_id="100" parent_snapshot_id="101" root_component_uuid="ABCD" - path="100.101." islast="[true]"/> - <snapshots id="103" component_uuid="DEFG" root_snapshot_id="100" parent_snapshot_id="101" root_component_uuid="ABCD" - path="100.101." islast="[true]"/> - <rules id="500" tags="[null]" system_tags="[null]" plugin_rule_key="AvoidCycle" plugin_name="squid" language="java"/> - <rules id="501" tags="[null]" system_tags="[null]" plugin_rule_key="NullRef" plugin_name="squid" language="xoo"/> + <rules id="500" + tags="[null]" + system_tags="[null]" + plugin_rule_key="AvoidCycle" + plugin_name="squid" + language="java"/> + <rules id="501" + tags="[null]" + system_tags="[null]" + plugin_rule_key="NullRef" + plugin_name="squid" + language="xoo"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/measure/MeasureDaoTest/past_measures.xml b/sonar-db/src/test/resources/org/sonar/db/measure/MeasureDaoTest/past_measures.xml index 68405f0b926..635d065eadf 100644 --- a/sonar-db/src/test/resources/org/sonar/db/measure/MeasureDaoTest/past_measures.xml +++ b/sonar-db/src/test/resources/org/sonar/db/measure/MeasureDaoTest/past_measures.xml @@ -1,66 +1,180 @@ <dataset> - <metrics id="1" name="ncloc" VAL_TYPE="INT" DESCRIPTION="[null]" enabled="[true]"/> - - <metrics id="2" name="coverage" VAL_TYPE="INT" enabled="[true]"/> - - - <rules tags="[null]" system_tags="[null]" id="30" name="Check Header" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" - plugin_config_key="Checker/Treewalker/HeaderCheck" plugin_name="checkstyle" description="[null]" priority="4" status="READY" - is_template="[false]" template_id="[null]"/> - - <rules tags="[null]" system_tags="[null]" id="31" name="Equals Avoid Null" plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck" - plugin_config_key="Checker/TreeWalker/EqualsAvoidNull" plugin_name="checkstyle" description="[null]" priority="4" status="READY" - is_template="[false]" template_id="[null]"/> + <metrics id="1" + name="ncloc" + VAL_TYPE="INT" + DESCRIPTION="[null]" + enabled="[true]"/> + + <metrics id="2" + name="coverage" + VAL_TYPE="INT" + enabled="[true]"/> + + + <rules tags="[null]" + system_tags="[null]" + id="30" + name="Check Header" + plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck" + plugin_config_key="Checker/Treewalker/HeaderCheck" + plugin_name="checkstyle" + description="[null]" + priority="4" + status="READY" + is_template="[false]" + template_id="[null]"/> + + <rules tags="[null]" + system_tags="[null]" + id="31" + name="Equals Avoid Null" + plugin_rule_key="com.puppycrawl.tools.checkstyle.checks.coding.EqualsAvoidNullCheck" + plugin_config_key="Checker/TreeWalker/EqualsAvoidNull" + plugin_name="checkstyle" + description="[null]" + priority="4" + status="READY" + is_template="[false]" + template_id="[null]"/> <!-- project --> - <projects long_name="[null]" id="1" scope="PRJ" qualifier="TRK" kee="project" name="project" - root_uuid="ABCD" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD." - enabled="[true]"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path=".ABCD." + enabled="[true]" + long_name="[null]" + id="1" + scope="PRJ" + qualifier="TRK" + kee="project" + name="project" + root_uuid="ABCD"/> <!-- package --> - <projects long_name="[null]" id="2" scope="DIR" qualifier="PAC" kee="project:org.foo" name="org.foo" - root_uuid="ABCD" uuid="BCDE" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path=".ABCD." - enabled="[true]"/> + <projects uuid="BCDE" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="ABCD" + module_uuid_path=".ABCD." + enabled="[true]" + long_name="[null]" + id="2" + scope="DIR" + qualifier="PAC" + kee="project:org.foo" + name="org.foo" + root_uuid="ABCD"/> <!-- file --> - <projects long_name="org.foo.Bar" id="3" scope="FIL" qualifier="CLA" kee="project:org.foo.Bar" - name="Bar" root_uuid="ABCD" uuid="CDEF" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path=".ABCD." - enabled="[true]"/> + <projects uuid="CDEF" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="ABCD" + module_uuid_path=".ABCD." + enabled="[true]" + long_name="org.foo.Bar" + id="3" + scope="FIL" + qualifier="CLA" + kee="project:org.foo.Bar" + name="Bar" + root_uuid="ABCD"/> <!-- snapshots --> <snapshots id="1000" uuid="u1000" component_uuid="ABCD" - parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - scope="PRJ" qualifier="TRK" created_at="1225544280000" build_date="1225544280000" version="[null]" path="" - status="P" islast="[false]" depth="0"/> + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1225544280000" + build_date="1225544280000" + version="[null]" + path="" + status="P" + islast="[false]" + depth="0"/> <snapshots id="1001" uuid="u1001" - component_uuid="BCDE" parent_snapshot_id="1000" root_component_uuid="ABCD" root_snapshot_id="1000" - scope="DIR" qualifier="PAC" created_at="1225544280000" build_date="1225544280000" version="[null]" path="1000." - status="P" islast="[false]" depth="1"/> + component_uuid="BCDE" + parent_snapshot_id="1000" + root_component_uuid="ABCD" + root_snapshot_id="1000" + scope="DIR" + qualifier="PAC" + created_at="1225544280000" + build_date="1225544280000" + version="[null]" + path="1000." + status="P" + islast="[false]" + depth="1"/> <snapshots id="1002" uuid="u1002" - component_uuid="CDEF" parent_snapshot_id="1001" root_component_uuid="ABCD" root_snapshot_id="1000" - scope="FIL" qualifier="CLA" created_at="1225544280000" build_date="1225544280000" version="[null]" path="1000.1001." - status="P" islast="[false]" depth="2"/> + component_uuid="CDEF" + parent_snapshot_id="1001" + root_component_uuid="ABCD" + root_snapshot_id="1000" + scope="FIL" + qualifier="CLA" + created_at="1225544280000" + build_date="1225544280000" + version="[null]" + path="1000.1001." + status="P" + islast="[false]" + depth="2"/> <!-- project measures --> - <project_measures id="1" VALUE="60" METRIC_ID="1" SNAPSHOT_ID="1000" person_id="[null]" component_uuid="ABCD"/> - - <project_measures id="2" VALUE="80" METRIC_ID="2" SNAPSHOT_ID="1000" person_id="[null]" component_uuid="ABCD"/> + <project_measures id="1" + VALUE="60" + METRIC_ID="1" + SNAPSHOT_ID="1000" + person_id="[null]" + component_uuid="ABCD"/> + + <project_measures id="2" + VALUE="80" + METRIC_ID="2" + SNAPSHOT_ID="1000" + person_id="[null]" + component_uuid="ABCD"/> <!-- package measures --> - <project_measures id="3" VALUE="20" METRIC_ID="1" SNAPSHOT_ID="1001" person_id="[null]" component_uuid="BCDE"/> - - <project_measures id="4" VALUE="70" METRIC_ID="2" SNAPSHOT_ID="1001" person_id="[null]" component_uuid="BCDE"/> + <project_measures id="3" + VALUE="20" + METRIC_ID="1" + SNAPSHOT_ID="1001" + person_id="[null]" + component_uuid="BCDE"/> + + <project_measures id="4" + VALUE="70" + METRIC_ID="2" + SNAPSHOT_ID="1001" + person_id="[null]" + component_uuid="BCDE"/> <!-- file measures --> - <project_measures id="5" VALUE="5" METRIC_ID="1" SNAPSHOT_ID="1002" person_id="[null]" component_uuid="CDEF"/> - - <project_measures id="6" VALUE="60" METRIC_ID="2" SNAPSHOT_ID="1002" person_id="[null]" component_uuid="CDEF"/> + <project_measures id="5" + VALUE="5" + METRIC_ID="1" + SNAPSHOT_ID="1002" + person_id="[null]" + component_uuid="CDEF"/> + + <project_measures id="6" + VALUE="60" + METRIC_ID="2" + SNAPSHOT_ID="1002" + person_id="[null]" + component_uuid="CDEF"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/measure/MeasureDaoTest/past_measures_with_person_id.xml b/sonar-db/src/test/resources/org/sonar/db/measure/MeasureDaoTest/past_measures_with_person_id.xml index 6645b79f2bf..90bae067103 100644 --- a/sonar-db/src/test/resources/org/sonar/db/measure/MeasureDaoTest/past_measures_with_person_id.xml +++ b/sonar-db/src/test/resources/org/sonar/db/measure/MeasureDaoTest/past_measures_with_person_id.xml @@ -1,24 +1,64 @@ <dataset> - <metrics delete_historical_data="[null]" id="1" name="sqale_index" VAL_TYPE="INT" DESCRIPTION="[null]" enabled="[true]"/> + <metrics delete_historical_data="[null]" + id="1" + name="sqale_index" + VAL_TYPE="INT" + DESCRIPTION="[null]" + enabled="[true]"/> <!-- project --> - <projects long_name="[null]" id="1" scope="PRJ" qualifier="TRK" kee="project" name="project" - root_uuid="ABCD" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD." - enabled="[true]"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path=".ABCD." + enabled="[true]" + long_name="[null]" + id="1" + scope="PRJ" + qualifier="TRK" + kee="project" + name="project" + root_uuid="ABCD"/> <!-- snapshots --> <snapshots id="1000" uuid="u1000" - component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - scope="PRJ" qualifier="TRK" created_at="1225544280000" build_date="1225544280000" version="[null]" path="" - status="P" islast="[false]" depth="0"/> + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1225544280000" + build_date="1225544280000" + version="[null]" + path="" + status="P" + islast="[false]" + depth="0"/> <!-- project measures --> - <project_measures id="1" VALUE="60" METRIC_ID="1" SNAPSHOT_ID="1000" person_id="[null]" component_uuid="ABCD"/> + <project_measures id="1" + VALUE="60" + METRIC_ID="1" + SNAPSHOT_ID="1000" + person_id="[null]" + component_uuid="ABCD"/> - <project_measures id="2" VALUE="20" METRIC_ID="1" SNAPSHOT_ID="1000" person_id="20" component_uuid="ABCD"/> + <project_measures id="2" + VALUE="20" + METRIC_ID="1" + SNAPSHOT_ID="1000" + person_id="20" + component_uuid="ABCD"/> - <project_measures id="3" VALUE="40" METRIC_ID="1" SNAPSHOT_ID="1000" person_id="21" component_uuid="ABCD"/> + <project_measures id="3" + VALUE="40" + METRIC_ID="1" + SNAPSHOT_ID="1000" + person_id="21" + component_uuid="ABCD"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/measure/MeasureDaoTest/select_by_snapshot_and_metric_keys.xml b/sonar-db/src/test/resources/org/sonar/db/measure/MeasureDaoTest/select_by_snapshot_and_metric_keys.xml index 1de5d1f021b..8c287369351 100644 --- a/sonar-db/src/test/resources/org/sonar/db/measure/MeasureDaoTest/select_by_snapshot_and_metric_keys.xml +++ b/sonar-db/src/test/resources/org/sonar/db/measure/MeasureDaoTest/select_by_snapshot_and_metric_keys.xml @@ -1,23 +1,66 @@ <dataset> - <metrics id="10" name="authors_by_line"/> - <metrics id="11" name="coverage_line_hits_data"/> - <metrics id="12" name="ncloc"/> + <metrics id="10" + name="authors_by_line"/> + <metrics id="11" + name="coverage_line_hits_data"/> + <metrics id="12" + name="ncloc"/> - <projects id="1" kee="org.struts:struts-core:src/org/struts/RequestContext.java" enabled="[true]" uuid="FILE1" root_uuid="ABCD"/> + <projects uuid="FILE1" + uuid_path="NOT_USED" + root_uuid="ABCD" + id="1" + kee="org.struts:struts-core:src/org/struts/RequestContext.java" + enabled="[true]"/> <snapshots id="5" uuid="u5" - component_uuid="ABCD" root_component_uuid="ABCD" islast="[true]" /> + component_uuid="ABCD" + root_component_uuid="ABCD" + islast="[true]"/> - <project_measures id="20" snapshot_id="5" metric_id="10" value="[null]" text_value="0123456789012345678901234567890123456789" measure_data="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" - alert_status="[null]" alert_text="[null]" component_uuid="FILE1"/> - <project_measures id="21" snapshot_id="5" metric_id="11" value="[null]" text_value="36=1;37=1;38=1;39=1;43=1;48=1;53=1" measure_data="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" - alert_status="[null]" alert_text="[null]" component_uuid="FILE1"/> - <project_measures id="22" snapshot_id="5" metric_id="12" value="10" text_value="[null]" measure_data="[null]" - variation_value_1="1" variation_value_2="2" variation_value_3="3" variation_value_4="4" variation_value_5="-5" - alert_status="OK" alert_text="Green" component_uuid="FILE1"/> + <project_measures id="20" + snapshot_id="5" + metric_id="10" + value="[null]" + text_value="0123456789012345678901234567890123456789" + measure_data="[null]" + variation_value_1="[null]" + variation_value_2="[null]" + variation_value_3="[null]" + variation_value_4="[null]" + variation_value_5="[null]" + alert_status="[null]" + alert_text="[null]" + component_uuid="FILE1"/> + <project_measures id="21" + snapshot_id="5" + metric_id="11" + value="[null]" + text_value="36=1;37=1;38=1;39=1;43=1;48=1;53=1" + measure_data="[null]" + variation_value_1="[null]" + variation_value_2="[null]" + variation_value_3="[null]" + variation_value_4="[null]" + variation_value_5="[null]" + alert_status="[null]" + alert_text="[null]" + component_uuid="FILE1"/> + <project_measures id="22" + snapshot_id="5" + metric_id="12" + value="10" + text_value="[null]" + measure_data="[null]" + variation_value_1="1" + variation_value_2="2" + variation_value_3="3" + variation_value_4="4" + variation_value_5="-5" + alert_status="OK" + alert_text="Green" + component_uuid="FILE1"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/measure/MeasureDaoTest/shared.xml b/sonar-db/src/test/resources/org/sonar/db/measure/MeasureDaoTest/shared.xml index 0c3500551fc..66240b47fac 100644 --- a/sonar-db/src/test/resources/org/sonar/db/measure/MeasureDaoTest/shared.xml +++ b/sonar-db/src/test/resources/org/sonar/db/measure/MeasureDaoTest/shared.xml @@ -1,34 +1,66 @@ <dataset> - <metrics id="10" name="authors_by_line"/> - <metrics id="11" name="coverage_line_hits_data"/> - <metrics id="12" name="ncloc"/> + <metrics id="10" + name="authors_by_line"/> + <metrics id="11" + name="coverage_line_hits_data"/> + <metrics id="12" + name="ncloc"/> - <projects id="1" kee="org.struts:struts-core:src/org/struts/RequestContext.java" enabled="[true]" uuid="ABCD" root_uuid="ABCD"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + root_uuid="ABCD" + id="1" + kee="org.struts:struts-core:src/org/struts/RequestContext.java" + enabled="[true]"/> <snapshots id="5" uuid="u5" component_uuid="ABCD" root_component_uuid="ABCD" - islast="[true]" /> + islast="[true]"/> <project_measures id="20" component_uuid="ABCD" snapshot_id="5" - metric_id="10" value="[null]" text_value="0123456789012345678901234567890123456789" measure_data="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" - alert_status="[null]" alert_text="[null]" /> + metric_id="10" + value="[null]" + text_value="0123456789012345678901234567890123456789" + measure_data="[null]" + variation_value_1="[null]" + variation_value_2="[null]" + variation_value_3="[null]" + variation_value_4="[null]" + variation_value_5="[null]" + alert_status="[null]" + alert_text="[null]"/> <project_measures id="21" component_uuid="ABCD" snapshot_id="5" - metric_id="11" value="[null]" text_value="36=1;37=1;38=1;39=1;43=1;48=1;53=1" measure_data="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" - alert_status="[null]" alert_text="[null]" /> + metric_id="11" + value="[null]" + text_value="36=1;37=1;38=1;39=1;43=1;48=1;53=1" + measure_data="[null]" + variation_value_1="[null]" + variation_value_2="[null]" + variation_value_3="[null]" + variation_value_4="[null]" + variation_value_5="[null]" + alert_status="[null]" + alert_text="[null]"/> <project_measures id="22" component_uuid="ABCD" snapshot_id="5" - metric_id="12" value="10" text_value="[null]" measure_data="[null]" - variation_value_1="1" variation_value_2="2" variation_value_3="3" variation_value_4="4" variation_value_5="-5" - alert_status="OK" alert_text="Green"/> + metric_id="12" + value="10" + text_value="[null]" + measure_data="[null]" + variation_value_1="1" + variation_value_2="2" + variation_value_3="3" + variation_value_4="4" + variation_value_5="-5" + alert_status="OK" + alert_text="Green"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/measure/MeasureDaoTest/with_some_measures_for_developer.xml b/sonar-db/src/test/resources/org/sonar/db/measure/MeasureDaoTest/with_some_measures_for_developer.xml index eb696790cac..eea4becd304 100644 --- a/sonar-db/src/test/resources/org/sonar/db/measure/MeasureDaoTest/with_some_measures_for_developer.xml +++ b/sonar-db/src/test/resources/org/sonar/db/measure/MeasureDaoTest/with_some_measures_for_developer.xml @@ -1,41 +1,121 @@ <dataset> - <metrics id="10" name="authors_by_line"/> - <metrics id="11" name="coverage_line_hits_data"/> - <metrics id="12" name="ncloc"/> + <metrics id="10" + name="authors_by_line"/> + <metrics id="11" + name="coverage_line_hits_data"/> + <metrics id="12" + name="ncloc"/> - <projects id="1" kee="org.struts:struts-core:src/org/struts/RequestContext.java" enabled="[true]" uuid="uuid_1" root_uuid="uuid_1"/> - <projects id="333" kee="dev:John-Doe" enabled="[true]" uuid="333" root_uuid="333"/> + <projects uuid="uuid_1" + uuid_path="NOT_USED" + root_uuid="uuid_1" + id="1" + kee="org.struts:struts-core:src/org/struts/RequestContext.java" + enabled="[true]"/> + <projects uuid="333" + uuid_path="NOT_USED" + root_uuid="333" + id="333" + kee="dev:John-Doe" + enabled="[true]"/> <snapshots id="5" uuid="u5" component_uuid="uuid_1" - islast="[true]" root_component_uuid="uuid_1"/> + islast="[true]" + root_component_uuid="uuid_1"/> - <project_measures id="20" snapshot_id="5" metric_id="10" value="[null]" text_value="0123456789012345678901234567890123456789" measure_data="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" - alert_status="[null]" alert_text="[null]" - person_id="[null]" component_uuid="1"/> - <project_measures id="21" snapshot_id="5" metric_id="11" value="[null]" text_value="36=1;37=1;38=1;39=1;43=1;48=1;53=1" measure_data="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" - alert_status="[null]" alert_text="[null]" - person_id="[null]" component_uuid="1"/> - <project_measures id="22" snapshot_id="5" metric_id="12" value="10" text_value="[null]" measure_data="[null]" - variation_value_1="1" variation_value_2="2" variation_value_3="3" variation_value_4="4" variation_value_5="-5" - alert_status="OK" alert_text="Green" - person_id="[null]" component_uuid="1"/> + <project_measures id="20" + snapshot_id="5" + metric_id="10" + value="[null]" + text_value="0123456789012345678901234567890123456789" + measure_data="[null]" + variation_value_1="[null]" + variation_value_2="[null]" + variation_value_3="[null]" + variation_value_4="[null]" + variation_value_5="[null]" + alert_status="[null]" + alert_text="[null]" + person_id="[null]" + component_uuid="1"/> + <project_measures id="21" + snapshot_id="5" + metric_id="11" + value="[null]" + text_value="36=1;37=1;38=1;39=1;43=1;48=1;53=1" + measure_data="[null]" + variation_value_1="[null]" + variation_value_2="[null]" + variation_value_3="[null]" + variation_value_4="[null]" + variation_value_5="[null]" + alert_status="[null]" + alert_text="[null]" + person_id="[null]" + component_uuid="1"/> + <project_measures id="22" + snapshot_id="5" + metric_id="12" + value="10" + text_value="[null]" + measure_data="[null]" + variation_value_1="1" + variation_value_2="2" + variation_value_3="3" + variation_value_4="4" + variation_value_5="-5" + alert_status="OK" + alert_text="Green" + person_id="[null]" + component_uuid="1"/> <!--measures for developer 333--> - <project_measures id="30" snapshot_id="5" metric_id="10" value="[null]" text_value="0123456789012345678901234567890123456789" measure_data="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" - alert_status="[null]" alert_text="[null]" - person_id="333" component_uuid="1"/> - <project_measures id="31" snapshot_id="5" metric_id="11" value="[null]" text_value="36=1;37=1;38=1;39=1;43=1;48=1;53=1" measure_data="[null]" - variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" variation_value_4="[null]" variation_value_5="[null]" - alert_status="[null]" alert_text="[null]" - person_id="333" component_uuid="1"/> - <project_measures id="32" snapshot_id="5" metric_id="12" value="10" text_value="[null]" measure_data="[null]" - variation_value_1="1" variation_value_2="2" variation_value_3="3" variation_value_4="4" variation_value_5="-5" - alert_status="OK" alert_text="Green" - person_id="333" component_uuid="1"/> + <project_measures id="30" + snapshot_id="5" + metric_id="10" + value="[null]" + text_value="0123456789012345678901234567890123456789" + measure_data="[null]" + variation_value_1="[null]" + variation_value_2="[null]" + variation_value_3="[null]" + variation_value_4="[null]" + variation_value_5="[null]" + alert_status="[null]" + alert_text="[null]" + person_id="333" + component_uuid="1"/> + <project_measures id="31" + snapshot_id="5" + metric_id="11" + value="[null]" + text_value="36=1;37=1;38=1;39=1;43=1;48=1;53=1" + measure_data="[null]" + variation_value_1="[null]" + variation_value_2="[null]" + variation_value_3="[null]" + variation_value_4="[null]" + variation_value_5="[null]" + alert_status="[null]" + alert_text="[null]" + person_id="333" + component_uuid="1"/> + <project_measures id="32" + snapshot_id="5" + metric_id="12" + value="10" + text_value="[null]" + measure_data="[null]" + variation_value_1="1" + variation_value_2="2" + variation_value_3="3" + variation_value_4="4" + variation_value_5="-5" + alert_status="OK" + alert_text="Green" + person_id="333" + component_uuid="1"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/apply_default_permission_template.xml b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/apply_default_permission_template.xml index 537a1a75b9a..f73214a0ce6 100644 --- a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/apply_default_permission_template.xml +++ b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/apply_default_permission_template.xml @@ -1,35 +1,107 @@ <dataset> - <projects id="123" uuid="A" root_uuid="A" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - description="the description" long_name="Apache Struts" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - authorization_updated_at="123456789"/> + <projects uuid="A" + uuid_path="NOT_USED" + root_uuid="A" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts" + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="123456789" + id="123"/> - <groups id="100" name="sonar-administrators" /> - <groups id="101" name="sonar-users" /> + <groups id="100" + name="sonar-administrators"/> + <groups id="101" + name="sonar-users"/> - <users id="200" login="marius" name="Marius" email="[null]" active="[true]" /> - <users id="201" login="janette" name="Janette" email="[null]" active="[true]" /> + <users id="200" + login="marius" + name="Marius" + email="[null]" + active="[true]"/> + <users id="201" + login="janette" + name="Janette" + email="[null]" + active="[true]"/> <!-- on other resources --> - <group_roles id="1" group_id="100" resource_id="1" role="admin" /> - <group_roles id="2" group_id="101" resource_id="1" role="user" /> - <user_roles id="1" user_id="200" resource_id="1" role="admin" /> + <group_roles id="1" + group_id="100" + resource_id="1" + role="admin"/> + <group_roles id="2" + group_id="101" + resource_id="1" + role="user"/> + <user_roles id="1" + user_id="200" + resource_id="1" + role="admin"/> <!-- default permission template for all qualifiers --> - <permission_templates id="1" name="default" kee="default_20130101_010203" /> + <permission_templates id="1" + name="default" + kee="default_20130101_010203"/> - <perm_templates_groups id="1" template_id="1" group_id="100" permission_reference="admin" /> - <perm_templates_groups id="2" template_id="1" group_id="101" permission_reference="user" /> - <perm_templates_groups id="3" template_id="1" group_id="[null]" permission_reference="user" /> - <perm_templates_groups id="4" template_id="1" group_id="101" permission_reference="codeviewer" /> - <perm_templates_groups id="5" template_id="1" group_id="[null]" permission_reference="codeviewer" /> - <perm_templates_groups id="6" template_id="1" group_id="100" permission_reference="issueadmin" /> + <perm_templates_groups id="1" + template_id="1" + group_id="100" + permission_reference="admin"/> + <perm_templates_groups id="2" + template_id="1" + group_id="101" + permission_reference="user"/> + <perm_templates_groups id="3" + template_id="1" + group_id="[null]" + permission_reference="user"/> + <perm_templates_groups id="4" + template_id="1" + group_id="101" + permission_reference="codeviewer"/> + <perm_templates_groups id="5" + template_id="1" + group_id="[null]" + permission_reference="codeviewer"/> + <perm_templates_groups id="6" + template_id="1" + group_id="100" + permission_reference="issueadmin"/> - <perm_templates_users id="1" template_id="1" user_id="200" permission_reference="admin" /> - <perm_templates_users id="2" template_id="1" user_id="201" permission_reference="admin" /> + <perm_templates_users id="1" + template_id="1" + user_id="200" + permission_reference="admin"/> + <perm_templates_users id="2" + template_id="1" + user_id="201" + permission_reference="admin"/> - <perm_tpl_characteristics id="1" template_id="1" permission_key="user" with_project_creator="[true]" created_at="1234567890" updated_at="123457890" /> - <perm_tpl_characteristics id="2" template_id="1" permission_key="admin" with_project_creator="[true]" created_at="1234567890" updated_at="123457890" /> - <perm_tpl_characteristics id="3" template_id="2" permission_key="user" with_project_creator="[false]" created_at="1234567890" updated_at="1234567890" /> + <perm_tpl_characteristics id="1" + template_id="1" + permission_key="user" + with_project_creator="[true]" + created_at="1234567890" + updated_at="123457890"/> + <perm_tpl_characteristics id="2" + template_id="1" + permission_key="admin" + with_project_creator="[true]" + created_at="1234567890" + updated_at="123457890"/> + <perm_tpl_characteristics id="3" + template_id="2" + permission_key="user" + with_project_creator="[false]" + created_at="1234567890" + updated_at="1234567890"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/apply_default_permission_template_by_component_id.xml b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/apply_default_permission_template_by_component_id.xml index 7a5dbbb3756..ebbe1126bfd 100644 --- a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/apply_default_permission_template_by_component_id.xml +++ b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/apply_default_permission_template_by_component_id.xml @@ -1,31 +1,91 @@ <dataset> - <projects id="123" uuid="A" root_uuid="A" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - description="the description" long_name="Apache Struts" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - authorization_updated_at="123456789"/> + <projects uuid="A" + uuid_path="NOT_USED" + root_uuid="A" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts" + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="123456789" + id="123"/> - <groups id="100" name="sonar-administrators" /> - <groups id="101" name="sonar-users" /> + <groups id="100" + name="sonar-administrators"/> + <groups id="101" + name="sonar-users"/> - <users id="200" login="marius" name="Marius" email="[null]" active="[true]" /> + <users id="200" + login="marius" + name="Marius" + email="[null]" + active="[true]"/> <!-- on other resources --> - <group_roles id="1" group_id="100" resource_id="1" role="admin" /> - <group_roles id="2" group_id="101" resource_id="1" role="user" /> - <user_roles id="1" user_id="200" resource_id="1" role="admin" /> + <group_roles id="1" + group_id="100" + resource_id="1" + role="admin"/> + <group_roles id="2" + group_id="101" + resource_id="1" + role="user"/> + <user_roles id="1" + user_id="200" + resource_id="1" + role="admin"/> <!-- default permission template for all qualifiers --> - <permission_templates id="1" name="default" kee="default_20130101_010203" /> + <permission_templates id="1" + name="default" + kee="default_20130101_010203"/> - <perm_templates_groups id="1" template_id="1" group_id="100" permission_reference="admin" /> - <perm_templates_groups id="2" template_id="1" group_id="101" permission_reference="user" /> - <perm_templates_groups id="3" template_id="1" group_id="[null]" permission_reference="user" /> - <perm_templates_groups id="4" template_id="1" group_id="101" permission_reference="codeviewer" /> - <perm_templates_groups id="5" template_id="1" group_id="[null]" permission_reference="codeviewer" /> - <perm_templates_groups id="6" template_id="1" group_id="100" permission_reference="issueadmin" /> + <perm_templates_groups id="1" + template_id="1" + group_id="100" + permission_reference="admin"/> + <perm_templates_groups id="2" + template_id="1" + group_id="101" + permission_reference="user"/> + <perm_templates_groups id="3" + template_id="1" + group_id="[null]" + permission_reference="user"/> + <perm_templates_groups id="4" + template_id="1" + group_id="101" + permission_reference="codeviewer"/> + <perm_templates_groups id="5" + template_id="1" + group_id="[null]" + permission_reference="codeviewer"/> + <perm_templates_groups id="6" + template_id="1" + group_id="100" + permission_reference="issueadmin"/> - <perm_templates_users id="1" template_id="1" user_id="200" permission_reference="admin" /> + <perm_templates_users id="1" + template_id="1" + user_id="200" + permission_reference="admin"/> - <perm_tpl_characteristics id="1" template_id="1" permission_key="user" with_project_creator="[true]" created_at="1234567890" updated_at="123457890" /> - <perm_tpl_characteristics id="2" template_id="2" permission_key="user" with_project_creator="[false]" created_at="1234567890" updated_at="1234567890" /> + <perm_tpl_characteristics id="1" + template_id="1" + permission_key="user" + with_project_creator="[true]" + created_at="1234567890" + updated_at="123457890"/> + <perm_tpl_characteristics id="2" + template_id="2" + permission_key="user" + with_project_creator="[false]" + created_at="1234567890" + updated_at="1234567890"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_add_user_permission.xml b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_add_user_permission.xml index 62435ee6f13..e2b447b0064 100644 --- a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_add_user_permission.xml +++ b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_add_user_permission.xml @@ -1,12 +1,31 @@ <dataset> - <users id="200" login="dave.loper" name="Dave Loper" email="dave.loper@company.net" active="[true]"/> + <users id="200" + login="dave.loper" + name="Dave Loper" + email="dave.loper@company.net" + active="[true]"/> - <user_roles id="1" user_id="200" resource_id="123" role="user"/> + <user_roles id="1" + user_id="200" + resource_id="123" + role="user"/> - <projects id="123" uuid="A" root_uuid="A" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - description="the description" long_name="Apache Struts" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - authorization_updated_at="123456789"/> + <projects uuid="A" + uuid_path="NOT_USED" + root_uuid="A" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts" + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="123456789" + id="123"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_apply_permission_template.xml b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_apply_permission_template.xml index bf79d01e3e2..a03ee7c4970 100644 --- a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_apply_permission_template.xml +++ b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_apply_permission_template.xml @@ -1,31 +1,81 @@ <dataset> - <projects id="123" uuid="A" root_uuid="A" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - description="the description" long_name="Apache Struts" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - authorization_updated_at="123456789"/> + <projects uuid="A" + uuid_path="NOT_USED" + root_uuid="A" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts" + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="123456789" + id="123"/> - <groups id="100" name="sonar-administrators"/> - <groups id="101" name="sonar-users"/> + <groups id="100" + name="sonar-administrators"/> + <groups id="101" + name="sonar-users"/> - <users id="200" login="marius" name="Marius" email="[null]" active="[true]"/> + <users id="200" + login="marius" + name="Marius" + email="[null]" + active="[true]"/> <!-- on other resources --> - <group_roles id="1" group_id="100" resource_id="1" role="admin"/> - <group_roles id="2" group_id="101" resource_id="1" role="user"/> - <user_roles id="1" user_id="200" resource_id="1" role="admin"/> + <group_roles id="1" + group_id="100" + resource_id="1" + role="admin"/> + <group_roles id="2" + group_id="101" + resource_id="1" + role="user"/> + <user_roles id="1" + user_id="200" + resource_id="1" + role="admin"/> <!-- default permission template for all qualifiers --> - <permission_templates id="1" name="default" kee="default_20130101_010203"/> + <permission_templates id="1" + name="default" + kee="default_20130101_010203"/> - <perm_templates_groups id="1" template_id="1" group_id="100" permission_reference="admin"/> - <perm_templates_groups id="2" template_id="1" group_id="101" permission_reference="user"/> - <perm_templates_groups id="3" template_id="1" group_id="[null]" permission_reference="user"/> - <perm_templates_groups id="4" template_id="1" group_id="101" permission_reference="codeviewer"/> - <perm_templates_groups id="5" template_id="1" group_id="[null]" permission_reference="codeviewer"/> - <perm_templates_groups id="6" template_id="1" group_id="100" permission_reference="issueadmin"/> + <perm_templates_groups id="1" + template_id="1" + group_id="100" + permission_reference="admin"/> + <perm_templates_groups id="2" + template_id="1" + group_id="101" + permission_reference="user"/> + <perm_templates_groups id="3" + template_id="1" + group_id="[null]" + permission_reference="user"/> + <perm_templates_groups id="4" + template_id="1" + group_id="101" + permission_reference="codeviewer"/> + <perm_templates_groups id="5" + template_id="1" + group_id="[null]" + permission_reference="codeviewer"/> + <perm_templates_groups id="6" + template_id="1" + group_id="100" + permission_reference="issueadmin"/> - <perm_templates_users id="1" template_id="1" user_id="200" permission_reference="admin"/> + <perm_templates_users id="1" + template_id="1" + user_id="200" + permission_reference="admin"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_delete_group_permission-result.xml b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_delete_group_permission-result.xml index 4cb4facedaf..930c3265d8e 100644 --- a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_delete_group_permission-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_delete_group_permission-result.xml @@ -1,12 +1,28 @@ <dataset> - <groups id="100" name="devs"/> + <groups id="100" + name="devs"/> - <group_roles id="1" group_id="100" resource_id="123" role="admin"/> + <group_roles id="1" + group_id="100" + resource_id="123" + role="admin"/> - <projects id="123" uuid="A" root_uuid="A" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - description="the description" long_name="Apache Struts" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - authorization_updated_at="123456789"/> + <projects uuid="A" + uuid_path="NOT_USED" + root_uuid="A" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts" + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="123456789" + id="123"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_delete_group_permission.xml b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_delete_group_permission.xml index e577bd2633d..b39a3dfe4bb 100644 --- a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_delete_group_permission.xml +++ b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_delete_group_permission.xml @@ -1,13 +1,32 @@ <dataset> - <groups id="100" name="devs"/> + <groups id="100" + name="devs"/> - <group_roles id="1" group_id="100" resource_id="123" role="admin"/> - <group_roles id="2" group_id="100" resource_id="123" role="user"/> + <group_roles id="1" + group_id="100" + resource_id="123" + role="admin"/> + <group_roles id="2" + group_id="100" + resource_id="123" + role="user"/> -<projects id="123" uuid="A" root_uuid="A" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - description="the description" long_name="Apache Struts" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - authorization_updated_at="123456789"/> + <projects uuid="A" + uuid_path="NOT_USED" + root_uuid="A" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts" + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="123456789" + id="123"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_delete_user_permission-result.xml b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_delete_user_permission-result.xml index 62435ee6f13..e2b447b0064 100644 --- a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_delete_user_permission-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_delete_user_permission-result.xml @@ -1,12 +1,31 @@ <dataset> - <users id="200" login="dave.loper" name="Dave Loper" email="dave.loper@company.net" active="[true]"/> + <users id="200" + login="dave.loper" + name="Dave Loper" + email="dave.loper@company.net" + active="[true]"/> - <user_roles id="1" user_id="200" resource_id="123" role="user"/> + <user_roles id="1" + user_id="200" + resource_id="123" + role="user"/> - <projects id="123" uuid="A" root_uuid="A" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - description="the description" long_name="Apache Struts" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - authorization_updated_at="123456789"/> + <projects uuid="A" + uuid_path="NOT_USED" + root_uuid="A" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts" + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="123456789" + id="123"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_delete_user_permission.xml b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_delete_user_permission.xml index 0150227ccee..fcc1ba8a727 100644 --- a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_delete_user_permission.xml +++ b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_delete_user_permission.xml @@ -1,13 +1,35 @@ <dataset> - <users id="200" login="dave.loper" name="Dave Loper" email="dave.loper@company.net" active="[true]"/> + <users id="200" + login="dave.loper" + name="Dave Loper" + email="dave.loper@company.net" + active="[true]"/> - <user_roles id="1" user_id="200" resource_id="123" role="user"/> - <user_roles id="2" user_id="200" resource_id="123" role="admin"/> + <user_roles id="1" + user_id="200" + resource_id="123" + role="user"/> + <user_roles id="2" + user_id="200" + resource_id="123" + role="admin"/> - <projects id="123" uuid="A" root_uuid="A" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - description="the description" long_name="Apache Struts" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - authorization_updated_at="123456789"/> + <projects uuid="A" + uuid_path="NOT_USED" + root_uuid="A" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts" + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="123456789" + id="123"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_insert_anyone_group_permission-result.xml b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_insert_anyone_group_permission-result.xml index b94f939bf09..e4ce3ca8e6c 100644 --- a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_insert_anyone_group_permission-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_insert_anyone_group_permission-result.xml @@ -1,14 +1,33 @@ <dataset> - <groups id="100" name="devs"/> + <groups id="100" + name="devs"/> - <group_roles id="1" group_id="100" resource_id="123" role="admin"/> - <group_roles id="2" group_id="[null]" resource_id="123" role="user"/> + <group_roles id="1" + group_id="100" + resource_id="123" + role="admin"/> + <group_roles id="2" + group_id="[null]" + resource_id="123" + role="user"/> - <projects id="123" uuid="A" root_uuid="A" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - description="the description" long_name="Apache Struts" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - authorization_updated_at="123456789"/> + <projects uuid="A" + uuid_path="NOT_USED" + root_uuid="A" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts" + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="123456789" + id="123"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_insert_anyone_group_permission.xml b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_insert_anyone_group_permission.xml index 92fe2f87d9b..63bc614a815 100644 --- a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_insert_anyone_group_permission.xml +++ b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_insert_anyone_group_permission.xml @@ -1,13 +1,29 @@ <dataset> - <groups id="100" name="devs"/> + <groups id="100" + name="devs"/> - <group_roles id="1" group_id="100" resource_id="123" role="admin"/> + <group_roles id="1" + group_id="100" + resource_id="123" + role="admin"/> - <projects id="123" uuid="A" root_uuid="A" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - description="the description" long_name="Apache Struts" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - authorization_updated_at="123456789"/> + <projects uuid="A" + uuid_path="NOT_USED" + root_uuid="A" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts" + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="123456789" + id="123"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_insert_group_permission-result.xml b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_insert_group_permission-result.xml index 574e36a9a6d..b39a3dfe4bb 100644 --- a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_insert_group_permission-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_insert_group_permission-result.xml @@ -1,13 +1,32 @@ <dataset> - <groups id="100" name="devs"/> + <groups id="100" + name="devs"/> - <group_roles id="1" group_id="100" resource_id="123" role="admin"/> - <group_roles id="2" group_id="100" resource_id="123" role="user"/> + <group_roles id="1" + group_id="100" + resource_id="123" + role="admin"/> + <group_roles id="2" + group_id="100" + resource_id="123" + role="user"/> - <projects id="123" uuid="A" root_uuid="A" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - description="the description" long_name="Apache Struts" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - authorization_updated_at="123456789"/> + <projects uuid="A" + uuid_path="NOT_USED" + root_uuid="A" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts" + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="123456789" + id="123"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_insert_group_permission.xml b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_insert_group_permission.xml index 4cb4facedaf..930c3265d8e 100644 --- a/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_insert_group_permission.xml +++ b/sonar-db/src/test/resources/org/sonar/db/permission/PermissionRepositoryTest/should_insert_group_permission.xml @@ -1,12 +1,28 @@ <dataset> - <groups id="100" name="devs"/> + <groups id="100" + name="devs"/> - <group_roles id="1" group_id="100" resource_id="123" role="admin"/> + <group_roles id="1" + group_id="100" + resource_id="123" + role="admin"/> - <projects id="123" uuid="A" root_uuid="A" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - description="the description" long_name="Apache Struts" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - authorization_updated_at="123456789"/> + <projects uuid="A" + uuid_path="NOT_USED" + root_uuid="A" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts" + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="123456789" + id="123"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/delete_project_property-result.xml b/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/delete_project_property-result.xml index 0b889b14bb3..0305f9f545c 100644 --- a/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/delete_project_property-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/delete_project_property-result.xml @@ -1,22 +1,55 @@ <dataset> <!-- global --> - <properties id="1" prop_key="global.one" text_value="one" resource_id="[null]" user_id="[null]"/> - <properties id="2" prop_key="global.two" text_value="two" resource_id="[null]" user_id="[null]"/> + <properties id="1" + prop_key="global.one" + text_value="one" + resource_id="[null]" + user_id="[null]"/> + <properties id="2" + prop_key="global.two" + text_value="two" + resource_id="[null]" + user_id="[null]"/> <!-- struts --> <!--<properties id="3" prop_key="struts.one" text_value="one" resource_id="10" user_id="[null]"/>--> <!-- commons --> - <properties id="4" prop_key="commonslang.one" text_value="two" resource_id="11" user_id="[null]"/> + <properties id="4" + prop_key="commonslang.one" + text_value="two" + resource_id="11" + user_id="[null]"/> <!-- user --> - <properties id="5" prop_key="user.one" text_value="one" resource_id="[null]" user_id="100"/> - <properties id="6" prop_key="user.two" text_value="two" resource_id="10" user_id="100"/> + <properties id="5" + prop_key="user.one" + text_value="one" + resource_id="[null]" + user_id="100"/> + <properties id="6" + prop_key="user.two" + text_value="two" + resource_id="10" + user_id="100"/> - <properties id="7" prop_key="commonslang.one" text_value="one" resource_id="12" user_id="[null]"/> + <properties id="7" + prop_key="commonslang.one" + text_value="one" + resource_id="12" + user_id="[null]"/> - <projects id="10" uuid="A" kee="org.struts:struts"/> - <projects id="11" uuid="B" kee="org.apache:commons-lang"/> - <projects id="12" uuid="C" kee="other"/> + <projects uuid="A" + uuid_path="NOT_USED" + kee="org.struts:struts" + id="10"/> + <projects uuid="B" + uuid_path="NOT_USED" + kee="org.apache:commons-lang" + id="11"/> + <projects uuid="C" + uuid_path="NOT_USED" + kee="other" + id="12"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/delete_project_property.xml b/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/delete_project_property.xml index f6e6099a954..4c532602cf0 100644 --- a/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/delete_project_property.xml +++ b/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/delete_project_property.xml @@ -1,22 +1,62 @@ <dataset> <!-- global --> - <properties id="1" prop_key="global.one" text_value="one" resource_id="[null]" user_id="[null]"/> - <properties id="2" prop_key="global.two" text_value="two" resource_id="[null]" user_id="[null]"/> + <properties id="1" + prop_key="global.one" + text_value="one" + resource_id="[null]" + user_id="[null]"/> + <properties id="2" + prop_key="global.two" + text_value="two" + resource_id="[null]" + user_id="[null]"/> <!-- struts --> - <properties id="3" prop_key="struts.one" text_value="one" resource_id="10" user_id="[null]"/> + <properties id="3" + prop_key="struts.one" + text_value="one" + resource_id="10" + user_id="[null]"/> <!-- commons --> - <properties id="4" prop_key="commonslang.one" text_value="two" resource_id="11" user_id="[null]"/> + <properties id="4" + prop_key="commonslang.one" + text_value="two" + resource_id="11" + user_id="[null]"/> <!-- user --> - <properties id="5" prop_key="user.one" text_value="one" resource_id="[null]" user_id="100"/> - <properties id="6" prop_key="user.two" text_value="two" resource_id="10" user_id="100"/> + <properties id="5" + prop_key="user.one" + text_value="one" + resource_id="[null]" + user_id="100"/> + <properties id="6" + prop_key="user.two" + text_value="two" + resource_id="10" + user_id="100"/> - <properties id="7" prop_key="commonslang.one" text_value="one" resource_id="12" user_id="[null]"/> + <properties id="7" + prop_key="commonslang.one" + text_value="one" + resource_id="12" + user_id="[null]"/> - <projects id="10" uuid="A" root_uuid="A" kee="org.struts:struts"/> - <projects id="11" uuid="B" root_uuid="B" kee="org.apache:commons-lang"/> - <projects id="12" uuid="C" root_uuid="C" kee="other"/> + <projects uuid="A" + uuid_path="NOT_USED" + root_uuid="A" + kee="org.struts:struts" + id="10"/> + <projects uuid="B" + uuid_path="NOT_USED" + root_uuid="B" + kee="org.apache:commons-lang" + id="11"/> + <projects uuid="C" + uuid_path="NOT_USED" + root_uuid="C" + kee="other" + id="12"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/findNotificationSubscribers.xml b/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/findNotificationSubscribers.xml index 08568ad0eee..f4460a384b2 100644 --- a/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/findNotificationSubscribers.xml +++ b/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/findNotificationSubscribers.xml @@ -3,14 +3,18 @@ <users id="1" login="eric" - /> + /> <users id="2" login="simon" - /> + /> - <projects id="42" uuid="PROJECT_A" root_uuid="PROJECT_A" kee="org.apache:struts"/> + <projects uuid="PROJECT_A" + uuid_path="NOT_USED" + root_uuid="PROJECT_A" + kee="org.apache:struts" + id="42"/> <!-- global subscription --> <properties diff --git a/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/selectProjectProperties.xml b/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/selectProjectProperties.xml index f6e6099a954..4c532602cf0 100644 --- a/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/selectProjectProperties.xml +++ b/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/selectProjectProperties.xml @@ -1,22 +1,62 @@ <dataset> <!-- global --> - <properties id="1" prop_key="global.one" text_value="one" resource_id="[null]" user_id="[null]"/> - <properties id="2" prop_key="global.two" text_value="two" resource_id="[null]" user_id="[null]"/> + <properties id="1" + prop_key="global.one" + text_value="one" + resource_id="[null]" + user_id="[null]"/> + <properties id="2" + prop_key="global.two" + text_value="two" + resource_id="[null]" + user_id="[null]"/> <!-- struts --> - <properties id="3" prop_key="struts.one" text_value="one" resource_id="10" user_id="[null]"/> + <properties id="3" + prop_key="struts.one" + text_value="one" + resource_id="10" + user_id="[null]"/> <!-- commons --> - <properties id="4" prop_key="commonslang.one" text_value="two" resource_id="11" user_id="[null]"/> + <properties id="4" + prop_key="commonslang.one" + text_value="two" + resource_id="11" + user_id="[null]"/> <!-- user --> - <properties id="5" prop_key="user.one" text_value="one" resource_id="[null]" user_id="100"/> - <properties id="6" prop_key="user.two" text_value="two" resource_id="10" user_id="100"/> + <properties id="5" + prop_key="user.one" + text_value="one" + resource_id="[null]" + user_id="100"/> + <properties id="6" + prop_key="user.two" + text_value="two" + resource_id="10" + user_id="100"/> - <properties id="7" prop_key="commonslang.one" text_value="one" resource_id="12" user_id="[null]"/> + <properties id="7" + prop_key="commonslang.one" + text_value="one" + resource_id="12" + user_id="[null]"/> - <projects id="10" uuid="A" root_uuid="A" kee="org.struts:struts"/> - <projects id="11" uuid="B" root_uuid="B" kee="org.apache:commons-lang"/> - <projects id="12" uuid="C" root_uuid="C" kee="other"/> + <projects uuid="A" + uuid_path="NOT_USED" + root_uuid="A" + kee="org.struts:struts" + id="10"/> + <projects uuid="B" + uuid_path="NOT_USED" + root_uuid="B" + kee="org.apache:commons-lang" + id="11"/> + <projects uuid="C" + uuid_path="NOT_USED" + root_uuid="C" + kee="other" + id="12"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/selectProjectPropertiesByResourceId.xml b/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/selectProjectPropertiesByResourceId.xml index 52fec852a8d..d420c9dadc4 100644 --- a/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/selectProjectPropertiesByResourceId.xml +++ b/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/selectProjectPropertiesByResourceId.xml @@ -1,22 +1,59 @@ <dataset> <!-- global --> - <properties id="1" prop_key="global.one" text_value="one" resource_id="[null]" user_id="[null]"/> - <properties id="2" prop_key="global.two" text_value="two" resource_id="[null]" user_id="[null]"/> + <properties id="1" + prop_key="global.one" + text_value="one" + resource_id="[null]" + user_id="[null]"/> + <properties id="2" + prop_key="global.two" + text_value="two" + resource_id="[null]" + user_id="[null]"/> <!-- struts --> - <properties id="3" prop_key="struts.one" text_value="one" resource_id="10" user_id="[null]"/> + <properties id="3" + prop_key="struts.one" + text_value="one" + resource_id="10" + user_id="[null]"/> <!-- commons --> - <properties id="4" prop_key="commonslang.one" text_value="two" resource_id="11" user_id="[null]"/> + <properties id="4" + prop_key="commonslang.one" + text_value="two" + resource_id="11" + user_id="[null]"/> <!-- user --> - <properties id="5" prop_key="user.one" text_value="one" resource_id="[null]" user_id="100"/> - <properties id="6" prop_key="user.two" text_value="two" resource_id="10" user_id="[null]"/> + <properties id="5" + prop_key="user.one" + text_value="one" + resource_id="[null]" + user_id="100"/> + <properties id="6" + prop_key="user.two" + text_value="two" + resource_id="10" + user_id="[null]"/> - <properties id="7" prop_key="commonslang.one" text_value="one" resource_id="12" user_id="[null]"/> + <properties id="7" + prop_key="commonslang.one" + text_value="one" + resource_id="12" + user_id="[null]"/> - <projects id="10" uuid="A" kee="org.struts:struts"/> - <projects id="11" uuid="B" kee="org.apache:commons-lang"/> - <projects id="12" uuid="C" kee="other"/> + <projects uuid="A" + uuid_path="NOT_USED" + kee="org.struts:struts" + id="10"/> + <projects uuid="B" + uuid_path="NOT_USED" + kee="org.apache:commons-lang" + id="11"/> + <projects uuid="C" + uuid_path="NOT_USED" + kee="other" + id="12"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/select_module_properties_tree.xml b/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/select_module_properties_tree.xml index 5dd05ae8a5a..9c6b865eaa4 100644 --- a/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/select_module_properties_tree.xml +++ b/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/select_module_properties_tree.xml @@ -1,61 +1,158 @@ <dataset> <!-- global --> - <properties id="1" prop_key="global.one" text_value="one" resource_id="[null]" user_id="[null]"/> - <properties id="2" prop_key="global.two" text_value="two" resource_id="[null]" user_id="[null]"/> + <properties id="1" + prop_key="global.one" + text_value="one" + resource_id="[null]" + user_id="[null]"/> + <properties id="2" + prop_key="global.two" + text_value="two" + resource_id="[null]" + user_id="[null]"/> <!-- org.struts:struts --> - <properties id="3" prop_key="struts.one" text_value="one" resource_id="1" user_id="[null]"/> + <properties id="3" + prop_key="struts.one" + text_value="one" + resource_id="1" + user_id="[null]"/> <!-- org.struts:struts-core --> - <properties id="4" prop_key="core.one" text_value="one" resource_id="2" user_id="[null]"/> - <properties id="7" prop_key="core.two" text_value="two" resource_id="2" user_id="[null]"/> + <properties id="4" + prop_key="core.one" + text_value="one" + resource_id="2" + user_id="[null]"/> + <properties id="7" + prop_key="core.two" + text_value="two" + resource_id="2" + user_id="[null]"/> <!-- org.struts:struts-data --> - <properties id="8" prop_key="data.one" text_value="one" resource_id="3" user_id="[null]"/> + <properties id="8" + prop_key="data.one" + text_value="one" + resource_id="3" + user_id="[null]"/> <!-- user --> - <properties id="5" prop_key="user.one" text_value="one" resource_id="[null]" user_id="100"/> - <properties id="6" prop_key="user.two" text_value="two" resource_id="1" user_id="102"/> + <properties id="5" + prop_key="user.one" + text_value="one" + resource_id="[null]" + user_id="100"/> + <properties id="6" + prop_key="user.two" + text_value="two" + resource_id="1" + user_id="102"/> <!-- root project --> - <projects id="1" root_uuid="ABCD" scope="PRJ" qualifier="TRK" kee="org.struts:struts" name="Struts" - uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path="." - description="the description" long_name="Apache Struts" - enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - authorization_updated_at="[null]"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path="." + description="the description" + long_name="Apache Struts" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + authorization_updated_at="[null]" + id="1" + root_uuid="ABCD" + scope="PRJ" + qualifier="TRK" + kee="org.struts:struts" + name="Struts"/> <!-- module --> - <projects id="2" root_uuid="ABCD" kee="org.struts:struts-core" name="Struts Core" - uuid="EFGH" project_uuid="ABCD" module_uuid="[null]" module_uuid_path=".ABCD." - scope="PRJ" qualifier="BRC" long_name="Struts Core" - description="[null]" enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" - authorization_updated_at="[null]"/> + <projects uuid="EFGH" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path=".ABCD." + scope="PRJ" + qualifier="BRC" + long_name="Struts Core" + description="[null]" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]" + id="2" + root_uuid="ABCD" + kee="org.struts:struts-core" + name="Struts Core"/> <!-- sub module --> - <projects id="3" root_uuid="ABCD" kee="org.struts:struts-data" name="Struts Data" - uuid="FGHI" project_uuid="ABCD" module_uuid="EFGH" module_uuid_path=".ABCD.EFGH." - scope="PRJ" qualifier="BRC" long_name="Struts Data" - description="[null]" enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" - authorization_updated_at="[null]"/> + <projects uuid="FGHI" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="EFGH" + module_uuid_path=".ABCD.EFGH." + scope="PRJ" + qualifier="BRC" + long_name="Struts Data" + description="[null]" + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]" + id="3" + root_uuid="ABCD" + kee="org.struts:struts-data" + name="Struts Data"/> <!-- directory --> - <projects long_name="org.struts" id="4" scope="DIR" qualifier="DIR" kee="org.struts:struts-core:src/org/struts" - uuid="GHIJ" project_uuid="ABCD" module_uuid="FGHI" module_uuid_path=".ABCD.EFGH.FGHI." - name="src/org/struts" root_uuid="FGHI" + <projects uuid="GHIJ" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="FGHI" + module_uuid_path=".ABCD.EFGH.FGHI." + name="src/org/struts" + root_uuid="FGHI" description="[null]" - enabled="[true]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" path="src/org/struts" - authorization_updated_at="[null]"/> + enabled="[true]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="src/org/struts" + authorization_updated_at="[null]" + long_name="org.struts" + id="4" + scope="DIR" + qualifier="DIR" + kee="org.struts:struts-core:src/org/struts"/> <!-- file --> - <projects long_name="org.struts.RequestContext" id="5" scope="FIL" qualifier="FIL" - kee="org.struts:struts-core:src/org/struts/RequestContext.java" - uuid="HIJK" project_uuid="ABCD" module_uuid="GHIJ" module_uuid_path=".ABCD.EFGH.FGHI." - name="RequestContext.java" root_uuid="FGHI" + <projects uuid="HIJK" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="GHIJ" + module_uuid_path=".ABCD.EFGH.FGHI." + name="RequestContext.java" + root_uuid="FGHI" description="[null]" - enabled="[true]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" - path="src/org/struts/RequestContext.java" authorization_updated_at="[null]"/> + enabled="[true]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="src/org/struts/RequestContext.java" + authorization_updated_at="[null]" + long_name="org.struts.RequestContext" + id="5" + scope="FIL" + qualifier="FIL" + kee="org.struts:struts-core:src/org/struts/RequestContext.java"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/shouldFindUsersForNotification.xml b/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/shouldFindUsersForNotification.xml index b6926426ff1..14b5c5e4474 100644 --- a/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/shouldFindUsersForNotification.xml +++ b/sonar-db/src/test/resources/org/sonar/db/property/PropertiesDaoTest/shouldFindUsersForNotification.xml @@ -1,7 +1,15 @@ <dataset> - <projects id="45" uuid="uuid_45" root_uuid="uuid_45" kee="45"/> - <projects id="56" uuid="uuid_56" root_uuid="uuid_56" kee="46"/> + <projects uuid="uuid_45" + uuid_path="NOT_USED" + root_uuid="uuid_45" + kee="45" + id="45"/> + <projects uuid="uuid_56" + uuid_path="NOT_USED" + root_uuid="uuid_56" + kee="46" + id="56"/> <properties id="1" diff --git a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeCommandsTest/shouldDeleteResource.xml b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeCommandsTest/shouldDeleteResource.xml index 57686c91d82..fc649ec3664 100644 --- a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeCommandsTest/shouldDeleteResource.xml +++ b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeCommandsTest/shouldDeleteResource.xml @@ -2,6 +2,7 @@ <projects id="1" uuid="uuid_1" + uuid_path="NOT_USED" enabled="[true]" root_uuid="uuid_1" long_name="[null]" diff --git a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/delete_file_sources_of_disabled_resources.xml b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/delete_file_sources_of_disabled_resources.xml index 1683404aa79..86697f8b4dc 100644 --- a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/delete_file_sources_of_disabled_resources.xml +++ b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/delete_file_sources_of_disabled_resources.xml @@ -1,91 +1,266 @@ <dataset> <!-- the project --> - <projects id="1" enabled="[true]" root_uuid="ABCD" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" - module_uuid_path="." created_at="[null]" - long_name="[null]" scope="PRJ" qualifier="TRK" kee="project" name="project" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - deprecated_kee="[null]" authorization_updated_at="[null]"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path="." + created_at="[null]" + long_name="[null]" + scope="PRJ" + qualifier="TRK" + kee="project" + name="project" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + deprecated_kee="[null]" + authorization_updated_at="[null]" + id="1" + enabled="[true]" + root_uuid="ABCD"/> <!-- the directory --> - <projects id="2" enabled="[true]" root_uuid="ABCD" uuid="EFGH" project_uuid="ABCD" module_uuid="ABCD" - module_uuid_path="." created_at="[null]" - long_name="[null]" scope="DIR" qualifier="DIR" kee="project:my/dir" name="my/dir" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - deprecated_kee="[null]" authorization_updated_at="[null]"/> + <projects uuid="EFGH" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="ABCD" + module_uuid_path="." + created_at="[null]" + long_name="[null]" + scope="DIR" + qualifier="DIR" + kee="project:my/dir" + name="my/dir" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + deprecated_kee="[null]" + authorization_updated_at="[null]" + id="2" + enabled="[true]" + root_uuid="ABCD"/> <!-- the files --> - <projects id="3" enabled="[true]" root_uuid="ABCD" uuid="GHIJ" project_uuid="ABCD" module_uuid="ABCD" - module_uuid_path=".ABCD." created_at="[null]" - long_name="[null]" scope="FIL" qualifier="FIL" kee="project:my/dir/File.java" name="my/dir/File.java" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - deprecated_kee="[null]" authorization_updated_at="[null]"/> - <projects id="4" enabled="[true]" root_uuid="ABCD" uuid="KLMN" project_uuid="ABCD" module_uuid="ABCD" - module_uuid_path=".ABCD." created_at="[null]" - long_name="[null]" scope="FIL" qualifier="FIL" kee="project:my/dir/DeletedFile.java" + <projects uuid="GHIJ" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="ABCD" + module_uuid_path=".ABCD." + created_at="[null]" + long_name="[null]" + scope="FIL" + qualifier="FIL" + kee="project:my/dir/File.java" + name="my/dir/File.java" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + deprecated_kee="[null]" + authorization_updated_at="[null]" + id="3" + enabled="[true]" + root_uuid="ABCD"/> + <projects uuid="KLMN" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="ABCD" + module_uuid_path=".ABCD." + created_at="[null]" + long_name="[null]" + scope="FIL" + qualifier="FIL" + kee="project:my/dir/DeletedFile.java" name="my/dir/DeletedFile.java" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - deprecated_kee="[null]" authorization_updated_at="[null]"/> + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + deprecated_kee="[null]" + authorization_updated_at="[null]" + id="4" + enabled="[true]" + root_uuid="ABCD"/> <snapshots id="1" uuid="u1" - component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - status="P" islast="[false]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" - build_date="1228222680000" version="[null]" path="[null]"/> + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + status="P" + islast="[false]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <snapshots id="2" uuid="u2" - component_uuid="EFGH" parent_snapshot_id="1" root_component_uuid="ABCD" root_snapshot_id="1" - status="P" islast="[false]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" - build_date="1228222680000" version="[null]" path="[null]"/> + component_uuid="EFGH" + parent_snapshot_id="1" + root_component_uuid="ABCD" + root_snapshot_id="1" + status="P" + islast="[false]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <snapshots id="3" uuid="u3" - component_uuid="GHIJ" parent_snapshot_id="2" root_component_uuid="ABCD" root_snapshot_id="1" - status="P" islast="[false]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" - build_date="1228222680000" version="[null]" path="[null]"/> + component_uuid="GHIJ" + parent_snapshot_id="2" + root_component_uuid="ABCD" + root_snapshot_id="1" + status="P" + islast="[false]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <!-- isLast is true, don't want to delete associated source lines --> <snapshots id="4" uuid="u4" - component_uuid="KLMN" parent_snapshot_id="2" root_component_uuid="ABCD" root_snapshot_id="1" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" - build_date="1228222680000" version="[null]" path="[null]"/> + component_uuid="KLMN" + parent_snapshot_id="2" + root_component_uuid="ABCD" + root_snapshot_id="1" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> - <file_sources id="1" project_uuid="ABCD" file_uuid="GHIJ" binary_data="[null]" line_hashes="[null]" - data_hash="321654987" revision="123456789" - created_at="123456789" updated_at="123456789" src_hash="12345" data_type="SOURCE"/> - <file_sources id="2" project_uuid="ABCD" file_uuid="KLMN" binary_data="[null]" line_hashes="[null]" - data_hash="321654988" revision="123456789" - created_at="123456789" updated_at="123456789" src_hash="123456" data_type="SOURCE"/> - <file_sources id="3" project_uuid="ABCD" file_uuid="GHIJ" binary_data="[null]" line_hashes="[null]" - data_hash="321654987" revision="123456789" - created_at="123456789" updated_at="123456789" src_hash="12345" data_type="TEST"/> - <file_sources id="4" project_uuid="ABCD" file_uuid="KLMN" binary_data="[null]" line_hashes="[null]" - data_hash="321654988" revision="123456789" - created_at="123456789" updated_at="123456789" src_hash="123456" data_type="TEST"/> + <file_sources id="1" + project_uuid="ABCD" + file_uuid="GHIJ" + binary_data="[null]" + line_hashes="[null]" + data_hash="321654987" + revision="123456789" + created_at="123456789" + updated_at="123456789" + src_hash="12345" + data_type="SOURCE"/> + <file_sources id="2" + project_uuid="ABCD" + file_uuid="KLMN" + binary_data="[null]" + line_hashes="[null]" + data_hash="321654988" + revision="123456789" + created_at="123456789" + updated_at="123456789" + src_hash="123456" + data_type="SOURCE"/> + <file_sources id="3" + project_uuid="ABCD" + file_uuid="GHIJ" + binary_data="[null]" + line_hashes="[null]" + data_hash="321654987" + revision="123456789" + created_at="123456789" + updated_at="123456789" + src_hash="12345" + data_type="TEST"/> + <file_sources id="4" + project_uuid="ABCD" + file_uuid="KLMN" + binary_data="[null]" + line_hashes="[null]" + data_hash="321654988" + revision="123456789" + created_at="123456789" + updated_at="123456789" + src_hash="123456" + data_type="TEST"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/delete_project_in_ce_activity_when_deleting_project.xml b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/delete_project_in_ce_activity_when_deleting_project.xml index 14aab1abc4e..c557567026a 100644 --- a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/delete_project_in_ce_activity_when_deleting_project.xml +++ b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/delete_project_in_ce_activity_when_deleting_project.xml @@ -1,11 +1,24 @@ <dataset> <!-- project --> - <projects id="1" enabled="[true]" root_id="[null]" - uuid="A" project_uuid="A" module_uuid="[null]" module_uuid_path=".A." - long_name="[null]" scope="PRJ" qualifier="TRK" kee="project" name="project" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" - authorization_updated_at="[null]"/> + <projects uuid="A" + uuid_path="NOT_USED" + project_uuid="A" + module_uuid="[null]" + module_uuid_path=".A." + long_name="[null]" + scope="PRJ" + qualifier="TRK" + kee="project" + name="project" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]" + id="1" + enabled="[true]" + root_id="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/disable_resources_without_last_snapshot-result.xml b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/disable_resources_without_last_snapshot-result.xml index 0a2d184a762..053b937a8b6 100644 --- a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/disable_resources_without_last_snapshot-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/disable_resources_without_last_snapshot-result.xml @@ -9,119 +9,286 @@ What has been changed : <dataset> <!-- the project --> - <projects id="1" enabled="[false]" root_uuid="ABCD" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" - module_uuid_path="." created_at="[null]" - long_name="[null]" scope="PRJ" qualifier="TRK" kee="project" name="project" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - deprecated_kee="[null]" authorization_updated_at="[null]"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path="." + created_at="[null]" + long_name="[null]" + scope="PRJ" + qualifier="TRK" + kee="project" + name="project" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + deprecated_kee="[null]" + authorization_updated_at="[null]" + id="1" + enabled="[false]" + root_uuid="ABCD"/> <!-- the directory --> - <projects id="2" enabled="[false]" root_uuid="ABCD" uuid="EFGH" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path="." + <projects uuid="EFGH" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="ABCD" + module_uuid_path="." created_at="[null]" - long_name="[null]" scope="DIR" qualifier="DIR" kee="project:my/dir" name="my/dir" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - deprecated_kee="[null]" authorization_updated_at="[null]"/> + long_name="[null]" + scope="DIR" + qualifier="DIR" + kee="project:my/dir" + name="my/dir" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + deprecated_kee="[null]" + authorization_updated_at="[null]" + id="2" + enabled="[false]" + root_uuid="ABCD"/> <!-- the file --> - <projects id="3" enabled="[false]" root_uuid="ABCD" uuid="GHIJ" project_uuid="ABCD" module_uuid="ABCD" - module_uuid_path=".ABCD." created_at="[null]" - long_name="[null]" scope="FIL" qualifier="FIL" kee="project:my/dir/File.java" name="my/dir/File.java" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - deprecated_kee="[null]" authorization_updated_at="[null]"/> + <projects uuid="GHIJ" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="ABCD" + module_uuid_path=".ABCD." + created_at="[null]" + long_name="[null]" + scope="FIL" + qualifier="FIL" + kee="project:my/dir/File.java" + name="my/dir/File.java" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + deprecated_kee="[null]" + authorization_updated_at="[null]" + id="3" + enabled="[false]" + root_uuid="ABCD"/> <snapshots id="1" uuid="u1" - component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - status="P" islast="[false]" purge_status="1" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" - build_date="1228222680000" version="[null]" path="[null]"/> + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + status="P" + islast="[false]" + purge_status="1" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <snapshots id="2" uuid="u2" - component_uuid="EFGH" parent_snapshot_id="1" root_component_uuid="ABCD" root_snapshot_id="1" - status="P" islast="[false]" purge_status="1" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" - build_date="1228222680000" version="[null]" path="[null]"/> + component_uuid="EFGH" + parent_snapshot_id="1" + root_component_uuid="ABCD" + root_snapshot_id="1" + status="P" + islast="[false]" + purge_status="1" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <snapshots id="3" uuid="u3" - component_uuid="GHIJ" parent_snapshot_id="2" root_component_uuid="ABCD" root_snapshot_id="1" - status="P" islast="[false]" purge_status="1" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" - build_date="1228222680000" version="[null]" path="[null]"/> + component_uuid="GHIJ" + parent_snapshot_id="2" + root_component_uuid="ABCD" + root_snapshot_id="1" + status="P" + islast="[false]" + purge_status="1" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <!-- Open issue on file --> - <issues id="1" kee="ISSUE-1" + <issues id="1" + kee="ISSUE-1" component_uuid="GHIJ" project_uuid="ABCD" status="CLOSED" issue_close_date="1396994400000" - resolution="REMOVED" line="200" severity="BLOCKER" reporter="[null]" assignee="arthur" rule_id="500" + resolution="REMOVED" + line="200" + severity="BLOCKER" + reporter="[null]" + assignee="arthur" + rule_id="500" manual_severity="[false]" - message="[null]" action_plan_key="[null]" gap="[null]" effort="[null]" - issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="1450000000000" issue_creation_date="1366063200000" issue_update_date="1396994400000" - created_at="1450000000000" tags="[null]" + message="[null]" + action_plan_key="[null]" + gap="[null]" + effort="[null]" + issue_attributes="[null]" + checksum="[null]" + author_login="[null]" + updated_at="1450000000000" + issue_creation_date="1366063200000" + issue_update_date="1396994400000" + created_at="1450000000000" + tags="[null]" locations="[null]" issue_type="[null]" - /> + /> <!-- Open issue on directory --> - <issues id="2" kee="ISSUE-2" + <issues id="2" + kee="ISSUE-2" component_uuid="EFGH" project_uuid="ABCD" status="CLOSED" issue_close_date="1396994400000" - resolution="REMOVED" line="[null]" severity="BLOCKER" reporter="[null]" assignee="arthur" rule_id="500" + resolution="REMOVED" + line="[null]" + severity="BLOCKER" + reporter="[null]" + assignee="arthur" + rule_id="500" manual_severity="[false]" - message="[null]" action_plan_key="[null]" gap="[null]" effort="[null]" - issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="1450000000000" issue_creation_date="1366063200000" issue_update_date="1396994400000" - created_at="1450000000000" tags="[null]" locations="[null]" + message="[null]" + action_plan_key="[null]" + gap="[null]" + effort="[null]" + issue_attributes="[null]" + checksum="[null]" + author_login="[null]" + updated_at="1450000000000" + issue_creation_date="1366063200000" + issue_update_date="1396994400000" + created_at="1450000000000" + tags="[null]" + locations="[null]" issue_type="[null]"/> <!-- Open issue on project --> - <issues id="3" kee="ISSUE-3" + <issues id="3" + kee="ISSUE-3" component_uuid="ABCD" project_uuid="ABCD" status="CLOSED" issue_close_date="1396994400000" - resolution="REMOVED" line="[null]" severity="BLOCKER" reporter="[null]" assignee="arthur" rule_id="500" + resolution="REMOVED" + line="[null]" + severity="BLOCKER" + reporter="[null]" + assignee="arthur" + rule_id="500" manual_severity="[false]" - message="[null]" action_plan_key="[null]" gap="[null]" effort="[null]" - issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="1450000000000" issue_creation_date="1366063200000" issue_update_date="1396994400000" - created_at="1450000000000" tags="[null]" locations="[null]" + message="[null]" + action_plan_key="[null]" + gap="[null]" + effort="[null]" + issue_attributes="[null]" + checksum="[null]" + author_login="[null]" + updated_at="1450000000000" + issue_creation_date="1366063200000" + issue_update_date="1396994400000" + created_at="1450000000000" + tags="[null]" + locations="[null]" issue_type="[null]"/> <!-- Resolved issue on file -> not to be updated --> - <issues id="4" kee="ISSUE-4" + <issues id="4" + kee="ISSUE-4" component_uuid="GHIJ" project_uuid="ABCD" status="CLOSED" issue_close_date="1449529200000" - resolution="FIXED" line="200" severity="BLOCKER" reporter="[null]" assignee="arthur" rule_id="500" + resolution="FIXED" + line="200" + severity="BLOCKER" + reporter="[null]" + assignee="arthur" + rule_id="500" manual_severity="[false]" - message="[null]" action_plan_key="[null]" gap="[null]" effort="[null]" - issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="1450000000000" issue_creation_date="1366063200000" issue_update_date="1396908000000" - created_at="1450000000000" tags="[null]" locations="[null]" + message="[null]" + action_plan_key="[null]" + gap="[null]" + effort="[null]" + issue_attributes="[null]" + checksum="[null]" + author_login="[null]" + updated_at="1450000000000" + issue_creation_date="1366063200000" + issue_update_date="1396908000000" + created_at="1450000000000" + tags="[null]" + locations="[null]" issue_type="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/disable_resources_without_last_snapshot.xml b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/disable_resources_without_last_snapshot.xml index 09ad267ff54..eb5e979cd42 100644 --- a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/disable_resources_without_last_snapshot.xml +++ b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/disable_resources_without_last_snapshot.xml @@ -1,117 +1,281 @@ <dataset> <!-- the project --> - <projects id="1" enabled="[true]" root_uuid="ABCD" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" - module_uuid_path="." created_at="[null]" - long_name="[null]" scope="PRJ" qualifier="TRK" kee="project" name="project" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - deprecated_kee="[null]" authorization_updated_at="[null]"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path="." + created_at="[null]" + long_name="[null]" + scope="PRJ" + qualifier="TRK" + kee="project" + name="project" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + deprecated_kee="[null]" + authorization_updated_at="[null]" + id="1" + enabled="[true]" + root_uuid="ABCD"/> <!-- the directory --> - <projects id="2" enabled="[true]" root_uuid="ABCD" uuid="EFGH" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path="." + <projects uuid="EFGH" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="ABCD" + module_uuid_path="." created_at="[null]" - long_name="[null]" scope="DIR" qualifier="DIR" kee="project:my/dir" name="my/dir" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - deprecated_kee="[null]" authorization_updated_at="[null]"/> + long_name="[null]" + scope="DIR" + qualifier="DIR" + kee="project:my/dir" + name="my/dir" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + deprecated_kee="[null]" + authorization_updated_at="[null]" + id="2" + enabled="[true]" + root_uuid="ABCD"/> <!-- the file --> - <projects id="3" enabled="[true]" root_uuid="ABCD" uuid="GHIJ" project_uuid="ABCD" module_uuid="ABCD" - module_uuid_path=".ABCD." created_at="[null]" - long_name="[null]" scope="FIL" qualifier="FIL" kee="project:my/dir/File.java" name="my/dir/File.java" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - deprecated_kee="[null]" authorization_updated_at="[null]"/> + <projects uuid="GHIJ" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="ABCD" + module_uuid_path=".ABCD." + created_at="[null]" + long_name="[null]" + scope="FIL" + qualifier="FIL" + kee="project:my/dir/File.java" + name="my/dir/File.java" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + deprecated_kee="[null]" + authorization_updated_at="[null]" + id="3" + enabled="[true]" + root_uuid="ABCD"/> <snapshots id="1" uuid="u1" - component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - status="P" islast="[false]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + status="P" + islast="[false]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <snapshots id="2" uuid="u2" - component_uuid="EFGH" parent_snapshot_id="1" root_component_uuid="ABCD" root_snapshot_id="1" - status="P" islast="[false]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="EFGH" + parent_snapshot_id="1" + root_component_uuid="ABCD" + root_snapshot_id="1" + status="P" + islast="[false]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <snapshots id="3" uuid="u3" - component_uuid="GHIJ" parent_snapshot_id="2" root_component_uuid="ABCD" root_snapshot_id="1" - status="P" islast="[false]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="GHIJ" + parent_snapshot_id="2" + root_component_uuid="ABCD" + root_snapshot_id="1" + status="P" + islast="[false]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <!-- Open issue on file --> - <issues id="1" kee="ISSUE-1" + <issues id="1" + kee="ISSUE-1" component_uuid="GHIJ" project_uuid="ABCD" status="OPEN" issue_close_date="[null]" - resolution="[null]" line="200" severity="BLOCKER" reporter="[null]" assignee="arthur" rule_id="500" + resolution="[null]" + line="200" + severity="BLOCKER" + reporter="[null]" + assignee="arthur" + rule_id="500" manual_severity="[false]" - message="[null]" action_plan_key="[null]" gap="[null]" effort="[null]" - issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="[null]" issue_creation_date="1366063200000" issue_update_date="1366063200000" - created_at="1450000000000" locations="[null]" + message="[null]" + action_plan_key="[null]" + gap="[null]" + effort="[null]" + issue_attributes="[null]" + checksum="[null]" + author_login="[null]" + updated_at="[null]" + issue_creation_date="1366063200000" + issue_update_date="1366063200000" + created_at="1450000000000" + locations="[null]" issue_type="[null]"/> <!-- Open issue on directory --> - <issues id="2" kee="ISSUE-2" + <issues id="2" + kee="ISSUE-2" component_uuid="EFGH" project_uuid="ABCD" status="OPEN" issue_close_date="[null]" - resolution="[null]" line="[null]" severity="BLOCKER" reporter="[null]" assignee="arthur" rule_id="500" + resolution="[null]" + line="[null]" + severity="BLOCKER" + reporter="[null]" + assignee="arthur" + rule_id="500" manual_severity="[false]" - message="[null]" action_plan_key="[null]" gap="[null]" effort="[null]" - issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="[null]" issue_creation_date="1366063200000" issue_update_date="1366063200000" - created_at="1450000000000" locations="[null]" + message="[null]" + action_plan_key="[null]" + gap="[null]" + effort="[null]" + issue_attributes="[null]" + checksum="[null]" + author_login="[null]" + updated_at="[null]" + issue_creation_date="1366063200000" + issue_update_date="1366063200000" + created_at="1450000000000" + locations="[null]" issue_type="[null]"/> <!-- Open issue on project --> - <issues id="3" kee="ISSUE-3" + <issues id="3" + kee="ISSUE-3" component_uuid="ABCD" project_uuid="ABCD" status="CONFIRM" issue_close_date="[null]" - resolution="[null]" line="[null]" severity="BLOCKER" reporter="[null]" assignee="arthur" rule_id="500" + resolution="[null]" + line="[null]" + severity="BLOCKER" + reporter="[null]" + assignee="arthur" + rule_id="500" manual_severity="[false]" - message="[null]" action_plan_key="[null]" gap="[null]" effort="[null]" - issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="[null]" issue_creation_date="1366063200000" issue_update_date="1366063200000" - created_at="1450000000000" locations="[null]" + message="[null]" + action_plan_key="[null]" + gap="[null]" + effort="[null]" + issue_attributes="[null]" + checksum="[null]" + author_login="[null]" + updated_at="[null]" + issue_creation_date="1366063200000" + issue_update_date="1366063200000" + created_at="1450000000000" + locations="[null]" issue_type="[null]"/> <!-- Resolved issue on file -> not to be updated --> - <issues id="4" kee="ISSUE-4" + <issues id="4" + kee="ISSUE-4" component_uuid="GHIJ" project_uuid="ABCD" status="CLOSED" issue_close_date="1449529200000" - resolution="FIXED" line="200" severity="BLOCKER" reporter="[null]" assignee="arthur" rule_id="500" + resolution="FIXED" + line="200" + severity="BLOCKER" + reporter="[null]" + assignee="arthur" + rule_id="500" manual_severity="[false]" - message="[null]" action_plan_key="[null]" gap="[null]" effort="[null]" - issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="1450000000000" issue_creation_date="1366063200000" issue_update_date="1396908000000" - created_at="1450000000000" locations="[null]" + message="[null]" + action_plan_key="[null]" + gap="[null]" + effort="[null]" + issue_attributes="[null]" + checksum="[null]" + author_login="[null]" + updated_at="1450000000000" + issue_creation_date="1366063200000" + issue_update_date="1396908000000" + created_at="1450000000000" + locations="[null]" issue_type="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAbortedBuilds-result.xml b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAbortedBuilds-result.xml index c9f3cff3536..21a21842005 100644 --- a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAbortedBuilds-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAbortedBuilds-result.xml @@ -6,36 +6,87 @@ Snapshot 2 has been deleted <dataset> <!-- the project --> - <projects id="1" enabled="[true]" root_id="[null]" - uuid="projectUUID" project_uuid="projectUUID" - long_name="[null]" scope="PRJ" qualifier="TRK" kee="project" name="project" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" - authorization_updated_at="[null]"/> + <projects uuid="projectUUID" + uuid_path="NOT_USED" + project_uuid="projectUUID" + long_name="[null]" + scope="PRJ" + qualifier="TRK" + kee="project" + name="project" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]" + id="1" + enabled="[true]" + root_id="[null]"/> <!-- past snapshot with status "processed" and already purged --> <snapshots id="1" uuid="u1" - component_uuid="projectUUID" parent_snapshot_id="[null]" root_component_uuid="projectUUID" root_snapshot_id="[null]" - status="P" islast="[false]" purge_status="1" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="projectUUID" + parent_snapshot_id="[null]" + root_component_uuid="projectUUID" + root_snapshot_id="[null]" + status="P" + islast="[false]" + purge_status="1" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <!-- snapshot with status "processed" and flagged as "last" -> do not purge and do not delete --> <snapshots id="3" uuid="u3" - component_uuid="projectUUID" parent_snapshot_id="[null]" root_component_uuid="projectUUID" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="0" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="projectUUID" + parent_snapshot_id="[null]" + root_component_uuid="projectUUID" + root_snapshot_id="[null]" + status="P" + islast="[true]" + purge_status="0" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAbortedBuilds.xml b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAbortedBuilds.xml index 0628262478d..6a4b6ac9b03 100644 --- a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAbortedBuilds.xml +++ b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteAbortedBuilds.xml @@ -1,49 +1,120 @@ <dataset> <!-- the project --> - <projects id="1" enabled="[true]" root_uuid="projectUUID" - uuid="projectUUID" project_uuid="projectUUID" - long_name="[null]" scope="PRJ" qualifier="TRK" kee="project" name="project" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" - authorization_updated_at="[null]"/> + <projects uuid="projectUUID" + uuid_path="NOT_USED" + project_uuid="projectUUID" + long_name="[null]" + scope="PRJ" + qualifier="TRK" + kee="project" + name="project" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]" + id="1" + enabled="[true]" + root_uuid="projectUUID"/> <!-- past snapshot with status "processed" and already purged --> <snapshots id="1" uuid="u1" - component_uuid="projectUUID" parent_snapshot_id="[null]" root_component_uuid="projectUUID" root_snapshot_id="[null]" - status="P" islast="[false]" purge_status="1" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="projectUUID" + parent_snapshot_id="[null]" + root_component_uuid="projectUUID" + root_snapshot_id="[null]" + status="P" + islast="[false]" + purge_status="1" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <!-- snapshot with status "unprocessed" -> to be deleted --> <snapshots id="2" uuid="u2" - component_uuid="projectUUID" parent_snapshot_id="[null]" root_component_uuid="projectUUID" root_snapshot_id="[null]" - status="U" islast="[false]" purge_status="0" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="projectUUID" + parent_snapshot_id="[null]" + root_component_uuid="projectUUID" + root_snapshot_id="[null]" + status="U" + islast="[false]" + purge_status="0" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <!-- snapshot with status "processed" and flagged as "last" -> do not purge and do not delete --> <snapshots id="3" uuid="u3" - component_uuid="projectUUID" parent_snapshot_id="[null]" root_component_uuid="projectUUID" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="0" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="projectUUID" + parent_snapshot_id="[null]" + root_component_uuid="projectUUID" + root_snapshot_id="[null]" + status="P" + islast="[true]" + purge_status="0" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteHistoricalDataOfDirectoriesAndFiles-result.xml b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteHistoricalDataOfDirectoriesAndFiles-result.xml index 1a5eced40d7..2b56c7bb883 100644 --- a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteHistoricalDataOfDirectoriesAndFiles-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteHistoricalDataOfDirectoriesAndFiles-result.xml @@ -7,75 +7,203 @@ What has been changed : purge_status=1 on snapshot 4 (PRJ) and snapshots 5 and 6 <dataset> <!-- the project --> - <projects id="1" enabled="[true]" root_uuid="ABCD" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" - module_uuid_path="." created_at="[null]" - long_name="[null]" scope="PRJ" qualifier="TRK" kee="project" name="project" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - deprecated_kee="[null]" authorization_updated_at="[null]"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path="." + created_at="[null]" + long_name="[null]" + scope="PRJ" + qualifier="TRK" + kee="project" + name="project" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + deprecated_kee="[null]" + authorization_updated_at="[null]" + id="1" + enabled="[true]" + root_uuid="ABCD"/> <!-- the directory --> - <projects id="2" enabled="[true]" root_uuid="ABCD" uuid="EFGH" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path="." + <projects uuid="EFGH" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="ABCD" + module_uuid_path="." created_at="[null]" - long_name="[null]" scope="DIR" qualifier="DIR" kee="project:my/dir" name="my/dir" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - deprecated_kee="[null]" authorization_updated_at="[null]"/> + long_name="[null]" + scope="DIR" + qualifier="DIR" + kee="project:my/dir" + name="my/dir" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + deprecated_kee="[null]" + authorization_updated_at="[null]" + id="2" + enabled="[true]" + root_uuid="ABCD"/> <!-- the file --> - <projects id="3" enabled="[true]" root_uuid="ABCD" uuid="GHIJ" project_uuid="ABCD" module_uuid="ABCD" - module_uuid_path=".ABCD." created_at="[null]" - long_name="[null]" scope="FIL" qualifier="FIL" kee="project:my/dir/File.java" name="my/dir/File.java" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - deprecated_kee="[null]" authorization_updated_at="[null]"/> + <projects uuid="GHIJ" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="ABCD" + module_uuid_path=".ABCD." + created_at="[null]" + long_name="[null]" + scope="FIL" + qualifier="FIL" + kee="project:my/dir/File.java" + name="my/dir/File.java" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + deprecated_kee="[null]" + authorization_updated_at="[null]" + id="3" + enabled="[true]" + root_uuid="ABCD"/> <!-- do not purge last snapshots --> <snapshots id="1" uuid="u1" - component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <snapshots id="2" uuid="u2" - component_uuid="EFGH" parent_snapshot_id="1" root_component_uuid="ABCD" root_snapshot_id="1" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="DIR" qualifier="DIR" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="EFGH" + parent_snapshot_id="1" + root_component_uuid="ABCD" + root_snapshot_id="1" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="DIR" + qualifier="DIR" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <snapshots id="3" uuid="u3" - component_uuid="GHIJ" parent_snapshot_id="2" root_component_uuid="ABCD" root_snapshot_id="1" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="FIL" qualifier="FIL" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="GHIJ" + parent_snapshot_id="2" + root_component_uuid="ABCD" + root_snapshot_id="1" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="FIL" + qualifier="FIL" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <!-- snapshots to be purged --> <snapshots id="4" uuid="u4" - component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - status="P" islast="[false]" purge_status="1" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + status="P" + islast="[false]" + purge_status="1" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteHistoricalDataOfDirectoriesAndFiles.xml b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteHistoricalDataOfDirectoriesAndFiles.xml index 0e92ef653ca..ae528c94fff 100644 --- a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteHistoricalDataOfDirectoriesAndFiles.xml +++ b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteHistoricalDataOfDirectoriesAndFiles.xml @@ -1,100 +1,268 @@ <dataset> <!-- the project --> - <projects id="1" enabled="[true]" root_uuid="ABCD" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" - module_uuid_path="." created_at="[null]" - long_name="[null]" scope="PRJ" qualifier="TRK" kee="project" name="project" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - deprecated_kee="[null]" authorization_updated_at="[null]"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path="." + created_at="[null]" + long_name="[null]" + scope="PRJ" + qualifier="TRK" + kee="project" + name="project" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + deprecated_kee="[null]" + authorization_updated_at="[null]" + id="1" + enabled="[true]" + root_uuid="ABCD"/> <!-- the directory --> - <projects id="2" enabled="[true]" root_uuid="ABCD" uuid="EFGH" project_uuid="ABCD" module_uuid="ABCD" module_uuid_path="." + <projects uuid="EFGH" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="ABCD" + module_uuid_path="." created_at="[null]" - long_name="[null]" scope="DIR" qualifier="DIR" kee="project:my/dir" name="my/dir" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - deprecated_kee="[null]" authorization_updated_at="[null]"/> + long_name="[null]" + scope="DIR" + qualifier="DIR" + kee="project:my/dir" + name="my/dir" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + deprecated_kee="[null]" + authorization_updated_at="[null]" + id="2" + enabled="[true]" + root_uuid="ABCD"/> <!-- the file --> - <projects id="3" enabled="[true]" root_uuid="ABCD" uuid="GHIJ" project_uuid="ABCD" module_uuid="ABCD" - module_uuid_path=".ABCD." created_at="[null]" - long_name="[null]" scope="FIL" qualifier="FIL" kee="project:my/dir/File.java" name="my/dir/File.java" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" path="[null]" - deprecated_kee="[null]" authorization_updated_at="[null]"/> + <projects uuid="GHIJ" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="ABCD" + module_uuid_path=".ABCD." + created_at="[null]" + long_name="[null]" + scope="FIL" + qualifier="FIL" + kee="project:my/dir/File.java" + name="my/dir/File.java" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + deprecated_kee="[null]" + authorization_updated_at="[null]" + id="3" + enabled="[true]" + root_uuid="ABCD"/> <!-- do not purge last snapshots --> <snapshots id="1" uuid="u1" - component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <snapshots id="2" uuid="u2" - component_uuid="EFGH" parent_snapshot_id="1" root_component_uuid="ABCD" root_snapshot_id="1" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="DIR" qualifier="DIR" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="EFGH" + parent_snapshot_id="1" + root_component_uuid="ABCD" + root_snapshot_id="1" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="DIR" + qualifier="DIR" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <snapshots id="3" uuid="u3" - component_uuid="GHIJ" parent_snapshot_id="2" root_component_uuid="ABCD" root_snapshot_id="1" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="FIL" qualifier="FIL" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="GHIJ" + parent_snapshot_id="2" + root_component_uuid="ABCD" + root_snapshot_id="1" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="FIL" + qualifier="FIL" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <!-- snapshots to be purged --> <snapshots id="4" uuid="u4" - component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - status="P" islast="[false]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + status="P" + islast="[false]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <snapshots id="5" uuid="u5" - component_uuid="EFGH" parent_snapshot_id="4" root_component_uuid="ABCD" root_snapshot_id="4" - status="P" islast="[false]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="DIR" qualifier="DIR" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="EFGH" + parent_snapshot_id="4" + root_component_uuid="ABCD" + root_snapshot_id="4" + status="P" + islast="[false]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="DIR" + qualifier="DIR" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <snapshots id="6" uuid="u6" - component_uuid="GHIJ" parent_snapshot_id="5" root_component_uuid="ABCD" root_snapshot_id="4" - status="P" islast="[false]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="FIL" qualifier="FIL" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="GHIJ" + parent_snapshot_id="5" + root_component_uuid="ABCD" + root_snapshot_id="4" + status="P" + islast="[false]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="FIL" + qualifier="FIL" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteProject.xml b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteProject.xml index 82e551454dd..8e1b238faf0 100644 --- a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteProject.xml +++ b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldDeleteProject.xml @@ -1,28 +1,68 @@ <dataset> <!-- root --> - <projects id="1" enabled="[true]" root_uuid="A" - uuid="A" project_uuid="A" module_uuid="[null]" module_uuid_path=".A." - long_name="[null]" scope="PRJ" qualifier="TRK" kee="project" name="project" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" - authorization_updated_at="[null]"/> + <projects uuid="A" + uuid_path="NOT_USED" + project_uuid="A" + module_uuid="[null]" + module_uuid_path=".A." + long_name="[null]" + scope="PRJ" + qualifier="TRK" + kee="project" + name="project" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]" + id="1" + enabled="[true]" + root_uuid="A"/> <snapshots id="1" uuid="u1" - component_uuid="A" parent_snapshot_id="[null]" root_component_uuid="A" root_snapshot_id="[null]" - status="P" islast="[false]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" + component_uuid="A" + parent_snapshot_id="[null]" + root_component_uuid="A" + root_snapshot_id="[null]" + status="P" + islast="[false]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + version="[null]" + path="[null]"/> - <issues id="1" kee="ABCDE" component_uuid="A" project_uuid="A" status="CLOSED" resolution="[null]" line="200" + <issues id="1" + kee="ABCDE" + component_uuid="A" + project_uuid="A" + status="CLOSED" + resolution="[null]" + line="200" severity="BLOCKER" - reporter="[null]" assignee="arthur" rule_id="500" + reporter="[null]" + assignee="arthur" + rule_id="500" manual_severity="[false]" message="[null]" action_plan_key="[null]" @@ -33,11 +73,19 @@ issue_close_date="1366063200000" locations="[null]" issue_type="[null]" - /> + /> - <issues id="2" kee="ABCDF" component_uuid="A" project_uuid="A" status="CLOSED" resolution="[null]" line="200" + <issues id="2" + kee="ABCDF" + component_uuid="A" + project_uuid="A" + status="CLOSED" + resolution="[null]" + line="200" severity="BLOCKER" - reporter="[null]" assignee="arthur" rule_id="500" + reporter="[null]" + assignee="arthur" + rule_id="500" manual_severity="[false]" message="[null]" action_plan_key="[null]" @@ -48,70 +96,179 @@ issue_close_date="1366063200000" locations="[null]" issue_type="[null]" - /> + /> - <issue_changes id="1" kee="[null]" issue_key="ABCDF" created_at="[null]" updated_at="[null]" user_login="admin" - change_type="comment" change_data="abc"/> + <issue_changes id="1" + kee="[null]" + issue_key="ABCDF" + created_at="[null]" + updated_at="[null]" + user_login="admin" + change_type="comment" + change_data="abc"/> <!-- modules --> - <projects id="2" enabled="[true]" root_uuid="A" - uuid="B" project_uuid="A" module_uuid="A" module_uuid_path=".A.B." - long_name="[null]" scope="PRJ" qualifier="BRC" kee="module1" name="module1" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" - authorization_updated_at="[null]"/> + <projects uuid="B" + uuid_path="NOT_USED" + project_uuid="A" + module_uuid="A" + module_uuid_path=".A.B." + long_name="[null]" + scope="PRJ" + qualifier="BRC" + kee="module1" + name="module1" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]" + id="2" + enabled="[true]" + root_uuid="A"/> <snapshots id="2" uuid="u2" - component_uuid="B" parent_snapshot_id="1" root_component_uuid="A" root_snapshot_id="1" - status="P" islast="[false]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="BRC" created_at="1228222680000" + component_uuid="B" + parent_snapshot_id="1" + root_component_uuid="A" + root_snapshot_id="1" + status="P" + islast="[false]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="BRC" + created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + version="[null]" + path="[null]"/> - <projects id="3" enabled="[false]" root_uuid="A" - uuid="C" project_uuid="A" module_uuid="A" module_uuid_path=".A.C." - long_name="[null]" scope="PRJ" qualifier="BRC" kee="module2" name="module2" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" - authorization_updated_at="[null]"/> + <projects uuid="C" + uuid_path="NOT_USED" + project_uuid="A" + module_uuid="A" + module_uuid_path=".A.C." + long_name="[null]" + scope="PRJ" + qualifier="BRC" + kee="module2" + name="module2" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]" + id="3" + enabled="[false]" + root_uuid="A"/> <snapshots id="3" uuid="u3" - component_uuid="C" parent_snapshot_id="1" root_component_uuid="A" root_snapshot_id="1" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="BRC" created_at="1228222680000" + component_uuid="C" + parent_snapshot_id="1" + root_component_uuid="A" + root_snapshot_id="1" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="BRC" + created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + version="[null]" + path="[null]"/> <!-- file of module 2--> - <projects id="4" enabled="[false]" root_uuid="C" - uuid="D" project_uuid="A" module_uuid="C" module_uuid_path=".A.C." - long_name="[null]" scope="FIL" qualifier="FIL" kee="module2:File.java" name="File" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" - authorization_updated_at="[null]"/> + <projects uuid="D" + uuid_path="NOT_USED" + project_uuid="A" + module_uuid="C" + module_uuid_path=".A.C." + long_name="[null]" + scope="FIL" + qualifier="FIL" + kee="module2:File.java" + name="File" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]" + id="4" + enabled="[false]" + root_uuid="C"/> <snapshots id="4" uuid="u4" - component_uuid="D" parent_snapshot_id="3" root_component_uuid="A" root_snapshot_id="1" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="FIL" qualifier="FIL" created_at="1228222680000" + component_uuid="D" + parent_snapshot_id="3" + root_component_uuid="A" + root_snapshot_id="1" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="FIL" + qualifier="FIL" + created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> - <file_sources id="1" project_uuid="A" file_uuid="D" binary_data="[null]" line_hashes="[null]" data_hash="321654987" - created_at="123456789" updated_at="123456789" data_type="SOURCE"/> + version="[null]" + path="[null]"/> + <file_sources id="1" + project_uuid="A" + file_uuid="D" + binary_data="[null]" + line_hashes="[null]" + data_hash="321654987" + created_at="123456789" + updated_at="123456789" + data_type="SOURCE"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldPurgeProject-result.xml b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldPurgeProject-result.xml index ecc8320e77f..23f9534eb9b 100644 --- a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldPurgeProject-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldPurgeProject-result.xml @@ -1,52 +1,127 @@ <dataset> <!-- the project --> - <projects id="1" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path="." enabled="[true]" + <projects uuid="ABCD" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path="." + enabled="[true]" created_at="[null]" - long_name="[null]" scope="PRJ" qualifier="TRK" kee="project" name="project" - root_uuid="ABCD" description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" - path="[null]" deprecated_kee="[null]" - authorization_updated_at="[null]"/> + long_name="[null]" + scope="PRJ" + qualifier="TRK" + kee="project" + name="project" + root_uuid="ABCD" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + deprecated_kee="[null]" + authorization_updated_at="[null]" + id="1"/> <!-- snapshot already purged --> <snapshots id="1" uuid="u1" - component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - status="P" islast="[false]" purge_status="1" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + status="P" + islast="[false]" + purge_status="1" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <!-- do not purge snapshot with islast=true--> <snapshots id="2" uuid="u2" - component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <!-- snapshot to be purged --> <snapshots id="3" uuid="u3" - component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - status="P" islast="[false]" purge_status="1" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + status="P" + islast="[false]" + purge_status="1" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldPurgeProject.xml b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldPurgeProject.xml index 33fed020f2e..026c46cea17 100644 --- a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldPurgeProject.xml +++ b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/shouldPurgeProject.xml @@ -1,52 +1,127 @@ <dataset> <!-- the project --> - <projects id="1" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" module_uuid_path="." enabled="[true]" + <projects uuid="ABCD" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path="." + enabled="[true]" created_at="[null]" - long_name="[null]" scope="PRJ" qualifier="TRK" kee="project" name="project" - root_uuid="ABCD" description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" - path="[null]" deprecated_kee="[null]" - authorization_updated_at="[null]"/> + long_name="[null]" + scope="PRJ" + qualifier="TRK" + kee="project" + name="project" + root_uuid="ABCD" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + path="[null]" + deprecated_kee="[null]" + authorization_updated_at="[null]" + id="1"/> <!-- snapshot already purged --> <snapshots id="1" uuid="u1" - component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - status="P" islast="[false]" purge_status="1" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + status="P" + islast="[false]" + purge_status="1" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <!-- do not purge snapshot with islast=true--> <snapshots id="2" uuid="u2" - component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <!-- snapshot to be purged --> <snapshots id="3" uuid="u3" - component_uuid="ABCD" parent_snapshot_id="[null]" root_component_uuid="ABCD" root_snapshot_id="[null]" - status="P" islast="[false]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + component_uuid="ABCD" + parent_snapshot_id="[null]" + root_component_uuid="ABCD" + root_snapshot_id="[null]" + status="P" + islast="[false]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/should_delete_all_closed_issues-result.xml b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/should_delete_all_closed_issues-result.xml index 1c06545acc2..d21eb8009ad 100644 --- a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/should_delete_all_closed_issues-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/should_delete_all_closed_issues-result.xml @@ -5,22 +5,54 @@ --> <dataset> - <projects id="1" uuid="1" enabled="[true]" root_id="[null]" created_at="[null]" - long_name="[null]" scope="PRJ" qualifier="TRK" kee="project" name="project" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" - authorization_updated_at="[null]"/> + <projects uuid="1" + uuid_path="NOT_USED" + enabled="[true]" + root_id="[null]" + created_at="[null]" + long_name="[null]" + scope="PRJ" + qualifier="TRK" + kee="project" + name="project" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]" + id="1"/> <snapshots id="1" uuid="u1" - project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" - build_date="1228222680000" version="[null]" path="[null]"/> + project_id="1" + parent_snapshot_id="[null]" + root_project_id="1" + root_snapshot_id="[null]" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <!-- old closed issues on file and project --> @@ -48,36 +80,80 @@ --> <!-- old open issues --> - <issues id="3" kee="ISSUE-3" + <issues id="3" + kee="ISSUE-3" component_uuid="1" project_uuid="1" status="OPEN" issue_close_date="[null]" - resolution="[null]" line="200" severity="BLOCKER" reporter="[null]" assignee="arthur" rule_id="500" - manual_severity="[false]" tags="[null]" - message="[null]" action_plan_key="[null]" gap="[null]" effort="[null]" - issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="[null]" issue_creation_date="1366063200000" issue_update_date="1366063200000" - created_at="1400000000000" locations="[null]" + resolution="[null]" + line="200" + severity="BLOCKER" + reporter="[null]" + assignee="arthur" + rule_id="500" + manual_severity="[false]" + tags="[null]" + message="[null]" + action_plan_key="[null]" + gap="[null]" + effort="[null]" + issue_attributes="[null]" + checksum="[null]" + author_login="[null]" + updated_at="[null]" + issue_creation_date="1366063200000" + issue_update_date="1366063200000" + created_at="1400000000000" + locations="[null]" issue_type="[null]"/> - <issue_changes id="3" kee="[null]" issue_key="ISSUE-3" created_at="[null]" updated_at="[null]" user_login="admin" - change_type="comment" change_data="abc" issue_change_creation_date="[null]"/> + <issue_changes id="3" + kee="[null]" + issue_key="ISSUE-3" + created_at="[null]" + updated_at="[null]" + user_login="admin" + change_type="comment" + change_data="abc" + issue_change_creation_date="[null]"/> <!-- recent open and closed issues --> - <issues id="4" kee="ISSUE-4" + <issues id="4" + kee="ISSUE-4" component_uuid="100" project_uuid="1" status="OPEN" issue_close_date="[null]" - resolution="[null]" line="200" severity="BLOCKER" reporter="[null]" assignee="arthur" rule_id="500" - manual_severity="[false]" tags="[null]" - message="[null]" action_plan_key="[null]" gap="[null]" effort="[null]" - issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="[null]" issue_creation_date="1366063200000" issue_update_date="1366063200000" - created_at="1400000000000" locations="[null]" + resolution="[null]" + line="200" + severity="BLOCKER" + reporter="[null]" + assignee="arthur" + rule_id="500" + manual_severity="[false]" + tags="[null]" + message="[null]" + action_plan_key="[null]" + gap="[null]" + effort="[null]" + issue_attributes="[null]" + checksum="[null]" + author_login="[null]" + updated_at="[null]" + issue_creation_date="1366063200000" + issue_update_date="1366063200000" + created_at="1400000000000" + locations="[null]" issue_type="[null]"/> - <issue_changes id="4" kee="[null]" issue_key="ISSUE-4" created_at="[null]" updated_at="[null]" user_login="admin" - change_type="comment" change_data="abc" issue_change_creation_date="[null]"/> + <issue_changes id="4" + kee="[null]" + issue_key="ISSUE-4" + created_at="[null]" + updated_at="[null]" + user_login="admin" + change_type="comment" + change_data="abc" + issue_change_creation_date="[null]"/> <!-- <issues id="5" kee="ISSUE-5" diff --git a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/should_delete_all_closed_issues.xml b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/should_delete_all_closed_issues.xml index 45d429f1f0a..59ddfb92cf8 100644 --- a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/should_delete_all_closed_issues.xml +++ b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/should_delete_all_closed_issues.xml @@ -1,100 +1,237 @@ <dataset> - <projects id="1" uuid="1" enabled="[true]" root_uuid="1" created_at="[null]" - long_name="[null]" scope="PRJ" qualifier="TRK" kee="project" name="project" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" - authorization_updated_at="[null]"/> + <projects uuid="1" + uuid_path="NOT_USED" + enabled="[true]" + root_uuid="1" + created_at="[null]" + long_name="[null]" + scope="PRJ" + qualifier="TRK" + kee="project" + name="project" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]" + id="1"/> <snapshots id="1" uuid="u1" - component_uuid="1" parent_snapshot_id="[null]" root_component_uuid="1" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" - build_date="1228222680000" version="[null]" path="[null]"/> + component_uuid="1" + parent_snapshot_id="[null]" + root_component_uuid="1" + root_snapshot_id="[null]" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <!-- old closed issues on file and project --> - <issues id="1" kee="ISSUE-1" + <issues id="1" + kee="ISSUE-1" component_uuid="100" project_uuid="1" status="CLOSED" issue_close_date="1262300400000" - resolution="FIXED" line="200" severity="BLOCKER" reporter="[null]" assignee="arthur" rule_id="500" + resolution="FIXED" + line="200" + severity="BLOCKER" + reporter="[null]" + assignee="arthur" + rule_id="500" manual_severity="[false]" - message="[null]" action_plan_key="[null]" gap="[null]" effort="[null]" - issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="[null]" issue_creation_date="1366063200000" issue_update_date="1366063200000" - created_at="1400000000000" locations="[null]" + message="[null]" + action_plan_key="[null]" + gap="[null]" + effort="[null]" + issue_attributes="[null]" + checksum="[null]" + author_login="[null]" + updated_at="[null]" + issue_creation_date="1366063200000" + issue_update_date="1366063200000" + created_at="1400000000000" + locations="[null]" issue_type="[null]"/> - <issue_changes id="1" kee="[null]" issue_key="ISSUE-1" created_at="[null]" updated_at="[null]" user_login="admin" - change_type="comment" change_data="abc" issue_change_creation_date="[null]"/> + <issue_changes id="1" + kee="[null]" + issue_key="ISSUE-1" + created_at="[null]" + updated_at="[null]" + user_login="admin" + change_type="comment" + change_data="abc" + issue_change_creation_date="[null]"/> - <issues id="2" kee="ISSUE-2" + <issues id="2" + kee="ISSUE-2" component_uuid="1" project_uuid="1" status="CLOSED" issue_close_date="1262300400000" - resolution="FIXED" line="200" severity="BLOCKER" reporter="[null]" assignee="arthur" rule_id="500" + resolution="FIXED" + line="200" + severity="BLOCKER" + reporter="[null]" + assignee="arthur" + rule_id="500" manual_severity="[false]" - message="[null]" action_plan_key="[null]" gap="[null]" effort="[null]" - issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="[null]" issue_creation_date="1366063200000" issue_update_date="1366063200000" - created_at="1400000000000" locations="[null]" + message="[null]" + action_plan_key="[null]" + gap="[null]" + effort="[null]" + issue_attributes="[null]" + checksum="[null]" + author_login="[null]" + updated_at="[null]" + issue_creation_date="1366063200000" + issue_update_date="1366063200000" + created_at="1400000000000" + locations="[null]" issue_type="[null]"/> - <issue_changes id="2" kee="[null]" issue_key="ISSUE-2" created_at="[null]" updated_at="[null]" user_login="admin" - change_type="comment" change_data="abc" issue_change_creation_date="[null]"/> + <issue_changes id="2" + kee="[null]" + issue_key="ISSUE-2" + created_at="[null]" + updated_at="[null]" + user_login="admin" + change_type="comment" + change_data="abc" + issue_change_creation_date="[null]"/> <!-- old open issues --> - <issues id="3" kee="ISSUE-3" + <issues id="3" + kee="ISSUE-3" component_uuid="1" project_uuid="1" status="OPEN" issue_close_date="[null]" - resolution="[null]" line="200" severity="BLOCKER" reporter="[null]" assignee="arthur" rule_id="500" + resolution="[null]" + line="200" + severity="BLOCKER" + reporter="[null]" + assignee="arthur" + rule_id="500" manual_severity="[false]" - message="[null]" action_plan_key="[null]" gap="[null]" effort="[null]" - issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="[null]" issue_creation_date="1366063200000" issue_update_date="1366063200000" - created_at="1400000000000" locations="[null]" + message="[null]" + action_plan_key="[null]" + gap="[null]" + effort="[null]" + issue_attributes="[null]" + checksum="[null]" + author_login="[null]" + updated_at="[null]" + issue_creation_date="1366063200000" + issue_update_date="1366063200000" + created_at="1400000000000" + locations="[null]" issue_type="[null]"/> - <issue_changes id="3" kee="[null]" issue_key="ISSUE-3" created_at="[null]" updated_at="[null]" user_login="admin" - change_type="comment" change_data="abc" issue_change_creation_date="[null]"/> + <issue_changes id="3" + kee="[null]" + issue_key="ISSUE-3" + created_at="[null]" + updated_at="[null]" + user_login="admin" + change_type="comment" + change_data="abc" + issue_change_creation_date="[null]"/> <!-- recent open and closed issues --> - <issues id="4" kee="ISSUE-4" + <issues id="4" + kee="ISSUE-4" component_uuid="100" project_uuid="1" status="OPEN" issue_close_date="[null]" - resolution="[null]" line="200" severity="BLOCKER" reporter="[null]" assignee="arthur" rule_id="500" + resolution="[null]" + line="200" + severity="BLOCKER" + reporter="[null]" + assignee="arthur" + rule_id="500" manual_severity="[false]" - message="[null]" action_plan_key="[null]" gap="[null]" effort="[null]" - issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="[null]" issue_creation_date="1366063200000" issue_update_date="1366063200000" - created_at="1400000000000" locations="[null]" + message="[null]" + action_plan_key="[null]" + gap="[null]" + effort="[null]" + issue_attributes="[null]" + checksum="[null]" + author_login="[null]" + updated_at="[null]" + issue_creation_date="1366063200000" + issue_update_date="1366063200000" + created_at="1400000000000" + locations="[null]" issue_type="[null]"/> - <issue_changes id="4" kee="[null]" issue_key="ISSUE-4" created_at="[null]" updated_at="[null]" user_login="admin" - change_type="comment" change_data="abc" issue_change_creation_date="[null]"/> + <issue_changes id="4" + kee="[null]" + issue_key="ISSUE-4" + created_at="[null]" + updated_at="[null]" + user_login="admin" + change_type="comment" + change_data="abc" + issue_change_creation_date="[null]"/> - <issues id="5" kee="ISSUE-5" + <issues id="5" + kee="ISSUE-5" component_uuid="100" project_uuid="1" status="CLOSED" issue_close_date="1735686000000" - resolution="FIXED" line="200" severity="BLOCKER" reporter="[null]" assignee="arthur" rule_id="500" + resolution="FIXED" + line="200" + severity="BLOCKER" + reporter="[null]" + assignee="arthur" + rule_id="500" manual_severity="[false]" - message="[null]" action_plan_key="[null]" gap="[null]" effort="[null]" - issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="[null]" issue_creation_date="1366063200000" issue_update_date="1366063200000" - created_at="1400000000000" locations="[null]" + message="[null]" + action_plan_key="[null]" + gap="[null]" + effort="[null]" + issue_attributes="[null]" + checksum="[null]" + author_login="[null]" + updated_at="[null]" + issue_creation_date="1366063200000" + issue_update_date="1366063200000" + created_at="1400000000000" + locations="[null]" issue_type="[null]"/> - <issue_changes id="5" kee="[null]" issue_key="ISSUE-5" created_at="[null]" updated_at="[null]" user_login="admin" - change_type="comment" change_data="abc" issue_change_creation_date="[null]"/> + <issue_changes id="5" + kee="[null]" + issue_key="ISSUE-5" + created_at="[null]" + updated_at="[null]" + user_login="admin" + change_type="comment" + change_data="abc" + issue_change_creation_date="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/should_delete_old_closed_issues-result.xml b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/should_delete_old_closed_issues-result.xml index 75b4fb53a74..e627d4b0ce3 100644 --- a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/should_delete_old_closed_issues-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/should_delete_old_closed_issues-result.xml @@ -1,21 +1,53 @@ <dataset> - <projects id="1" uuid="P1" enabled="[true]" root_id="[null]" created_at="[null]" - long_name="[null]" scope="PRJ" qualifier="TRK" kee="project" name="project" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" - authorization_updated_at="[null]"/> + <projects uuid="P1" + uuid_path="NOT_USED" + enabled="[true]" + root_id="[null]" + created_at="[null]" + long_name="[null]" + scope="PRJ" + qualifier="TRK" + kee="project" + name="project" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]" + id="1"/> <snapshots id="1" uuid="u1" - project_id="1" parent_snapshot_id="[null]" root_project_id="1" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" build_date="1228222680000" - version="[null]" path="[null]"/> + project_id="1" + parent_snapshot_id="[null]" + root_project_id="1" + root_snapshot_id="[null]" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <!-- old closed issues on file and project -> to be purged --> <!-- @@ -41,50 +73,116 @@ --> <!-- old open issues -> do not purge --> - <issues id="3" kee="ISSUE-3" + <issues id="3" + kee="ISSUE-3" component_uuid="1" project_uuid="P1" status="OPEN" issue_close_date="[null]" - resolution="[null]" line="200" severity="BLOCKER" reporter="[null]" assignee="arthur" rule_id="500" - manual_severity="[false]" tags="[null]" - message="[null]" action_plan_key="[null]" gap="[null]" effort="[null]" - issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="[null]" issue_creation_date="1366063200000" issue_update_date="1366063200000" - created_at="1400000000000" locations="[null]" + resolution="[null]" + line="200" + severity="BLOCKER" + reporter="[null]" + assignee="arthur" + rule_id="500" + manual_severity="[false]" + tags="[null]" + message="[null]" + action_plan_key="[null]" + gap="[null]" + effort="[null]" + issue_attributes="[null]" + checksum="[null]" + author_login="[null]" + updated_at="[null]" + issue_creation_date="1366063200000" + issue_update_date="1366063200000" + created_at="1400000000000" + locations="[null]" issue_type="[null]"/> - <issue_changes id="3" kee="[null]" issue_key="ISSUE-3" created_at="[null]" updated_at="[null]" user_login="admin" - change_type="comment" change_data="abc" issue_change_creation_date="[null]"/> + <issue_changes id="3" + kee="[null]" + issue_key="ISSUE-3" + created_at="[null]" + updated_at="[null]" + user_login="admin" + change_type="comment" + change_data="abc" + issue_change_creation_date="[null]"/> <!-- recent open and closed issues -> do not purge --> - <issues id="4" kee="ISSUE-4" + <issues id="4" + kee="ISSUE-4" component_uuid="100" project_uuid="P1" status="OPEN" issue_close_date="[null]" - resolution="[null]" line="200" severity="BLOCKER" reporter="[null]" assignee="arthur" rule_id="500" - manual_severity="[false]" tags="[null]" - message="[null]" action_plan_key="[null]" gap="[null]" effort="[null]" - issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="[null]" issue_creation_date="1366063200000" issue_update_date="1366063200000" - created_at="1400000000000" locations="[null]" + resolution="[null]" + line="200" + severity="BLOCKER" + reporter="[null]" + assignee="arthur" + rule_id="500" + manual_severity="[false]" + tags="[null]" + message="[null]" + action_plan_key="[null]" + gap="[null]" + effort="[null]" + issue_attributes="[null]" + checksum="[null]" + author_login="[null]" + updated_at="[null]" + issue_creation_date="1366063200000" + issue_update_date="1366063200000" + created_at="1400000000000" + locations="[null]" issue_type="[null]"/> - <issue_changes id="4" kee="[null]" issue_key="ISSUE-4" created_at="[null]" updated_at="[null]" user_login="admin" - change_type="comment" change_data="abc" issue_change_creation_date="[null]"/> + <issue_changes id="4" + kee="[null]" + issue_key="ISSUE-4" + created_at="[null]" + updated_at="[null]" + user_login="admin" + change_type="comment" + change_data="abc" + issue_change_creation_date="[null]"/> - <issues id="5" kee="ISSUE-5" + <issues id="5" + kee="ISSUE-5" component_uuid="100" project_uuid="P1" status="CLOSED" issue_close_date="1735686000000" - resolution="FIXED" line="200" severity="BLOCKER" reporter="[null]" assignee="arthur" rule_id="500" - manual_severity="[false]" tags="[null]" - message="[null]" action_plan_key="[null]" gap="[null]" effort="[null]" - issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="[null]" issue_creation_date="1366063200000" issue_update_date="1366063200000" - created_at="1400000000000" locations="[null]" + resolution="FIXED" + line="200" + severity="BLOCKER" + reporter="[null]" + assignee="arthur" + rule_id="500" + manual_severity="[false]" + tags="[null]" + message="[null]" + action_plan_key="[null]" + gap="[null]" + effort="[null]" + issue_attributes="[null]" + checksum="[null]" + author_login="[null]" + updated_at="[null]" + issue_creation_date="1366063200000" + issue_update_date="1366063200000" + created_at="1400000000000" + locations="[null]" issue_type="[null]"/> - <issue_changes id="5" kee="[null]" issue_key="ISSUE-5" created_at="[null]" updated_at="[null]" user_login="admin" - change_type="comment" change_data="abc" issue_change_creation_date="[null]"/> + <issue_changes id="5" + kee="[null]" + issue_key="ISSUE-5" + created_at="[null]" + updated_at="[null]" + user_login="admin" + change_type="comment" + change_data="abc" + issue_change_creation_date="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/should_delete_old_closed_issues.xml b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/should_delete_old_closed_issues.xml index 5227b4ca866..4d7888f2bc9 100644 --- a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/should_delete_old_closed_issues.xml +++ b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/should_delete_old_closed_issues.xml @@ -1,98 +1,235 @@ <dataset> - <projects id="1" uuid="P1" enabled="[true]" root_uuid="P1" created_at="[null]" - long_name="[null]" scope="PRJ" qualifier="TRK" kee="project" name="project" - description="[null]" language="java" copy_component_uuid="[null]" developer_uuid="[null]" - authorization_updated_at="[null]"/> + <projects uuid="P1" + uuid_path="NOT_USED" + enabled="[true]" + root_uuid="P1" + created_at="[null]" + long_name="[null]" + scope="PRJ" + qualifier="TRK" + kee="project" + name="project" + description="[null]" + language="java" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]" + id="1"/> <snapshots id="1" uuid="u1" - component_uuid="P1" parent_snapshot_id="[null]" root_component_uuid="P1" root_snapshot_id="[null]" - status="P" islast="[true]" purge_status="[null]" - period1_mode="[null]" period1_param="[null]" period1_date="[null]" - period2_mode="[null]" period2_param="[null]" period2_date="[null]" - period3_mode="[null]" period3_param="[null]" period3_date="[null]" - period4_mode="[null]" period4_param="[null]" period4_date="[null]" - period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="1228222680000" - build_date="1228222680000" version="[null]" path="[null]"/> + component_uuid="P1" + parent_snapshot_id="[null]" + root_component_uuid="P1" + root_snapshot_id="[null]" + status="P" + islast="[true]" + purge_status="[null]" + period1_mode="[null]" + period1_param="[null]" + period1_date="[null]" + period2_mode="[null]" + period2_param="[null]" + period2_date="[null]" + period3_mode="[null]" + period3_param="[null]" + period3_date="[null]" + period4_mode="[null]" + period4_param="[null]" + period4_date="[null]" + period5_mode="[null]" + period5_param="[null]" + period5_date="[null]" + depth="[null]" + scope="PRJ" + qualifier="TRK" + created_at="1228222680000" + build_date="1228222680000" + version="[null]" + path="[null]"/> <!-- old closed issues on file and project -> to be purged --> - <issues id="1" kee="ISSUE-1" + <issues id="1" + kee="ISSUE-1" component_uuid="100" project_uuid="P1" status="CLOSED" issue_close_date="1262300400000" - resolution="FIXED" line="200" severity="BLOCKER" reporter="[null]" assignee="arthur" rule_id="500" + resolution="FIXED" + line="200" + severity="BLOCKER" + reporter="[null]" + assignee="arthur" + rule_id="500" manual_severity="[false]" - message="[null]" action_plan_key="[null]" gap="[null]" effort="[null]" - issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="[null]" issue_creation_date="1366063200000" issue_update_date="1366063200000" - created_at="1400000000000" locations="[null]" + message="[null]" + action_plan_key="[null]" + gap="[null]" + effort="[null]" + issue_attributes="[null]" + checksum="[null]" + author_login="[null]" + updated_at="[null]" + issue_creation_date="1366063200000" + issue_update_date="1366063200000" + created_at="1400000000000" + locations="[null]" issue_type="[null]"/> - <issue_changes id="1" kee="[null]" issue_key="ISSUE-1" created_at="[null]" updated_at="[null]" user_login="admin" - change_type="comment" change_data="abc" issue_change_creation_date="[null]"/> + <issue_changes id="1" + kee="[null]" + issue_key="ISSUE-1" + created_at="[null]" + updated_at="[null]" + user_login="admin" + change_type="comment" + change_data="abc" + issue_change_creation_date="[null]"/> - <issues id="2" kee="ISSUE-2" + <issues id="2" + kee="ISSUE-2" component_uuid="1" project_uuid="P1" status="CLOSED" issue_close_date="1262300400000" - resolution="FIXED" line="200" severity="BLOCKER" reporter="[null]" assignee="arthur" rule_id="500" + resolution="FIXED" + line="200" + severity="BLOCKER" + reporter="[null]" + assignee="arthur" + rule_id="500" manual_severity="[false]" - message="[null]" action_plan_key="[null]" gap="[null]" effort="[null]" - issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="[null]" issue_creation_date="1366063200000" issue_update_date="1366063200000" - created_at="1400000000000" locations="[null]"/> - <issue_changes id="2" kee="[null]" issue_key="ISSUE-2" created_at="[null]" updated_at="[null]" user_login="admin" - change_type="comment" change_data="abc" issue_change_creation_date="[null]"/> + message="[null]" + action_plan_key="[null]" + gap="[null]" + effort="[null]" + issue_attributes="[null]" + checksum="[null]" + author_login="[null]" + updated_at="[null]" + issue_creation_date="1366063200000" + issue_update_date="1366063200000" + created_at="1400000000000" + locations="[null]"/> + <issue_changes id="2" + kee="[null]" + issue_key="ISSUE-2" + created_at="[null]" + updated_at="[null]" + user_login="admin" + change_type="comment" + change_data="abc" + issue_change_creation_date="[null]"/> <!-- old open issues -> do not purge --> - <issues id="3" kee="ISSUE-3" + <issues id="3" + kee="ISSUE-3" component_uuid="1" project_uuid="P1" status="OPEN" issue_close_date="[null]" - resolution="[null]" line="200" severity="BLOCKER" reporter="[null]" assignee="arthur" rule_id="500" + resolution="[null]" + line="200" + severity="BLOCKER" + reporter="[null]" + assignee="arthur" + rule_id="500" manual_severity="[false]" - message="[null]" action_plan_key="[null]" gap="[null]" effort="[null]" - issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="[null]" issue_creation_date="1366063200000" issue_update_date="1366063200000" - created_at="1400000000000" locations="[null]" + message="[null]" + action_plan_key="[null]" + gap="[null]" + effort="[null]" + issue_attributes="[null]" + checksum="[null]" + author_login="[null]" + updated_at="[null]" + issue_creation_date="1366063200000" + issue_update_date="1366063200000" + created_at="1400000000000" + locations="[null]" issue_type="[null]"/> - <issue_changes id="3" kee="[null]" issue_key="ISSUE-3" created_at="[null]" updated_at="[null]" user_login="admin" - change_type="comment" change_data="abc" issue_change_creation_date="[null]"/> + <issue_changes id="3" + kee="[null]" + issue_key="ISSUE-3" + created_at="[null]" + updated_at="[null]" + user_login="admin" + change_type="comment" + change_data="abc" + issue_change_creation_date="[null]"/> <!-- recent open and closed issues -> do not purge --> - <issues id="4" kee="ISSUE-4" + <issues id="4" + kee="ISSUE-4" component_uuid="100" project_uuid="P1" status="OPEN" issue_close_date="[null]" - resolution="[null]" line="200" severity="BLOCKER" reporter="[null]" assignee="arthur" rule_id="500" + resolution="[null]" + line="200" + severity="BLOCKER" + reporter="[null]" + assignee="arthur" + rule_id="500" manual_severity="[false]" - message="[null]" action_plan_key="[null]" gap="[null]" effort="[null]" - issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="[null]" issue_creation_date="1366063200000" issue_update_date="1366063200000" - created_at="1400000000000" locations="[null]" + message="[null]" + action_plan_key="[null]" + gap="[null]" + effort="[null]" + issue_attributes="[null]" + checksum="[null]" + author_login="[null]" + updated_at="[null]" + issue_creation_date="1366063200000" + issue_update_date="1366063200000" + created_at="1400000000000" + locations="[null]" issue_type="[null]"/> - <issue_changes id="4" kee="[null]" issue_key="ISSUE-4" created_at="[null]" updated_at="[null]" user_login="admin" - change_type="comment" change_data="abc" issue_change_creation_date="[null]"/> + <issue_changes id="4" + kee="[null]" + issue_key="ISSUE-4" + created_at="[null]" + updated_at="[null]" + user_login="admin" + change_type="comment" + change_data="abc" + issue_change_creation_date="[null]"/> - <issues id="5" kee="ISSUE-5" + <issues id="5" + kee="ISSUE-5" component_uuid="100" project_uuid="P1" status="CLOSED" issue_close_date="1735686000000" - resolution="FIXED" line="200" severity="BLOCKER" reporter="[null]" assignee="arthur" rule_id="500" + resolution="FIXED" + line="200" + severity="BLOCKER" + reporter="[null]" + assignee="arthur" + rule_id="500" manual_severity="[false]" - message="[null]" action_plan_key="[null]" gap="[null]" effort="[null]" - issue_attributes="[null]" checksum="[null]" author_login="[null]" - updated_at="[null]" issue_creation_date="1366063200000" issue_update_date="1366063200000" - created_at="1400000000000" locations="[null]" + message="[null]" + action_plan_key="[null]" + gap="[null]" + effort="[null]" + issue_attributes="[null]" + checksum="[null]" + author_login="[null]" + updated_at="[null]" + issue_creation_date="1366063200000" + issue_update_date="1366063200000" + created_at="1400000000000" + locations="[null]" issue_type="[null]"/> - <issue_changes id="5" kee="[null]" issue_key="ISSUE-5" created_at="[null]" updated_at="[null]" user_login="admin" - change_type="comment" change_data="abc" issue_change_creation_date="[null]"/> + <issue_changes id="5" + kee="[null]" + issue_key="ISSUE-5" + created_at="[null]" + updated_at="[null]" + user_login="admin" + change_type="comment" + change_data="abc" + issue_change_creation_date="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/view_sub_view_and_tech_project.xml b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/view_sub_view_and_tech_project.xml index db564d7da73..f8e18562a17 100644 --- a/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/view_sub_view_and_tech_project.xml +++ b/sonar-db/src/test/resources/org/sonar/db/purge/PurgeDaoTest/view_sub_view_and_tech_project.xml @@ -1,30 +1,82 @@ <dataset> <!-- view --> - <projects id="1" enabled="[true]" root_uuid="A" - uuid="A" project_uuid="A" module_uuid="[null]" module_uuid_path=".A." - long_name="[null]" scope="PRJ" qualifier="VW" kee="view" name="view" - description="[null]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" - authorization_updated_at="[null]"/> + <projects uuid="A" + uuid_path="NOT_USED" + project_uuid="A" + module_uuid="[null]" + module_uuid_path=".A." + long_name="[null]" + scope="PRJ" + qualifier="VW" + kee="view" + name="view" + description="[null]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]" + id="1" + enabled="[true]" + root_uuid="A"/> <!-- sub views --> - <projects id="2" enabled="[true]" root_uuid="A" - uuid="B" project_uuid="A" module_uuid="A" module_uuid_path=".A.B." - long_name="[null]" scope="PRJ" qualifier="SVW" kee="subview1" name="subview2" - description="[null]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" - authorization_updated_at="[null]"/> + <projects uuid="B" + uuid_path="NOT_USED" + project_uuid="A" + module_uuid="A" + module_uuid_path=".A.B." + long_name="[null]" + scope="PRJ" + qualifier="SVW" + kee="subview1" + name="subview2" + description="[null]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]" + id="2" + enabled="[true]" + root_uuid="A"/> - <projects id="3" enabled="[false]" root_uuid="A" - uuid="C" project_uuid="A" module_uuid="A" module_uuid_path=".A.C." - long_name="[null]" scope="PRJ" qualifier="SVW" kee="subview2" name="subview2" - description="[null]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" - authorization_updated_at="[null]"/> + <projects uuid="C" + uuid_path="NOT_USED" + project_uuid="A" + module_uuid="A" + module_uuid_path=".A.C." + long_name="[null]" + scope="PRJ" + qualifier="SVW" + kee="subview2" + name="subview2" + description="[null]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]" + id="3" + enabled="[false]" + root_uuid="A"/> <!-- technical project of module 2--> - <projects id="4" enabled="[false]" root_uuid="C" - uuid="D" project_uuid="A" module_uuid="C" module_uuid_path=".A.C." - long_name="[null]" scope="FIL" qualifier="TRK" kee="TechProject" name="TechProject" - description="[null]" language="[null]" copy_component_uuid="[null]" developer_uuid="[null]" - authorization_updated_at="[null]"/> + <projects uuid="D" + uuid_path="NOT_USED" + project_uuid="A" + module_uuid="C" + module_uuid_path=".A.C." + long_name="[null]" + scope="FIL" + qualifier="TRK" + kee="TechProject" + name="TechProject" + description="[null]" + language="[null]" + copy_component_uuid="[null]" + developer_uuid="[null]" + authorization_updated_at="[null]" + id="4" + enabled="[false]" + root_uuid="C"/> </dataset> 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 8f719037338..e37eb2643ea 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 @@ -1,46 +1,202 @@ <dataset> - <quality_gates id="42" name="Golden"/> - <quality_gates id="43" name="Ninth"/> + <quality_gates id="42" + name="Golden"/> + <quality_gates id="43" + name="Ninth"/> - <projects id="1" uuid="A" root_uuid="A" kee="project-one" name="Project One" qualifier="TRK" scope="PRJ"/> - <projects id="2" uuid="B" root_uuid="B" kee="project-two" name="Project Two" qualifier="TRK" scope="PRJ"/> - <projects id="3" uuid="C" root_uuid="C" kee="project-three" name="Project Three" qualifier="TRK" scope="PRJ"/> - <projects id="4" uuid="D" root_uuid="D" kee="project-four" name="Project Four" qualifier="TRK" scope="PRJ"/> - <projects id="5" uuid="E" root_uuid="E" kee="project-five" name="Project Five" qualifier="TRK" scope="PRJ"/> - <projects id="6" uuid="F" root_uuid="F" kee="view-six" name="View Six" qualifier="VW" scope="PRJ"/> - <projects id="7" uuid="G" root_uuid="G" kee="file-one" name="File One" qualifier="TRK" scope="FIL"/> + <projects uuid="A" + uuid_path="NOT_USED" + root_uuid="A" + kee="project-one" + name="Project One" + qualifier="TRK" + scope="PRJ" + id="1"/> + <projects uuid="B" + uuid_path="NOT_USED" + root_uuid="B" + kee="project-two" + name="Project Two" + qualifier="TRK" + scope="PRJ" + id="2"/> + <projects uuid="C" + uuid_path="NOT_USED" + root_uuid="C" + kee="project-three" + name="Project Three" + qualifier="TRK" + scope="PRJ" + id="3"/> + <projects uuid="D" + uuid_path="NOT_USED" + root_uuid="D" + kee="project-four" + name="Project Four" + qualifier="TRK" + scope="PRJ" + id="4"/> + <projects uuid="E" + uuid_path="NOT_USED" + root_uuid="E" + kee="project-five" + name="Project Five" + qualifier="TRK" + scope="PRJ" + id="5"/> + <projects uuid="F" + uuid_path="NOT_USED" + root_uuid="F" + kee="view-six" + name="View Six" + qualifier="VW" + scope="PRJ" + id="6"/> + <projects uuid="G" + uuid_path="NOT_USED" + root_uuid="G" + kee="file-one" + name="File One" + qualifier="TRK" + scope="FIL" + id="7"/> - <resource_index id="1" kee="project one" component_uuid="A" root_component_uuid="A" position="0" name_size="11" + <resource_index id="1" + kee="project one" + component_uuid="A" + root_component_uuid="A" + position="0" + name_size="11" qualifier="TRK"/> - <resource_index id="2" kee="roject one" component_uuid="A" root_component_uuid="A" position="1" name_size="11" + <resource_index id="2" + kee="roject one" + component_uuid="A" + root_component_uuid="A" + position="1" + name_size="11" qualifier="TRK"/> - <resource_index id="3" kee="oject one" component_uuid="A" root_component_uuid="A" position="2" name_size="11" + <resource_index id="3" + kee="oject one" + component_uuid="A" + root_component_uuid="A" + position="2" + name_size="11" qualifier="TRK"/> - <resource_index id="4" kee="ject one" component_uuid="A" root_component_uuid="A" position="3" name_size="11" + <resource_index id="4" + kee="ject one" + component_uuid="A" + root_component_uuid="A" + position="3" + name_size="11" qualifier="TRK"/> - <resource_index id="5" kee="ect one" component_uuid="A" root_component_uuid="A" position="4" name_size="11" qualifier="TRK"/> - <resource_index id="6" kee="ct one" component_uuid="A" root_component_uuid="A" position="5" name_size="11" qualifier="TRK"/> - <resource_index id="7" kee="t one" component_uuid="A" root_component_uuid="A" position="6" name_size="11" qualifier="TRK"/> - <resource_index id="8" kee=" one" component_uuid="A" root_component_uuid="A" position="7" name_size="11" qualifier="TRK"/> - <resource_index id="9" kee="one" component_uuid="A" root_component_uuid="A" position="8" name_size="11" qualifier="TRK"/> - <resource_index id="10" kee="project two" component_uuid="B" root_component_uuid="B" position="0" name_size="11" + <resource_index id="5" + kee="ect one" + component_uuid="A" + root_component_uuid="A" + position="4" + name_size="11" qualifier="TRK"/> - <resource_index id="11" kee="roject two" component_uuid="B" root_component_uuid="B" position="1" name_size="11" + <resource_index id="6" + kee="ct one" + component_uuid="A" + root_component_uuid="A" + position="5" + name_size="11" qualifier="TRK"/> - <resource_index id="12" kee="oject two" component_uuid="B" root_component_uuid="B" position="2" name_size="11" + <resource_index id="7" + kee="t one" + component_uuid="A" + root_component_uuid="A" + position="6" + name_size="11" qualifier="TRK"/> - <resource_index id="13" kee="ject two" component_uuid="B" root_component_uuid="B" position="3" name_size="11" + <resource_index id="8" + kee=" one" + component_uuid="A" + root_component_uuid="A" + position="7" + name_size="11" qualifier="TRK"/> - <resource_index id="14" kee="ect two" component_uuid="B" root_component_uuid="B" position="4" name_size="11" + <resource_index id="9" + kee="one" + component_uuid="A" + root_component_uuid="A" + position="8" + name_size="11" + qualifier="TRK"/> + <resource_index id="10" + kee="project two" + component_uuid="B" + root_component_uuid="B" + position="0" + name_size="11" + qualifier="TRK"/> + <resource_index id="11" + kee="roject two" + component_uuid="B" + root_component_uuid="B" + position="1" + name_size="11" + qualifier="TRK"/> + <resource_index id="12" + kee="oject two" + component_uuid="B" + root_component_uuid="B" + position="2" + name_size="11" + qualifier="TRK"/> + <resource_index id="13" + kee="ject two" + component_uuid="B" + root_component_uuid="B" + position="3" + name_size="11" + qualifier="TRK"/> + <resource_index id="14" + kee="ect two" + component_uuid="B" + root_component_uuid="B" + position="4" + name_size="11" + qualifier="TRK"/> + <resource_index id="15" + kee="ct two" + component_uuid="B" + root_component_uuid="B" + position="5" + name_size="11" + qualifier="TRK"/> + <resource_index id="16" + kee="t two" + component_uuid="B" + root_component_uuid="B" + position="6" + name_size="11" + qualifier="TRK"/> + <resource_index id="17" + kee=" two" + component_uuid="B" + root_component_uuid="B" + position="7" + name_size="11" qualifier="TRK"/> - <resource_index id="15" kee="ct two" component_uuid="B" root_component_uuid="B" position="5" name_size="11" qualifier="TRK"/> - <resource_index id="16" kee="t two" component_uuid="B" root_component_uuid="B" position="6" name_size="11" qualifier="TRK"/> - <resource_index id="17" kee=" two" component_uuid="B" root_component_uuid="B" position="7" name_size="11" qualifier="TRK"/> - <properties id="1" prop_key="sonar.qualitygate" resource_id="[null]" text_value="43"/> - <properties id="2" prop_key="sonar.qualitygate" resource_id="1" text_value="42"/> - <properties id="3" prop_key="sonar.qualitygate" resource_id="2" text_value="42"/> - <properties id="4" prop_key="sonar.qualitygate" resource_id="3" text_value="42"/> + <properties id="1" + prop_key="sonar.qualitygate" + resource_id="[null]" + text_value="43"/> + <properties id="2" + prop_key="sonar.qualitygate" + resource_id="1" + text_value="42"/> + <properties id="3" + prop_key="sonar.qualitygate" + resource_id="2" + text_value="42"/> + <properties id="4" + prop_key="sonar.qualitygate" + resource_id="3" + text_value="42"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/qualityprofile/QualityProfileDaoTest/projects.xml b/sonar-db/src/test/resources/org/sonar/db/qualityprofile/QualityProfileDaoTest/projects.xml index 32f6c7c7262..bb3f480b114 100644 --- a/sonar-db/src/test/resources/org/sonar/db/qualityprofile/QualityProfileDaoTest/projects.xml +++ b/sonar-db/src/test/resources/org/sonar/db/qualityprofile/QualityProfileDaoTest/projects.xml @@ -1,18 +1,60 @@ <dataset> - <rules_profiles id="1" name="Sonar Way" language="java" parent_kee="[null]" kee="java_sonar_way" is_default="[true]" - rules_updated_at="[null]" created_at="[null]" updated_at="[null]"/> - <rules_profiles id="2" name="Sonar Way" language="js" parent_kee="[null]" kee="js_sonar_way" is_default="[true]" - rules_updated_at="[null]" created_at="[null]" updated_at="[null]"/> + <rules_profiles id="1" + name="Sonar Way" + language="java" + parent_kee="[null]" + kee="java_sonar_way" + is_default="[true]" + rules_updated_at="[null]" + created_at="[null]" + updated_at="[null]"/> + <rules_profiles id="2" + name="Sonar Way" + language="js" + parent_kee="[null]" + kee="js_sonar_way" + is_default="[true]" + rules_updated_at="[null]" + created_at="[null]" + updated_at="[null]"/> - <projects id="1" uuid="A" root_uuid="A" kee="org.codehaus.sonar:sonar" name="SonarQube" enabled="[true]"/> - <projects id="2" uuid="B" root_uuid="B" kee="org.codehaus.sonar-plugins.java:java" name="SonarQube Java" enabled="[true]"/> - <projects id="3" uuid="C" root_uuid="C" kee="disabled:project" name="Disabled Project" enabled="[false]"/> + <projects uuid="A" + uuid_path="NOT_USED" + root_uuid="A" + kee="org.codehaus.sonar:sonar" + name="SonarQube" + enabled="[true]" + id="1"/> + <projects uuid="B" + uuid_path="NOT_USED" + root_uuid="B" + kee="org.codehaus.sonar-plugins.java:java" + name="SonarQube Java" + enabled="[true]" + id="2"/> + <projects uuid="C" + uuid_path="NOT_USED" + root_uuid="C" + kee="disabled:project" + name="Disabled Project" + enabled="[false]" + id="3"/> - <project_qprofiles id="1" project_uuid="A" profile_key="java_sonar_way"/> - <project_qprofiles id="2" project_uuid="B" profile_key="java_sonar_way"/> - <project_qprofiles id="3" project_uuid="A" profile_key="js_sonar_way"/> - <project_qprofiles id="4" project_uuid="B" profile_key="js_sonar_way"/> - <project_qprofiles id="5" project_uuid="C" profile_key="js_sonar_way"/> + <project_qprofiles id="1" + project_uuid="A" + profile_key="java_sonar_way"/> + <project_qprofiles id="2" + project_uuid="B" + profile_key="java_sonar_way"/> + <project_qprofiles id="3" + project_uuid="A" + profile_key="js_sonar_way"/> + <project_qprofiles id="4" + project_uuid="B" + profile_key="js_sonar_way"/> + <project_qprofiles id="5" + project_uuid="C" + profile_key="js_sonar_way"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/user/AuthorDaoTest/add_missing_module_uuid_path-result.xml b/sonar-db/src/test/resources/org/sonar/db/user/AuthorDaoTest/add_missing_module_uuid_path-result.xml index 72100ecc2a0..b1b6b6bd732 100644 --- a/sonar-db/src/test/resources/org/sonar/db/user/AuthorDaoTest/add_missing_module_uuid_path-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/user/AuthorDaoTest/add_missing_module_uuid_path-result.xml @@ -1,9 +1,27 @@ <dataset> - <projects id="1" kee="developer" name="developer@company.net" qualifier="DEV" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" - module_uuid_path=".ABCD."/> - <authors id="1" person_id="1" login="developer@company.net"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path=".ABCD." + id="1" + kee="developer" + name="developer@company.net" + qualifier="DEV"/> + <authors id="1" + person_id="1" + login="developer@company.net"/> - <projects id="2" kee="developer2" name="developer2@company.net" qualifier="DEV" uuid="BCDE" project_uuid="BCDE" module_uuid="[null]" - module_uuid_path=".BCDE."/> - <authors id="2" person_id="2" login="developer2@company.net"/> + <projects uuid="BCDE" + uuid_path="NOT_USED" + project_uuid="BCDE" + module_uuid="[null]" + module_uuid_path=".BCDE." + id="2" + kee="developer2" + name="developer2@company.net" + qualifier="DEV"/> + <authors id="2" + person_id="2" + login="developer2@company.net"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldInsertAuthorAndDeveloper-result.xml b/sonar-db/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldInsertAuthorAndDeveloper-result.xml index 894ab330a68..eb04812dc86 100644 --- a/sonar-db/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldInsertAuthorAndDeveloper-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldInsertAuthorAndDeveloper-result.xml @@ -1,5 +1,14 @@ <dataset> - <projects id="1" kee="developer" name="developer@company.net" qualifier="DEV" uuid="ABCD" project_uuid="ABCD" module_uuid="[null]" - module_uuid_path="."/> - <authors id="1" person_id="1" login="developer@company.net"/> + <projects uuid="ABCD" + uuid_path="NOT_USED" + project_uuid="ABCD" + module_uuid="[null]" + module_uuid_path="." + id="1" + kee="developer" + name="developer@company.net" + qualifier="DEV"/> + <authors id="1" + person_id="1" + login="developer@company.net"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsAndDevelopersDuplication-result.xml b/sonar-db/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsAndDevelopersDuplication-result.xml index d82ea489b98..95145a4be37 100644 --- a/sonar-db/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsAndDevelopersDuplication-result.xml +++ b/sonar-db/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsAndDevelopersDuplication-result.xml @@ -1,8 +1,17 @@ <dataset> - <projects id="1" kee="developer" name="developer@company.net" qualifier="DEV" uuid="[null]" project_uuid="[null]" module_uuid="[null]" - module_uuid_path="."/> + <projects uuid="[null]" + uuid_path="NOT_USED" + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path="." + id="1" + kee="developer" + name="developer@company.net" + qualifier="DEV"/> - <authors id="1" person_id="1" login="developer@company.net"/> + <authors id="1" + person_id="1" + login="developer@company.net"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsAndDevelopersDuplication.xml b/sonar-db/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsAndDevelopersDuplication.xml index d82ea489b98..95145a4be37 100644 --- a/sonar-db/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsAndDevelopersDuplication.xml +++ b/sonar-db/src/test/resources/org/sonar/db/user/AuthorDaoTest/shouldPreventAuthorsAndDevelopersDuplication.xml @@ -1,8 +1,17 @@ <dataset> - <projects id="1" kee="developer" name="developer@company.net" qualifier="DEV" uuid="[null]" project_uuid="[null]" module_uuid="[null]" - module_uuid_path="."/> + <projects uuid="[null]" + uuid_path="NOT_USED" + project_uuid="[null]" + module_uuid="[null]" + module_uuid_path="." + id="1" + kee="developer" + name="developer@company.net" + qualifier="DEV"/> - <authors id="1" person_id="1" login="developer@company.net"/> + <authors id="1" + person_id="1" + login="developer@company.net"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/anonymous_should_be_authorized.xml b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/anonymous_should_be_authorized.xml index 47b03de71a5..edee0fdd08c 100644 --- a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/anonymous_should_be_authorized.xml +++ b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/anonymous_should_be_authorized.xml @@ -1,14 +1,49 @@ <dataset> - <user_roles id="1" user_id="100" resource_id="999" role="user"/> - <groups_users user_id="100" group_id="200"/> - <group_roles id="1" group_id="[null]" resource_id="300" role="user"/> - <group_roles id="2" group_id="[null]" resource_id="400" role="user"/> + <user_roles id="1" + user_id="100" + resource_id="999" + role="user"/> + <groups_users user_id="100" + group_id="200"/> + <group_roles id="1" + group_id="[null]" + resource_id="300" + role="user"/> + <group_roles id="2" + group_id="[null]" + resource_id="400" + role="user"/> - <projects id="301" kee="pj-w-snapshot:package" root_uuid="EDFG" uuid="ABCD" module_uuid="EDFG"/> - <projects id="302" kee="pj-w-snapshot:file" root_uuid="EDFG" uuid="BCDE" module_uuid="EDFG"/> - <projects id="303" kee="pj-w-snapshot:other" root_uuid="EDFG" uuid="CDEF" module_uuid="EDFG"/> - <projects id="300" kee="pj-w-snapshot" uuid="EDFG" root_uuid="EDFG" module_uuid="[null]"/> - <projects id="400" kee="pj-wo-snapshot" uuid="FGHI" root_uuid="FGHI" project_uuid="FGHI"/> + <projects id="301" + kee="pj-w-snapshot:package" + root_uuid="EDFG" + uuid="ABCD" + uuid_path="NOT_USED" + module_uuid="EDFG"/> + <projects id="302" + kee="pj-w-snapshot:file" + root_uuid="EDFG" + uuid="BCDE" + uuid_path="NOT_USED" + module_uuid="EDFG"/> + <projects id="303" + kee="pj-w-snapshot:other" + root_uuid="EDFG" + uuid="CDEF" + uuid_path="NOT_USED" + module_uuid="EDFG"/> + <projects id="300" + kee="pj-w-snapshot" + uuid="EDFG" + uuid_path="NOT_USED" + root_uuid="EDFG" + module_uuid="[null]"/> + <projects id="400" + kee="pj-wo-snapshot" + uuid="FGHI" + uuid_path="NOT_USED" + root_uuid="FGHI" + project_uuid="FGHI"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/group_should_be_authorized.xml b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/group_should_be_authorized.xml index 07ae52a0cc8..6bad834a95b 100644 --- a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/group_should_be_authorized.xml +++ b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/group_should_be_authorized.xml @@ -2,15 +2,50 @@ <!-- user 100 has no direct grant access, but is in the group 200 that has the role "user" on the project 300 --> - <user_roles id="1" user_id="100" resource_id="999" role="user"/> - <groups_users user_id="100" group_id="200"/> - <group_roles id="1" group_id="200" resource_id="300" role="user"/> - <group_roles id="2" group_id="200" resource_id="400" role="user"/> + <user_roles id="1" + user_id="100" + resource_id="999" + role="user"/> + <groups_users user_id="100" + group_id="200"/> + <group_roles id="1" + group_id="200" + resource_id="300" + role="user"/> + <group_roles id="2" + group_id="200" + resource_id="400" + role="user"/> - <projects id="301" kee="pj-w-snapshot:package" root_uuid="DEFG" uuid="ABCD" module_uuid="DEFG"/> - <projects id="302" kee="pj-w-snapshot:file" root_uuid="DEFG" uuid="BCDE" module_uuid="DEFG"/> - <projects id="303" kee="pj-w-snapshot:other" root_uuid="DEFG" uuid="CDEF" module_uuid="DEFG"/> - <projects id="300" kee="pj-w-snapshot" uuid="DEFG" root_uuid="DEFG" module_uuid="[null]"/> - <projects id="400" kee="pj-wo-snapshot" uuid="EFGH" root_uuid="EFGH" module_uuid="[null]"/> + <projects id="301" + kee="pj-w-snapshot:package" + root_uuid="DEFG" + uuid="ABCD" + uuid_path="NOT_USED" + module_uuid="DEFG"/> + <projects id="302" + kee="pj-w-snapshot:file" + root_uuid="DEFG" + uuid="BCDE" + uuid_path="NOT_USED" + module_uuid="DEFG"/> + <projects id="303" + kee="pj-w-snapshot:other" + root_uuid="DEFG" + uuid="CDEF" + uuid_path="NOT_USED" + module_uuid="DEFG"/> + <projects id="300" + kee="pj-w-snapshot" + uuid="DEFG" + uuid_path="NOT_USED" + root_uuid="DEFG" + module_uuid="[null]"/> + <projects id="400" + kee="pj-wo-snapshot" + uuid="EFGH" + uuid_path="NOT_USED" + root_uuid="EFGH" + module_uuid="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/is_authorized_component_key_for_global_permission.xml b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/is_authorized_component_key_for_global_permission.xml index c5cd325ea5e..e36e5b909f2 100644 --- a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/is_authorized_component_key_for_global_permission.xml +++ b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/is_authorized_component_key_for_global_permission.xml @@ -2,14 +2,44 @@ <!-- user 100 has no direct grant access, but is in the group 200 that has the role "user" on the all the projects --> - <user_roles id="1" user_id="100" resource_id="999" role="user"/> - <groups_users user_id="100" group_id="200"/> - <group_roles id="1" group_id="200" resource_id="[null]" role="user"/> + <user_roles id="1" + user_id="100" + resource_id="999" + role="user"/> + <groups_users user_id="100" + group_id="200"/> + <group_roles id="1" + group_id="200" + resource_id="[null]" + role="user"/> - <projects id="301" kee="pj-w-snapshot:package" root_id="300" uuid="ABCD" module_uuid="DEFG"/> - <projects id="302" kee="pj-w-snapshot:file" root_id="300" uuid="BCDE" module_uuid="DEFG"/> - <projects id="303" kee="pj-w-snapshot:other" root_id="300" uuid="CDEF" module_uuid="DEFG"/> - <projects id="300" kee="pj-w-snapshot" uuid="DEFG" module_uuid="[null]"/> - <projects id="400" kee="pj-wo-snapshot" uuid="EFGH" module_uuid="[null]"/> + <projects id="301" + kee="pj-w-snapshot:package" + root_id="300" + uuid="ABCD" + uuid_path="NOT_USED" + module_uuid="DEFG"/> + <projects id="302" + kee="pj-w-snapshot:file" + root_id="300" + uuid="BCDE" + uuid_path="NOT_USED" + module_uuid="DEFG"/> + <projects id="303" + kee="pj-w-snapshot:other" + root_id="300" + uuid="CDEF" + uuid_path="NOT_USED" + module_uuid="DEFG"/> + <projects id="300" + kee="pj-w-snapshot" + uuid="DEFG" + uuid_path="NOT_USED" + module_uuid="[null]"/> + <projects id="400" + kee="pj-wo-snapshot" + uuid="EFGH" + uuid_path="NOT_USED" + module_uuid="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_project_ids_for_anonymous.xml b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_project_ids_for_anonymous.xml index e02308c9bc1..19724d2ab2d 100644 --- a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_project_ids_for_anonymous.xml +++ b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_project_ids_for_anonymous.xml @@ -1,10 +1,29 @@ <dataset> - <groups_users user_id="100" group_id="200"/> - <group_roles id="1" group_id="[null]" resource_id="300" role="user"/> - <group_roles id="2" group_id="200" resource_id="400" role="codeviewer"/> + <groups_users user_id="100" + group_id="200"/> + <group_roles id="1" + group_id="[null]" + resource_id="300" + role="user"/> + <group_roles id="2" + group_id="200" + resource_id="400" + role="codeviewer"/> - <projects id="300" kee="pj-w-snapshot" uuid="DEFG" root_uuid="DEFG" module_uuid="[null]" enabled="[true]"/> - <projects id="400" kee="pj-wo-snapshot" uuid="EFGH" root_uuid="EFGH" module_uuid="[null]" enabled="[true]"/> + <projects id="300" + kee="pj-w-snapshot" + uuid="DEFG" + uuid_path="NOT_USED" + root_uuid="DEFG" + module_uuid="[null]" + enabled="[true]"/> + <projects id="400" + kee="pj-wo-snapshot" + uuid="EFGH" + uuid_path="NOT_USED" + root_uuid="EFGH" + module_uuid="[null]" + enabled="[true]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_project_ids_for_group.xml b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_project_ids_for_group.xml index 593f2936ac6..4ca03a05ac3 100644 --- a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_project_ids_for_group.xml +++ b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_project_ids_for_group.xml @@ -1,10 +1,29 @@ <dataset> - <groups_users user_id="100" group_id="200"/> - <group_roles id="1" group_id="200" resource_id="300" role="user"/> - <group_roles id="2" group_id="200" resource_id="400" role="codeviewer"/> + <groups_users user_id="100" + group_id="200"/> + <group_roles id="1" + group_id="200" + resource_id="300" + role="user"/> + <group_roles id="2" + group_id="200" + resource_id="400" + role="codeviewer"/> - <projects id="300" kee="pj-w-snapshot" uuid="DEFG" root_uuid="DEFG" module_uuid="[null]" enabled="[true]"/> - <projects id="400" kee="pj-wo-snapshot" uuid="EFGH" root_uuid="EFGH" module_uuid="[null]" enabled="[true]"/> + <projects id="300" + kee="pj-w-snapshot" + uuid="DEFG" + uuid_path="NOT_USED" + root_uuid="DEFG" + module_uuid="[null]" + enabled="[true]"/> + <projects id="400" + kee="pj-wo-snapshot" + uuid="EFGH" + uuid_path="NOT_USED" + root_uuid="EFGH" + module_uuid="[null]" + enabled="[true]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_project_ids_for_user.xml b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_project_ids_for_user.xml index e2994285531..ac23aa7233e 100644 --- a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_project_ids_for_user.xml +++ b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_project_ids_for_user.xml @@ -1,10 +1,28 @@ <dataset> <!-- user 100 has the role "user" on the project 300 --> - <user_roles id="1" user_id="100" resource_id="300" role="user"/> - <user_roles id="2" user_id="100" resource_id="400" role="codeviewer"/> + <user_roles id="1" + user_id="100" + resource_id="300" + role="user"/> + <user_roles id="2" + user_id="100" + resource_id="400" + role="codeviewer"/> - <projects id="300" kee="pj-w-snapshot" uuid="DEFG" root_uuid="DEFG" module_uuid="[null]" enabled="[true]"/> - <projects id="400" kee="pj-wo-snapshot" uuid="EFGH" root_uuid="EFGH" module_uuid="[null]" enabled="[true]"/> + <projects id="300" + kee="pj-w-snapshot" + uuid="DEFG" + uuid_path="NOT_USED" + root_uuid="DEFG" + module_uuid="[null]" + enabled="[true]"/> + <projects id="400" + kee="pj-wo-snapshot" + uuid="EFGH" + uuid_path="NOT_USED" + root_uuid="EFGH" + module_uuid="[null]" + enabled="[true]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_users_for_role_and_project_for_anonymous.xml b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_users_for_role_and_project_for_anonymous.xml index b7b48ed7ea9..93356a34bda 100644 --- a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_users_for_role_and_project_for_anonymous.xml +++ b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_users_for_role_and_project_for_anonymous.xml @@ -1,18 +1,46 @@ <dataset> <!-- users 100 and 101 have no direct grant access, but are in the group 200 that has the role "user" on the project 300 --> - <user_roles id="1" user_id="100" resource_id="999" role="user"/> - <user_roles id="2" user_id="101" resource_id="999" role="user"/> - <user_roles id="3" user_id="102" resource_id="999" role="user"/> + <user_roles id="1" + user_id="100" + resource_id="999" + role="user"/> + <user_roles id="2" + user_id="101" + resource_id="999" + role="user"/> + <user_roles id="3" + user_id="102" + resource_id="999" + role="user"/> - <groups_users user_id="100" group_id="200"/> - <groups_users user_id="101" group_id="200"/> - <groups_users user_id="102" group_id="201"/> + <groups_users user_id="100" + group_id="200"/> + <groups_users user_id="101" + group_id="200"/> + <groups_users user_id="102" + group_id="201"/> - <group_roles id="1" group_id="[null]" resource_id="300" role="user"/> - <group_roles id="2" group_id="201" resource_id="400" role="user"/> + <group_roles id="1" + group_id="[null]" + resource_id="300" + role="user"/> + <group_roles id="2" + group_id="201" + resource_id="400" + role="user"/> - <projects id="300" kee="pj-w-snapshot" uuid="DEFG" root_uuid="DEFG" module_uuid="[null]"/> - <projects id="400" kee="pj-wo-snapshot" uuid="EFGH" root_uuid="EFGH" module_uuid="[null]"/> + <projects id="300" + kee="pj-w-snapshot" + uuid="DEFG" + uuid_path="NOT_USED" + root_uuid="DEFG" + module_uuid="[null]"/> + <projects id="400" + kee="pj-wo-snapshot" + uuid="EFGH" + uuid_path="NOT_USED" + root_uuid="EFGH" + module_uuid="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_users_for_role_and_project_for_group.xml b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_users_for_role_and_project_for_group.xml index a354439d560..3b7278e4c0a 100644 --- a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_users_for_role_and_project_for_group.xml +++ b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_users_for_role_and_project_for_group.xml @@ -1,18 +1,46 @@ <dataset> <!-- users 100 and 101 have no direct grant access, but are in the group 200 that has the role "user" on the project 300 --> - <user_roles id="1" user_id="100" resource_id="999" role="user"/> - <user_roles id="2" user_id="101" resource_id="999" role="user"/> - <user_roles id="3" user_id="102" resource_id="999" role="user"/> + <user_roles id="1" + user_id="100" + resource_id="999" + role="user"/> + <user_roles id="2" + user_id="101" + resource_id="999" + role="user"/> + <user_roles id="3" + user_id="102" + resource_id="999" + role="user"/> - <groups_users user_id="100" group_id="200"/> - <groups_users user_id="101" group_id="200"/> - <groups_users user_id="102" group_id="201"/> + <groups_users user_id="100" + group_id="200"/> + <groups_users user_id="101" + group_id="200"/> + <groups_users user_id="102" + group_id="201"/> - <group_roles id="1" group_id="200" resource_id="300" role="user"/> - <group_roles id="2" group_id="201" resource_id="400" role="user"/> + <group_roles id="1" + group_id="200" + resource_id="300" + role="user"/> + <group_roles id="2" + group_id="201" + resource_id="400" + role="user"/> - <projects id="300" kee="pj-w-snapshot" uuid="DEFG" root_uuid="DEFG" module_uuid="[null]"/> - <projects id="400" kee="pj-wo-snapshot" uuid="EFGH" root_uuid="EFGH" module_uuid="[null]"/> + <projects id="300" + kee="pj-w-snapshot" + uuid="DEFG" + uuid_path="NOT_USED" + root_uuid="DEFG" + module_uuid="[null]"/> + <projects id="400" + kee="pj-wo-snapshot" + uuid="EFGH" + uuid_path="NOT_USED" + root_uuid="EFGH" + module_uuid="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_users_for_role_and_project_for_user.xml b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_users_for_role_and_project_for_user.xml index 0fa56c9ee59..173657868ec 100644 --- a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_users_for_role_and_project_for_user.xml +++ b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/keep_authorized_users_for_role_and_project_for_user.xml @@ -1,15 +1,41 @@ <dataset> <!-- Users 100 and 101 are 'user' on project 300 --> - <user_roles id="1" user_id="100" resource_id="300" role="user"/> - <user_roles id="2" user_id="101" resource_id="300" role="user"/> - <user_roles id="3" user_id="102" resource_id="300" role="admin"/> - <user_roles id="4" user_id="100" resource_id="400" role="user"/> + <user_roles id="1" + user_id="100" + resource_id="300" + role="user"/> + <user_roles id="2" + user_id="101" + resource_id="300" + role="user"/> + <user_roles id="3" + user_id="102" + resource_id="300" + role="admin"/> + <user_roles id="4" + user_id="100" + resource_id="400" + role="user"/> - <groups_users user_id="100" group_id="200"/> - <group_roles id="1" group_id="200" resource_id="400" role="user"/> + <groups_users user_id="100" + group_id="200"/> + <group_roles id="1" + group_id="200" + resource_id="400" + role="user"/> - <projects id="300" kee="pj-w-snapshot" uuid="DEFG" root_uuid="DEFG" module_uuid="[null]"/> - <projects id="400" kee="pj-wo-snapshot" uuid="EFGH" root_uuid="EFGH" module_uuid="[null]"/> + <projects id="300" + kee="pj-w-snapshot" + uuid="DEFG" + uuid_path="NOT_USED" + root_uuid="DEFG" + module_uuid="[null]"/> + <projects id="400" + kee="pj-wo-snapshot" + uuid="EFGH" + uuid_path="NOT_USED" + root_uuid="EFGH" + module_uuid="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/should_return_root_project_keys_for_anonymous.xml b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/should_return_root_project_keys_for_anonymous.xml index 7db6a43c676..2478b403566 100644 --- a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/should_return_root_project_keys_for_anonymous.xml +++ b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/should_return_root_project_keys_for_anonymous.xml @@ -1,16 +1,52 @@ <dataset> - <user_roles id="1" user_id="100" resource_id="999" role="user"/> - <groups_users user_id="100" group_id="200"/> - <group_roles id="1" group_id="[null]" resource_id="300" role="user"/> + <user_roles id="1" + user_id="100" + resource_id="999" + role="user"/> + <groups_users user_id="100" + group_id="200"/> + <group_roles id="1" + group_id="[null]" + resource_id="300" + role="user"/> - <projects id="300" uuid="ABCD" root_uuid="ABCD" module_uuid="[null]" kee="pj-w-snapshot" scope="PRJ" qualifier="TRK" enabled="[true]"/> - <projects id="301" uuid="BCDE" root_uuid="BCDE" module_uuid="[null]" kee="pj-w-snapshot1" scope="PRJ" qualifier="TRK" + <projects id="300" + uuid="ABCD" + uuid_path="NOT_USED" + root_uuid="ABCD" + module_uuid="[null]" + kee="pj-w-snapshot" + scope="PRJ" + qualifier="TRK" enabled="[true]"/> - <projects id="302" uuid="CDEF" root_uuid="CDEF" module_uuid="[null]" kee="pj-w-snapshot2" scope="PRJ" qualifier="TRK" + <projects id="301" + uuid="BCDE" + uuid_path="NOT_USED" + root_uuid="BCDE" + module_uuid="[null]" + kee="pj-w-snapshot1" + scope="PRJ" + qualifier="TRK" + enabled="[true]"/> + <projects id="302" + uuid="CDEF" + uuid_path="NOT_USED" + root_uuid="CDEF" + module_uuid="[null]" + kee="pj-w-snapshot2" + scope="PRJ" + qualifier="TRK" enabled="[true]"/> - <projects id="303" uuid="DEFG" root_uuid="DEFG" module_uuid="[null]" kee="pj-w-snapshot3" scope="PRJ" qualifier="TRK" + <projects id="303" + uuid="DEFG" + uuid_path="NOT_USED" + root_uuid="DEFG" + module_uuid="[null]" + kee="pj-w-snapshot3" + scope="PRJ" + qualifier="TRK" enabled="[true]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/should_return_root_project_keys_for_group.xml b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/should_return_root_project_keys_for_group.xml index bf24717a9b9..09588924dc9 100644 --- a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/should_return_root_project_keys_for_group.xml +++ b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/should_return_root_project_keys_for_group.xml @@ -2,17 +2,53 @@ <!-- user 100 has no direct grant access, but is in the group 200 that has the role "user" on the project 300 --> - <user_roles id="1" user_id="100" resource_id="999" role="user"/> - <groups_users user_id="100" group_id="200"/> - <group_roles id="1" group_id="200" resource_id="300" role="user"/> + <user_roles id="1" + user_id="100" + resource_id="999" + role="user"/> + <groups_users user_id="100" + group_id="200"/> + <group_roles id="1" + group_id="200" + resource_id="300" + role="user"/> - <projects id="300" uuid="ABCD" root_uuid="ABCD" module_uuid="[null]" kee="pj-w-snapshot" scope="PRJ" qualifier="TRK" enabled="[true]"/> - <projects id="301" uuid="BCDE" root_uuid="BCDE" module_uuid="[null]" kee="pj-w-snapshot1" scope="PRJ" qualifier="TRK" + <projects id="300" + uuid="ABCD" + uuid_path="NOT_USED" + root_uuid="ABCD" + module_uuid="[null]" + kee="pj-w-snapshot" + scope="PRJ" + qualifier="TRK" enabled="[true]"/> - <projects id="302" uuid="CDEF" root_uuid="CDEF" module_uuid="[null]" kee="pj-w-snapshot2" scope="PRJ" qualifier="TRK" + <projects id="301" + uuid="BCDE" + uuid_path="NOT_USED" + root_uuid="BCDE" + module_uuid="[null]" + kee="pj-w-snapshot1" + scope="PRJ" + qualifier="TRK" + enabled="[true]"/> + <projects id="302" + uuid="CDEF" + uuid_path="NOT_USED" + root_uuid="CDEF" + module_uuid="[null]" + kee="pj-w-snapshot2" + scope="PRJ" + qualifier="TRK" enabled="[true]"/> - <projects id="303" uuid="DEFG" root_uuid="DEFG" module_uuid="[null]" kee="pj-w-snapshot3" scope="PRJ" qualifier="TRK" + <projects id="303" + uuid="DEFG" + uuid_path="NOT_USED" + root_uuid="DEFG" + module_uuid="[null]" + kee="pj-w-snapshot3" + scope="PRJ" + qualifier="TRK" enabled="[true]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/should_return_root_project_keys_for_user.xml b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/should_return_root_project_keys_for_user.xml index 6ddf4cd5cda..19098f180fe 100644 --- a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/should_return_root_project_keys_for_user.xml +++ b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/should_return_root_project_keys_for_user.xml @@ -1,17 +1,53 @@ <dataset> <!-- user 100 has the role "user" on the project 300 and in group 200 --> - <user_roles id="1" user_id="100" resource_id="300" role="user"/> - <groups_users user_id="100" group_id="200"/> - <group_roles id="1" group_id="200" resource_id="999" role="user"/> + <user_roles id="1" + user_id="100" + resource_id="300" + role="user"/> + <groups_users user_id="100" + group_id="200"/> + <group_roles id="1" + group_id="200" + resource_id="999" + role="user"/> - <projects id="300" uuid="ABCD" root_uuid="ABCD" module_uuid="[null]" kee="pj-w-snapshot" scope="PRJ" qualifier="TRK" enabled="[true]"/> - <projects id="301" uuid="BCDE" root_uuid="BCDE" module_uuid="[null]" kee="pj-w-snapshot1" scope="PRJ" qualifier="TRK" + <projects id="300" + uuid="ABCD" + uuid_path="NOT_USED" + root_uuid="ABCD" + module_uuid="[null]" + kee="pj-w-snapshot" + scope="PRJ" + qualifier="TRK" enabled="[true]"/> - <projects id="302" uuid="CDEF" root_uuid="CDEF" module_uuid="[null]" kee="pj-w-snapshot2" scope="PRJ" qualifier="TRK" + <projects id="301" + uuid="BCDE" + uuid_path="NOT_USED" + root_uuid="BCDE" + module_uuid="[null]" + kee="pj-w-snapshot1" + scope="PRJ" + qualifier="TRK" + enabled="[true]"/> + <projects id="302" + uuid="CDEF" + uuid_path="NOT_USED" + root_uuid="CDEF" + module_uuid="[null]" + kee="pj-w-snapshot2" + scope="PRJ" + qualifier="TRK" enabled="[true]"/> - <projects id="303" uuid="DEFG" root_uuid="DEFG" module_uuid="[null]" kee="pj-w-snapshot3" scope="PRJ" qualifier="TRK" + <projects id="303" + uuid="DEFG" + uuid_path="NOT_USED" + root_uuid="DEFG" + module_uuid="[null]" + kee="pj-w-snapshot3" + scope="PRJ" + qualifier="TRK" enabled="[true]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/user_should_be_authorized.xml b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/user_should_be_authorized.xml index 5bed484123e..176e9eb9c3e 100644 --- a/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/user_should_be_authorized.xml +++ b/sonar-db/src/test/resources/org/sonar/db/user/AuthorizationDaoTest/user_should_be_authorized.xml @@ -1,11 +1,31 @@ <dataset> <!-- user 100 has the role "user" on the project 300 and in group 200 --> - <user_roles id="1" user_id="100" resource_id="300" role="user"/> - <user_roles id="2" user_id="100" resource_id="400" role="user"/> - <groups_users user_id="100" group_id="200"/> - <group_roles id="1" group_id="200" resource_id="999" role="user"/> + <user_roles id="1" + user_id="100" + resource_id="300" + role="user"/> + <user_roles id="2" + user_id="100" + resource_id="400" + role="user"/> + <groups_users user_id="100" + group_id="200"/> + <group_roles id="1" + group_id="200" + resource_id="999" + role="user"/> - <projects id="300" kee="pj-w-snapshot" uuid="DEFG" root_uuid="DEFG" module_uuid="[null]"/> - <projects id="400" kee="pj-wo-snapshot" uuid="EFGH" root_uuid="EFGH" module_uuid="[null]"/> + <projects id="300" + kee="pj-w-snapshot" + uuid="DEFG" + uuid_path="NOT_USED" + root_uuid="DEFG" + module_uuid="[null]"/> + <projects id="400" + kee="pj-wo-snapshot" + uuid="EFGH" + uuid_path="NOT_USED" + root_uuid="EFGH" + module_uuid="[null]"/> </dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/version/v60/PopulateUuidPathColumnOnProjectsTest/in_progress_projects_and_snapshots.sql b/sonar-db/src/test/resources/org/sonar/db/version/v60/PopulateUuidPathColumnOnProjectsTest/in_progress_projects_and_snapshots.sql new file mode 100644 index 00000000000..92f64e965a6 --- /dev/null +++ b/sonar-db/src/test/resources/org/sonar/db/version/v60/PopulateUuidPathColumnOnProjectsTest/in_progress_projects_and_snapshots.sql @@ -0,0 +1,58 @@ +CREATE TABLE "PROJECTS" ( + "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + "KEE" VARCHAR(400), + "UUID" VARCHAR(50) NOT NULL, + // NULLABLE at the time + "UUID_PATH" VARCHAR(4000), + "ROOT_UUID" VARCHAR(50) NOT NULL, + "PROJECT_UUID" VARCHAR(50), + "MODULE_UUID" VARCHAR(50), + "MODULE_UUID_PATH" VARCHAR(4000), + "NAME" VARCHAR(2000), + "DESCRIPTION" VARCHAR(2000), + "ENABLED" BOOLEAN NOT NULL DEFAULT TRUE, + "SCOPE" VARCHAR(3), + "QUALIFIER" VARCHAR(10), + "DEPRECATED_KEE" VARCHAR(400), + "PATH" VARCHAR(2000), + "LANGUAGE" VARCHAR(20), + "COPY_COMPONENT_UUID" VARCHAR(50), + "LONG_NAME" VARCHAR(2000), + "DEVELOPER_UUID" VARCHAR(50), + "CREATED_AT" TIMESTAMP, + "AUTHORIZATION_UPDATED_AT" BIGINT +); + +CREATE TABLE "SNAPSHOTS" ( + "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), + "UUID" VARCHAR(50) NOT NULL, + "CREATED_AT" BIGINT, + "BUILD_DATE" BIGINT, + "COMPONENT_UUID" VARCHAR(50) NOT NULL, + "PARENT_SNAPSHOT_ID" INTEGER, + "STATUS" VARCHAR(4) NOT NULL DEFAULT 'U', + "PURGE_STATUS" INTEGER, + "ISLAST" BOOLEAN NOT NULL DEFAULT FALSE, + "SCOPE" VARCHAR(3), + "QUALIFIER" VARCHAR(10), + "ROOT_SNAPSHOT_ID" INTEGER, + "VERSION" VARCHAR(500), + "PATH" VARCHAR(500), + "DEPTH" INTEGER, + "ROOT_COMPONENT_UUID" VARCHAR(50) NOT NULL, + "PERIOD1_MODE" VARCHAR(100), + "PERIOD1_PARAM" VARCHAR(100), + "PERIOD1_DATE" BIGINT, + "PERIOD2_MODE" VARCHAR(100), + "PERIOD2_PARAM" VARCHAR(100), + "PERIOD2_DATE" BIGINT, + "PERIOD3_MODE" VARCHAR(100), + "PERIOD3_PARAM" VARCHAR(100), + "PERIOD3_DATE" BIGINT, + "PERIOD4_MODE" VARCHAR(100), + "PERIOD4_PARAM" VARCHAR(100), + "PERIOD4_DATE" BIGINT, + "PERIOD5_MODE" VARCHAR(100), + "PERIOD5_PARAM" VARCHAR(100), + "PERIOD5_DATE" BIGINT +); diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentTreeWsRequest.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentTreeWsRequest.java index 1d7322a486b..233eae10665 100644 --- a/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentTreeWsRequest.java +++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/measure/ComponentTreeWsRequest.java @@ -102,12 +102,11 @@ public class ComponentTreeWsRequest { return this; } - @CheckForNull public List<String> getSort() { return sort; } - public ComponentTreeWsRequest setSort(@Nullable List<String> sort) { + public ComponentTreeWsRequest setSort(List<String> sort) { this.sort = sort; return this; } |