diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-02-10 01:08:56 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2017-02-10 23:32:49 +0100 |
commit | f22279cfd17b1af30e631ee305acdb59c3f7ab21 (patch) | |
tree | 37ef9fcbc03b4a37227d0eb64a258796694dcc69 | |
parent | 4872092c687a2f5e9d91db44c2fc8ca6dcdc2081 (diff) | |
download | sonarqube-f22279cfd17b1af30e631ee305acdb59c3f7ab21.tar.gz sonarqube-f22279cfd17b1af30e631ee305acdb59c3f7ab21.zip |
SONAR-8761 clean-up ResourceDao
13 files changed, 6 insertions, 969 deletions
diff --git a/sonar-db/src/main/java/org/sonar/db/AbstractDao.java b/sonar-db/src/main/java/org/sonar/db/AbstractDao.java deleted file mode 100644 index fddc22c3890..00000000000 --- a/sonar-db/src/main/java/org/sonar/db/AbstractDao.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info 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; - -import org.sonar.api.utils.System2; - -public abstract class AbstractDao implements Dao { - - private final MyBatis myBatis; - private final System2 system2; - - public AbstractDao(MyBatis myBatis, System2 system2) { - this.myBatis = myBatis; - this.system2 = system2; - } - - protected MyBatis myBatis() { - return myBatis; - } - - protected long now() { - return system2.now(); - } -} diff --git a/sonar-db/src/main/java/org/sonar/db/component/ResourceDao.java b/sonar-db/src/main/java/org/sonar/db/component/ResourceDao.java index 107cb5c2164..70c84928174 100644 --- a/sonar-db/src/main/java/org/sonar/db/component/ResourceDao.java +++ b/sonar-db/src/main/java/org/sonar/db/component/ResourceDao.java @@ -19,102 +19,20 @@ */ package org.sonar.db.component; -import java.util.List; -import javax.annotation.CheckForNull; import org.apache.ibatis.session.SqlSession; import org.sonar.api.utils.System2; -import org.sonar.db.AbstractDao; -import org.sonar.db.DbSession; -import org.sonar.db.MyBatis; +import org.sonar.db.Dao; -public class ResourceDao extends AbstractDao { +public class ResourceDao implements Dao { - public ResourceDao(MyBatis myBatis, System2 system2) { - super(myBatis, system2); - } - - @CheckForNull - private static ResourceDto selectResource(ResourceQuery query, DbSession session) { - List<ResourceDto> resources = getResources(query, session); - if (!resources.isEmpty()) { - return resources.get(0); - } - return null; - } - - private static List<ResourceDto> getResources(ResourceQuery query, SqlSession session) { - return session.getMapper(ResourceMapper.class).selectResources(query); - } - - @CheckForNull - public ResourceDto selectResource(String componentUuid) { - SqlSession session = myBatis().openSession(false); - try { - return selectResource(componentUuid, session); - } finally { - MyBatis.closeQuietly(session); - } - } + private final System2 system2; - @CheckForNull - private static ResourceDto selectResource(String componentUuid, SqlSession session) { - return session.getMapper(ResourceMapper.class).selectResourceByUuid(componentUuid); + public ResourceDao(System2 system2) { + this.system2 = system2; } public void updateAuthorizationDate(Long projectId, SqlSession session) { - session.getMapper(ResourceMapper.class).updateAuthorizationDate(projectId, now()); - } - - /** - * Return the root project of a component. - * Will return the component itself if it's already the root project - * Can return null if the component does not exists. - * - * The implementation should rather use a new column already containing the root project, see https://jira.sonarsource.com/browse/SONAR-5188. - */ - @CheckForNull - private static ResourceDto getRootProjectByComponentKey(DbSession session, String componentKey) { - ResourceDto component = selectResource(ResourceQuery.create().setKey(componentKey), session); - if (component != null) { - String rootUuid = component.getRootUuid(); - if (rootUuid.equals(component.getUuid())) { - return component; - } else { - return getParentModuleByComponentUuid(rootUuid, session); - } - } - return null; - } - - @CheckForNull - public ResourceDto getRootProjectByComponentKey(String componentKey) { - DbSession session = myBatis().openSession(false); - try { - return getRootProjectByComponentKey(session, componentKey); - } finally { - MyBatis.closeQuietly(session); - } - } - - @CheckForNull - private static ResourceDto getParentModuleByComponentUuid(String componentUUid, DbSession session) { - ResourceDto component = selectResource(componentUUid, session); - if (component != null) { - String rootUuid = component.getRootUuid(); - if (rootUuid.equals(component.getUuid())) { - return component; - } else { - return getParentModuleByComponentUuid(rootUuid, session); - } - } - return null; - } - - /** - * Return provisioned project with given key - */ - public ResourceDto selectProvisionedProject(DbSession session, String key) { - return session.getMapper(ResourceMapper.class).selectProvisionedProject(key); + session.getMapper(ResourceMapper.class).updateAuthorizationDate(projectId, system2.now()); } } diff --git a/sonar-db/src/main/java/org/sonar/db/component/ResourceMapper.java b/sonar-db/src/main/java/org/sonar/db/component/ResourceMapper.java index fc7c805a74e..06bc63393c9 100644 --- a/sonar-db/src/main/java/org/sonar/db/component/ResourceMapper.java +++ b/sonar-db/src/main/java/org/sonar/db/component/ResourceMapper.java @@ -19,15 +19,9 @@ */ package org.sonar.db.component; -import java.util.List; import org.apache.ibatis.annotations.Param; public interface ResourceMapper { - ResourceDto selectResourceByUuid(String uuid); - - List<ResourceDto> selectResources(ResourceQuery query); - - ResourceDto selectProvisionedProject(@Param("key") String key); void updateAuthorizationDate(@Param("projectId") Long projectId, @Param("authorizationDate") Long authorizationDate); diff --git a/sonar-db/src/main/java/org/sonar/db/component/ResourceQuery.java b/sonar-db/src/main/java/org/sonar/db/component/ResourceQuery.java deleted file mode 100644 index df0fb7c79d3..00000000000 --- a/sonar-db/src/main/java/org/sonar/db/component/ResourceQuery.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2017 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.db.component; - -/** - * @since 3.0 - */ -public class ResourceQuery { - private String[] qualifiers = null; - private String key = null; - private boolean excludeDisabled = false; - - private ResourceQuery() { - } - - public static ResourceQuery create() { - return new ResourceQuery(); - } - - public String[] getQualifiers() { - return qualifiers; - } - - public ResourceQuery setQualifiers(String[] qualifiers) { - this.qualifiers = qualifiers; - return this; - } - - public String getKey() { - return key; - } - - public ResourceQuery setKey(String key) { - this.key = key; - return this; - } - - public boolean isExcludeDisabled() { - return excludeDisabled; - } - - public ResourceQuery setExcludeDisabled(boolean b) { - this.excludeDisabled = b; - return this; - } -} diff --git a/sonar-db/src/main/resources/org/sonar/db/component/ResourceMapper.xml b/sonar-db/src/main/resources/org/sonar/db/component/ResourceMapper.xml index 81e6f131052..f6488d64de7 100644 --- a/sonar-db/src/main/resources/org/sonar/db/component/ResourceMapper.xml +++ b/sonar-db/src/main/resources/org/sonar/db/component/ResourceMapper.xml @@ -3,78 +3,6 @@ <mapper namespace="org.sonar.db.component.ResourceMapper"> - <resultMap id="resourceResultMap" type="Resource"> - <id property="id" column="id"/> - <result property="key" column="kee"/> - <result property="uuid" column="uuid"/> - <result property="projectUuid" column="project_uuid"/> - <result property="moduleUuid" column="module_uuid"/> - <result property="moduleUuidPath" column="module_uuid_path"/> - <result property="deprecatedKey" column="deprecated_kee"/> - <result property="path" column="path"/> - <result property="name" column="name"/> - <result property="longName" column="long_name"/> - <result property="rootUuid" column="root_uuid"/> - <result property="scope" column="scope"/> - <result property="qualifier" column="qualifier"/> - <result property="enabled" column="enabled"/> - <result property="description" column="description"/> - <result property="language" column="language"/> - <result property="copyComponentUuid" column="copy_component_uuid"/> - <result property="developerUuid" column="developer_uuid"/> - <result property="createdAt" column="created_at"/> - <result property="authorizationUpdatedAt" column="authorization_updated_at"/> - </resultMap> - - <select id="selectResources" parameterType="map" resultMap="resourceResultMap"> - select * from projects p - <where> - <if test="qualifiers != null and qualifiers.length!=0"> - and p.qualifier in - <foreach item="qualifier" index="index" collection="qualifiers" open="(" separator="," close=")"> - #{qualifier} - </foreach> - </if> - <if test="key != null"> - and p.kee=#{key} - </if> - <if test="excludeDisabled"> - and p.enabled=${_true} - </if> - </where> - </select> - - <select id="selectResourceIds" parameterType="map" resultType="long"> - select p.id - from projects p - <where> - <if test="qualifiers != null and qualifiers.length!=0"> - and p.qualifier in - <foreach item="qualifier" index="index" collection="qualifiers" open="(" separator="," close=")">#{qualifier} - </foreach> - </if> - <if test="key != null"> - and p.kee=#{key} - </if> - <if test="excludeDisabled"> - and p.enabled=${_true} - </if> - </where> - </select> - - <select id="selectResourceByUuid" parameterType="String" resultMap="resourceResultMap"> - select * from projects p - where p.uuid=#{uuid} - </select> - - <select id="selectProvisionedProject" parameterType="string" resultMap="resourceResultMap"> - select p.* from projects p - left join snapshots s on s.component_uuid=p.uuid - where s.id is null - and p.kee = #{key} - and p.copy_component_uuid is null - </select> - <update id="updateAuthorizationDate" parameterType="map"> update projects set authorization_updated_at=#{authorizationDate} where id=#{projectId} diff --git a/sonar-db/src/test/java/org/sonar/db/component/ResourceDaoTest.java b/sonar-db/src/test/java/org/sonar/db/component/ResourceDaoTest.java index 9008f263530..aa2a4b72132 100644 --- a/sonar-db/src/test/java/org/sonar/db/component/ResourceDaoTest.java +++ b/sonar-db/src/test/java/org/sonar/db/component/ResourceDaoTest.java @@ -24,7 +24,6 @@ import org.junit.Test; import org.sonar.api.utils.System2; import org.sonar.db.DbTester; -import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -38,37 +37,6 @@ public class ResourceDaoTest { private ResourceDao underTest = dbTester.getDbClient().resourceDao(); @Test - public void get_resource_by_uuid() { - dbTester.prepareDbUnit(getClass(), "fixture.xml"); - - ResourceDto resource = underTest.selectResource("ABCD"); - - assertThat(resource.getUuid()).isEqualTo("ABCD"); - assertThat(resource.getProjectUuid()).isEqualTo("ABCD"); - assertThat(resource.getPath()).isNull(); - assertThat(resource.getName()).isEqualTo("Struts"); - assertThat(resource.getLongName()).isEqualTo("Apache Struts"); - assertThat(resource.getScope()).isEqualTo("PRJ"); - assertThat(resource.getDescription()).isEqualTo("the description"); - assertThat(resource.getLanguage()).isEqualTo("java"); - assertThat(resource.isEnabled()).isTrue(); - assertThat(resource.getAuthorizationUpdatedAt()).isNotNull(); - assertThat(resource.getCreatedAt()).isNotNull(); - } - - @Test - public void find_root_project_by_component_key() { - dbTester.prepareDbUnit(getClass(), "fixture.xml"); - - assertThat(underTest.getRootProjectByComponentKey("org.struts:struts-core:src/org/struts/RequestContext.java").getKey()).isEqualTo("org.struts:struts"); - assertThat(underTest.getRootProjectByComponentKey("org.struts:struts-core:src/org/struts").getKey()).isEqualTo("org.struts:struts"); - assertThat(underTest.getRootProjectByComponentKey("org.struts:struts-core").getKey()).isEqualTo("org.struts:struts"); - assertThat(underTest.getRootProjectByComponentKey("org.struts:struts").getKey()).isEqualTo("org.struts:struts"); - - assertThat(underTest.getRootProjectByComponentKey("unknown")).isNull(); - } - - @Test public void update_authorization_date() { dbTester.prepareDbUnit(getClass(), "update_authorization_date.xml"); 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 deleted file mode 100644 index 6e388d370f8..00000000000 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/fixture-including-ghost-projects-and-technical-project.xml +++ /dev/null @@ -1,372 +0,0 @@ -<dataset> - - <!-- root project --> - <projects organization_uuid="org1" - 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" - 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]" - created_at="1228222680000" - build_date="1228222680000" - version="[null]" - /> - <snapshots id="10" - uuid="u10" - component_uuid="ABCD" - 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]" - created_at="1228136280000" - build_date="1228136280000" - version="[null]" - /> - - <!-- project --> - <projects organization_uuid="org1" - 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" - 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]" - created_at="1228222680000" - build_date="1228222680000" - version="[null]" - /> - - <!-- directory --> - <projects organization_uuid="org1" - 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" - 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" - 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]" - created_at="1228222680000" - build_date="1228222680000" - version="[null]" - /> - - <!-- file --> - <projects organization_uuid="org1" - 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" - 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]" - authorization_updated_at="[null]"/> - - <snapshots id="4" - uuid="u4" - component_uuid="KLMN" - 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]" - created_at="1228222680000" - build_date="1228222680000" - version="[null]" - /> - - <!-- technical project --> - <projects organization_uuid="org1" - 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 organization_uuid="org1" - 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" - 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]" - created_at="1228222680000" - build_date="1228222680000" - version="[null]" - /> - <snapshots id="7" - uuid="u7" - component_uuid="ONLYERRORS" - 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]" - created_at="1228309080000" - build_date="1228309080000" - version="[null]" - /> - - - <!-- project without snapshot --> - <projects organization_uuid="org1" - 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 organization_uuid="org1" - 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" - 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]" - created_at="1228222680000" - build_date="1228222680000" - version="[null]" - /> - - -</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 deleted file mode 100644 index 84308102cde..00000000000 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/fixture.xml +++ /dev/null @@ -1,153 +0,0 @@ -<dataset> - - <!-- Struts projects is authorized for all user --> - <group_roles id="1" - group_id="[null]" - resource_id="1" - role="user" - organization_uuid="org1"/> - - - <!-- root project --> - <projects organization_uuid="org1" - 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" - 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]" - created_at="1228222680000" - build_date="1228222680000" - version="[null]" - /> - <snapshots id="10" - uuid="u10" - component_uuid="ABCD" - 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]" - created_at="1228136280000" - build_date="1228136280000" - version="[null]" - /> - - <!-- module --> - <projects organization_uuid="org1" - 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]"/> - - <!-- directory --> - <projects organization_uuid="org1" - 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]"/> - - <!-- file --> - <projects organization_uuid="org1" - long_name="org.struts.RequestContext" - id="4" - scope="FIL" - qualifier="FIL" - kee="org.struts:struts-core:src/org/struts/RequestContext.java" - 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]" - path="src/org/struts/RequestContext.java" - created_at="2008-12-02" - authorization_updated_at="[null]"/> - - -</dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/getResources_exclude_disabled.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/getResources_exclude_disabled.xml deleted file mode 100644 index 9887c0c19f5..00000000000 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/getResources_exclude_disabled.xml +++ /dev/null @@ -1,42 +0,0 @@ -<dataset> - - <!-- disabled --> - <projects organization_uuid="org1" - id="1" - root_id="[null]" - scope="PRJ" - qualifier="TRK" - kee="org.struts:struts" - name="Struts" - description="the description" - long_name="Apache Struts" - uuid="DISABLED" - project_uuid="[null]" - module_uuid="[null]" - module_uuid_path="." - enabled="[false]" - language="java" - copy_resource_id="[null]" - person_id="[null]" - authorization_updated_at="[null]"/> - - <!-- enabled --> - <projects organization_uuid="org1" - id="2" - root_id="[null]" - scope="PRJ" - qualifier="TRK" - kee="org.struts:struts" - name="Struts" - description="the description" - long_name="Apache Struts" - uuid="ENABLED" - project_uuid="[null]" - module_uuid="[null]" - module_uuid_path="." - enabled="[true]" - language="java" - copy_resource_id="[null]" - person_id="[null]" - authorization_updated_at="[null]"/> -</dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/insert-result.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/insert-result.xml deleted file mode 100644 index 7d74a43413e..00000000000 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/insert-result.xml +++ /dev/null @@ -1,47 +0,0 @@ -<dataset> - - <projects organization_uuid="org1" - id="1" - root_id="[null]" - uuid="ABCD" - project_uuid="EFGH" - module_uuid="EFGH" - module_uuid_path=".EFGH." - scope="FIL" - qualifier="FIL" - kee="org.struts:struts:/src/main/java/org/struts/Action.java" - name="Action" - description="[null]" - long_name="org.struts.Action" - enabled="[true]" - language="java" - copy_resource_id="[null]" - person_id="[null]" - created_at="[ignore]" - path="/foo/bar" - deprecated_kee="org.struts:struts:org.struts.Action" - authorization_updated_at="123456789"/> - - <projects organization_uuid="org1" - id="2" - root_id="[null]" - uuid="BCDE" - project_uuid="FGHI" - module_uuid="FGHI" - module_uuid_path=".FGHI." - scope="FIL" - qualifier="FIL" - kee="org.struts:struts:/src/main/java/org/struts/Filter.java" - name="Filter" - description="[null]" - long_name="org.struts.Filter" - enabled="[true]" - language="java" - copy_resource_id="[null]" - person_id="[null]" - created_at="[ignore]" - path="[null]" - deprecated_kee="org.struts:struts:org.struts.Filter" - authorization_updated_at="123456789"/> - -</dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/insert.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/insert.xml deleted file mode 100644 index 871dedcb5e9..00000000000 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/insert.xml +++ /dev/null @@ -1,3 +0,0 @@ -<dataset> - -</dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/update-result.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/update-result.xml deleted file mode 100644 index 0f72d1716ab..00000000000 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/update-result.xml +++ /dev/null @@ -1,25 +0,0 @@ -<dataset> - - <projects organization_uuid="org1" - id="1" - root_id="[null]" - uuid="ABCD" - project_uuid="ABCD" - module_uuid="[null]" - module_uuid_path="." - scope="PRJ" - qualifier="TRK" - kee="org.struts:struts" - name="Struts" - description="MVC Framework" - long_name="Apache Struts" - enabled="[true]" - language="java" - copy_resource_id="[null]" - person_id="[null]" - created_at="[null]" - path="/foo/bar" - deprecated_kee="deprecated key" - authorization_updated_at="[null]"/> - -</dataset> diff --git a/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/update.xml b/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/update.xml deleted file mode 100644 index 106c3b93d30..00000000000 --- a/sonar-db/src/test/resources/org/sonar/db/component/ResourceDaoTest/update.xml +++ /dev/null @@ -1,25 +0,0 @@ -<dataset> - - <projects organization_uuid="org1" - id="1" - root_id="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_resource_id="2" - person_id="3" - created_at="[null]" - path="/old/foo/bar" - deprecated_kee="old deprecated key" - authorization_updated_at="[null]"/> - -</dataset> |