Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmisinco2014-12-12 10:56:52 -0500
committerAngel Avila2014-12-12 10:56:52 -0500
commit087c777f6fb7efdd625d3838fbea1554aed614a7 (patch)
tree93d36e246e1c25ff8e644d604c5dfbc41c4445d4 /plugins/org.eclipse.osee.orcs.db.test
parent119e412fc2879676d3ccb431ee0d7f5b142be885 (diff)
downloadorg.eclipse.osee-087c777f6fb7efdd625d3838fbea1554aed614a7.tar.gz
org.eclipse.osee-087c777f6fb7efdd625d3838fbea1554aed614a7.tar.xz
org.eclipse.osee-087c777f6fb7efdd625d3838fbea1554aed614a7.zip
feature[ats_ATS101638]: Add merge branch query to BranchQuery
Diffstat (limited to 'plugins/org.eclipse.osee.orcs.db.test')
-rw-r--r--plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/BranchQuerySqlContextFactoryImplTest.java30
1 files changed, 30 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/BranchQuerySqlContextFactoryImplTest.java b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/BranchQuerySqlContextFactoryImplTest.java
index 8fe775f682..6019aebcc9 100644
--- a/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/BranchQuerySqlContextFactoryImplTest.java
+++ b/plugins/org.eclipse.osee.orcs.db.test/src/org/eclipse/osee/orcs/db/internal/search/engines/BranchQuerySqlContextFactoryImplTest.java
@@ -43,6 +43,7 @@ import org.eclipse.osee.orcs.core.ds.criteria.CriteriaBranchName;
import org.eclipse.osee.orcs.core.ds.criteria.CriteriaBranchState;
import org.eclipse.osee.orcs.core.ds.criteria.CriteriaBranchType;
import org.eclipse.osee.orcs.core.ds.criteria.CriteriaBranchUuids;
+import org.eclipse.osee.orcs.core.ds.criteria.CriteriaMergeBranchFor;
import org.eclipse.osee.orcs.db.internal.IdentityLocator;
import org.eclipse.osee.orcs.db.internal.SqlProvider;
import org.eclipse.osee.orcs.db.internal.search.Engines;
@@ -428,6 +429,35 @@ public class BranchQuerySqlContextFactoryImplTest {
assertEquals("Hello.*", iterator.next());
}
+ @Test
+ public void testMergeBranchFor() throws Exception {
+ String expected = "SELECT/*+ ordered */ br1.*\n" + //
+ " FROM \n" + //
+ "osee_merge mbr1, osee_branch br1\n" + //
+ " WHERE \n" + //
+ "mbr1.source_branch_id = ?\n" + //
+ " AND \n" + //
+ "mbr1.dest_branch_id = ?\n" + //
+ " AND \n" + //
+ "mbr1.merge_branch_id = br1.branch_id\n" + //
+ " ORDER BY br1.branch_id";
+
+ queryData.addCriteria(new CriteriaMergeBranchFor(1L, 2L));
+
+ QuerySqlContext context = queryEngine.createQueryContext(session, queryData);
+
+ assertEquals(expected, context.getSql());
+
+ List<Object> parameters = context.getParameters();
+ assertEquals(2, parameters.size());
+ List<AbstractJoinQuery> joins = context.getJoins();
+ assertEquals(0, joins.size());
+
+ Iterator<Object> iterator = parameters.iterator();
+ assertEquals(1L, iterator.next());
+ assertEquals(2L, iterator.next());
+ }
+
private static Criteria ancestorOf(IOseeBranch child) {
return new CriteriaBranchAncestorOf(child);
}

Back to the top