From 612eca3d6a8df519a502b31b7cbe8f735f34decb Mon Sep 17 00:00:00 2001 From: Teryk Bellahsene Date: Mon, 21 Dec 2015 15:21:13 +0100 Subject: SONAR-7127 Add language parameter to WS api/components/search --- .../java/org/sonar/db/component/ComponentDaoTest.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'sonar-db/src/test/java/org/sonar/db/component/ComponentDaoTest.java') 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 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 result = underTest.selectByQuery(dbSession, query, 0, 10); assertThat(result).hasSize(1); @@ -711,13 +711,26 @@ public class ComponentDaoTest { db.commit(); componentDb.indexProjects(); - ComponentQuery query = new ComponentQuery("project-_%-", Qualifiers.PROJECT); + ComponentQuery query = new ComponentQuery("project-_%-", null, Qualifiers.PROJECT); List result = underTest.selectByQuery(dbSession, query, 0, 10); assertThat(result).hasSize(1); assertThat(result.get(0).key()).isEqualTo("project-_%-key"); } + @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 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"); -- cgit v1.2.3