aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-db
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2017-01-23 23:36:47 +0100
committerSimon Brandhof <simon.brandhof@sonarsource.com>2017-01-24 09:39:42 +0100
commit9f80575a9fcf9faf9aabaf91a6c649315e7c31a4 (patch)
tree61f83eab0029e67445c41f15850806a5b5b88521 /sonar-db
parentd64a58b9177703e574f4214a7354b75407f61df8 (diff)
downloadsonarqube-9f80575a9fcf9faf9aabaf91a6c649315e7c31a4.tar.gz
sonarqube-9f80575a9fcf9faf9aabaf91a6c649315e7c31a4.zip
Drop unused ResourceDao#findProvisionedProjects()
Diffstat (limited to 'sonar-db')
-rw-r--r--sonar-db/src/main/java/org/sonar/db/component/ResourceDao.java17
-rw-r--r--sonar-db/src/main/java/org/sonar/db/component/ResourceMapper.java3
-rw-r--r--sonar-db/src/main/resources/org/sonar/db/component/ResourceMapper.xml41
-rw-r--r--sonar-db/src/test/java/org/sonar/db/component/ResourceDaoTest.java25
4 files changed, 2 insertions, 84 deletions
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 c7852d0e0ba..9748be9955c 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,8 +19,6 @@
*/
package org.sonar.db.component;
-import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import javax.annotation.CheckForNull;
import org.apache.ibatis.session.SqlSession;
@@ -113,21 +111,6 @@ public class ResourceDao extends AbstractDao {
}
/**
- * Return provisioned projects = enabled projects without snapshot
- */
- public List<ResourceDto> selectProvisionedProjects(Collection<String> qualifiers) {
- if (qualifiers.isEmpty()) {
- return Collections.emptyList();
- }
- SqlSession session = myBatis().openSession(false);
- try {
- return session.getMapper(ResourceMapper.class).selectProvisionedProjects(qualifiers);
- } finally {
- MyBatis.closeQuietly(session);
- }
- }
-
- /**
* Return provisioned project with given key
*/
public ResourceDto selectProvisionedProject(DbSession session, String key) {
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 296ba846eaf..f38a4fedd9a 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,7 +19,6 @@
*/
package org.sonar.db.component;
-import java.util.Collection;
import java.util.List;
import org.apache.ibatis.annotations.Param;
@@ -28,8 +27,6 @@ public interface ResourceMapper {
List<ResourceDto> selectResources(ResourceQuery query);
- List<ResourceDto> selectProvisionedProjects(@Param("qualifiers") Collection<String> qualifier);
-
ResourceDto selectProvisionedProject(@Param("key") String key);
void updateAuthorizationDate(@Param("projectId") Long projectId, @Param("authorizationDate") Long authorizationDate);
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 9b87197a94d..81e6f131052 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,32 +3,6 @@
<mapper namespace="org.sonar.db.component.ResourceMapper">
- <resultMap id="snapshotResultMap" type="Snapshot">
- <id property="id" column="id"/>
- <result property="createdAt" column="created_at"/>
- <result property="buildDate" column="build_date"/>
- <result property="componentUuid" column="component_uuid"/>
- <result property="status" column="status"/>
- <result property="purgeStatus" column="purge_status"/>
- <result property="last" column="islast"/>
- <result property="version" column="version"/>
- <result property="period1Mode" column="period1_mode"/>
- <result property="period2Mode" column="period2_mode"/>
- <result property="period3Mode" column="period3_mode"/>
- <result property="period4Mode" column="period4_mode"/>
- <result property="period5Mode" column="period5_mode"/>
- <result property="period1Param" column="period1_param"/>
- <result property="period2Param" column="period2_param"/>
- <result property="period3Param" column="period3_param"/>
- <result property="period4Param" column="period4_param"/>
- <result property="period5Param" column="period5_param"/>
- <result property="period1Date" column="period1_date"/>
- <result property="period2Date" column="period2_date"/>
- <result property="period3Date" column="period3_date"/>
- <result property="period4Date" column="period4_date"/>
- <result property="period5Date" column="period5_date"/>
- </resultMap>
-
<resultMap id="resourceResultMap" type="Resource">
<id property="id" column="id"/>
<result property="key" column="kee"/>
@@ -93,21 +67,6 @@
where p.uuid=#{uuid}
</select>
- <select id="selectProvisionedProjects" parameterType="map" resultMap="resourceResultMap">
- select p.* from projects p
- left join snapshots s on s.component_uuid=p.uuid
- <where>
- and s.id is null
- <if test="qualifiers != null and qualifiers.size() > 0">
- and
- <foreach item="qualifier" index="index" collection="qualifiers" open="(" separator=" or " close=")">
- p.qualifier=#{qualifier}
- </foreach>
- </if>
- and p.copy_component_uuid is null
- </where>
- </select>
-
<select id="selectProvisionedProject" parameterType="string" resultMap="resourceResultMap">
select p.* from projects p
left join snapshots s on s.component_uuid=p.uuid
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 c37aa18db02..998b4af33ed 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
@@ -19,28 +19,23 @@
*/
package org.sonar.db.component;
-import com.google.common.collect.Iterables;
-import java.util.Collections;
-import java.util.List;
import org.junit.Rule;
import org.junit.Test;
-import org.sonar.api.component.Component;
import org.sonar.api.utils.System2;
import org.sonar.db.DbTester;
-import static com.google.common.collect.Lists.newArrayList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class ResourceDaoTest {
- static System2 system = mock(System2.class);
+ private static System2 system = mock(System2.class);
@Rule
public DbTester dbTester = DbTester.create(system);
- ResourceDao underTest = dbTester.getDbClient().resourceDao();
+ private ResourceDao underTest = dbTester.getDbClient().resourceDao();
@Test
public void get_resource_by_uuid() {
@@ -74,18 +69,6 @@ public class ResourceDaoTest {
}
@Test
- public void should_select_provisioned_projects_by_qualifiers() {
- dbTester.prepareDbUnit(getClass(), "fixture-including-ghost-projects-and-technical-project.xml");
-
- List<ResourceDto> components = underTest.selectProvisionedProjects(newArrayList("TRK"));
- assertThat(components).hasSize(1);
- assertThat(components.get(0).getKey()).isEqualTo("org.sample:sample");
-
- assertThat(underTest.selectProvisionedProjects(newArrayList("unknown"))).isEmpty();
- assertThat(underTest.selectProvisionedProjects(Collections.<String>emptyList())).isEmpty();
- }
-
- @Test
public void update_authorization_date() {
dbTester.prepareDbUnit(getClass(), "update_authorization_date.xml");
@@ -95,8 +78,4 @@ public class ResourceDaoTest {
dbTester.assertDbUnit(getClass(), "update_authorization_date-result.xml", "projects");
}
-
- private List<String> getKeys(final List<Component> components) {
- return newArrayList(Iterables.transform(components, Component::key));
- }
}