diff options
author | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-12-21 15:21:13 +0100 |
---|---|---|
committer | Teryk Bellahsene <teryk.bellahsene@sonarsource.com> | 2015-12-21 15:21:38 +0100 |
commit | 612eca3d6a8df519a502b31b7cbe8f735f34decb (patch) | |
tree | 627e9b38f9fe830398a8d1d953d0c2f32ff64226 /sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java | |
parent | d1e303f8412f61f426a6c746cc2ac10b584940bd (diff) | |
download | sonarqube-612eca3d6a8df519a502b31b7cbe8f735f34decb.tar.gz sonarqube-612eca3d6a8df519a502b31b7cbe8f735f34decb.zip |
SONAR-7127 Add language parameter to WS api/components/search
Diffstat (limited to 'sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java')
-rw-r--r-- | sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java | 19 |
1 files changed, 16 insertions, 3 deletions
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 5cf3d42c5f7..3c3491ca31e 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 @@ -683,7 +683,7 @@ public class ComponentDaoTest { db.commit(); componentDb.indexProjects(); - ComponentQuery query = new ComponentQuery("oJect", Qualifiers.PROJECT); + ComponentQuery query = new ComponentQuery("oJect", null, Qualifiers.PROJECT); List<ComponentDto> result = underTest.selectByQuery(dbSession, query, 1, 3); assertThat(result).hasSize(3); @@ -697,7 +697,7 @@ public class ComponentDaoTest { db.commit(); componentDb.indexProjects(); - ComponentQuery query = new ComponentQuery("-\\_%/-", Qualifiers.PROJECT); + ComponentQuery query = new ComponentQuery("-\\_%/-", null, Qualifiers.PROJECT); List<ComponentDto> result = underTest.selectByQuery(dbSession, query, 0, 10); assertThat(result).hasSize(1); @@ -711,7 +711,7 @@ public class ComponentDaoTest { db.commit(); componentDb.indexProjects(); - ComponentQuery query = new ComponentQuery("project-_%-", Qualifiers.PROJECT); + ComponentQuery query = new ComponentQuery("project-_%-", null, Qualifiers.PROJECT); List<ComponentDto> result = underTest.selectByQuery(dbSession, query, 0, 10); assertThat(result).hasSize(1); @@ -719,6 +719,19 @@ public class ComponentDaoTest { } @Test + public void select_by_query_filter_on_language() { + componentDb.insertComponent(newProjectDto().setKey("java-project-key").setLanguage("java")); + componentDb.insertComponent(newProjectDto().setKey("cpp-project-key").setLanguage("cpp")); + db.commit(); + + ComponentQuery query = new ComponentQuery(null, "java", Qualifiers.PROJECT); + List<ComponentDto> result = underTest.selectByQuery(dbSession, query, 0, 10); + + assertThat(result).hasSize(1); + assertThat(result.get(0).key()).isEqualTo("java-project-key"); + } + + @Test public void select_direct_children_of_a_project() { ComponentDto project = newProjectDto().setKey("project-key").setUuid("project-uuid"); SnapshotDto projectSnapshot = componentDb.insertProjectAndSnapshot(project); |