<select id="selectByKey" parameterType="String" resultType="Component">
SELECT
- <include refid="componentColumns"/>,
- o.kee as organizationKey
+ <include refid="componentColumns"/>
FROM projects p
- inner join organizations o on
- o.uuid = p.organization_uuid
where
p.kee=#{key}
</select>
<select id="selectByUuid" parameterType="String" resultType="Component">
SELECT
- <include refid="componentColumns"/>,
- o.kee as organizationKey
+ <include refid="componentColumns"/>
FROM projects p
- inner join organizations o on
- o.uuid = p.organization_uuid
where
p.uuid=#{uuid}
</select>
<select id="selectByUuids" parameterType="String" resultType="Component">
select
- <include refid="componentColumns"/>,
- o.kee as organizationKey
+ <include refid="componentColumns"/>
from projects p
- inner join organizations o on
- o.uuid = p.organization_uuid
where
p.uuid in
<foreach collection="uuids" open="(" close=")" item="uuid" separator=",">
<select id="selectByQuery" resultType="Component">
select
- <include refid="componentColumns"/>,
- o.kee as organizationKey
+ <include refid="componentColumns"/>
<include refid="sqlSelectByQuery"/>
ORDER BY LOWER(p.name), p.name, p.id
</select>
<sql id="sqlSelectByQuery">
from projects p
- inner join organizations o on
- o.uuid = p.organization_uuid
where
p.enabled=${_true}
AND p.copy_component_uuid is null
<select id="selectDescendants" resultType="Component">
select
- <include refid="componentColumns"/>,
- o.kee as organizationKey
+ <include refid="componentColumns"/>
from projects p
- inner join organizations o on
- o.uuid = p.organization_uuid
<include refid="selectDescendantsJoins"/>
<where>
<include refid="selectDescendantsFilters"/>
ComponentDto result = underTest.selectByUuid(dbSession, "U1").get();
assertThat(result).isNotNull();
assertThat(result.getOrganizationUuid()).isEqualTo("org1");
- assertThat(result.getOrganizationKey()).isEqualTo("org1_key");
assertThat(result.uuid()).isEqualTo("U1");
assertThat(result.getUuidPath()).isEqualTo("uuid_path_of_U1");
assertThat(result.moduleUuid()).isEqualTo("module_uuid_of_U1");
ComponentDto result = optional.get();
assertThat(result.getOrganizationUuid()).isEqualTo("org1");
- assertThat(result.getOrganizationKey()).isEqualTo("org1_key");
assertThat(result.uuid()).isEqualTo("U4");
assertThat(result.key()).isEqualTo("org.struts:struts-core:src/org/struts/RequestContext.java");
assertThat(result.path()).isEqualTo("path_of_U4");
ComponentDto result = results.get(0);
assertThat(result.getOrganizationUuid()).isEqualTo("org1");
- assertThat(result.getOrganizationKey()).isEqualTo("org1_key");
assertThat(result.uuid()).isEqualTo("U4");
assertThat(result.moduleUuid()).isEqualTo("module_uuid_of_U4");
assertThat(result.moduleUuidPath()).isEqualTo("module_uuid_path_of_U4");
assertThat(count).isEqualTo(9);
assertThat(result).extracting(ComponentDto::name).containsExactly("project-2", "project-3", "project-4");
assertThat(result).extracting(ComponentDto::getOrganizationUuid).containsOnly(organizationDto.getUuid());
- assertThat(result).extracting(ComponentDto::getOrganizationKey).containsOnly(organizationDto.getKey());
}
@Test
List<ComponentDto> components = underTest.selectDescendants(dbSession, dbQuery);
assertThat(components).extracting("uuid").containsOnly("project-copy-uuid", "subview-uuid");
assertThat(components).extracting("organizationUuid").containsOnly(organizationDto.getUuid());
- assertThat(components).extracting("organizationKey").containsOnly(organizationDto.getKey());
}
private static ComponentTreeQuery.Builder newTreeQuery(String baseUuid) {