Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Hallgren2010-02-25 17:31:06 +0000
committerThomas Hallgren2010-02-25 17:31:06 +0000
commiteaa7cbe6e5818394bc1673a8babc7d4ebd30ed13 (patch)
tree6bc72abf5945357db9fa97b602b8d4b1ab138243 /bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core
parentd3c84a2ee68e14ef740e238f90a214a9b14422e8 (diff)
downloadrt.equinox.p2-eaa7cbe6e5818394bc1673a8babc7d4ebd30ed13.tar.gz
rt.equinox.p2-eaa7cbe6e5818394bc1673a8babc7d4ebd30ed13.tar.xz
rt.equinox.p2-eaa7cbe6e5818394bc1673a8babc7d4ebd30ed13.zip
302201 : Unify the two query approaches used in p2, final step.
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java91
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CollectorTest.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java53
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ContextQuery.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/QueryTest.java13
5 files changed, 47 insertions, 117 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java
index 38de5985f..222699b1d 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java
@@ -9,12 +9,9 @@
******************************************************************************/
package org.eclipse.equinox.p2.tests.core;
-import org.eclipse.equinox.internal.p2.metadata.query.MatchQuery;
-
-import org.eclipse.equinox.internal.p2.metadata.query.IMatchQuery;
-
import java.util.*;
import junit.framework.TestCase;
+import org.eclipse.equinox.internal.p2.metadata.query.MatchQuery;
import org.eclipse.equinox.p2.query.*;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
@@ -33,7 +30,7 @@ public class AggregateQueryTest extends TestCase {
}
public void testEmptyCompositeQuery() {
- IQuery query = PipedQuery.createPipe(new IQuery[0]);
+ IQuery query = QueryUtil.createPipeQuery(Collections.<IQuery<Object>> emptySet());
query.perform(getABCDE().iterator());
// We should not throw an exception. No guarantee on what perform
// will return in this case
@@ -67,19 +64,19 @@ public class AggregateQueryTest extends TestCase {
}
};
- IQuery compoundQuery = CompoundQuery.createCompoundQuery(new IQuery[] {getLatest, getAllBut3}, true);
+ IQuery compoundQuery = QueryUtil.createCompoundQuery(getLatest, getAllBut3, true);
IQueryResult result = compoundQuery.perform(get123().iterator());
assertEquals(0, AbstractProvisioningTest.queryResultSize(result));
- compoundQuery = CompoundQuery.createCompoundQuery(new IQuery[] {getAllBut3, getLatest}, true);
+ compoundQuery = QueryUtil.createCompoundQuery(getAllBut3, getLatest, true);
result = compoundQuery.perform(get123().iterator());
assertEquals(0, AbstractProvisioningTest.queryResultSize(result));
- compoundQuery = CompoundQuery.createCompoundQuery(new IQuery[] {getLatest, getAllBut3}, false);
+ compoundQuery = QueryUtil.createCompoundQuery(getLatest, getAllBut3, false);
result = compoundQuery.perform(get123().iterator());
assertEquals(3, AbstractProvisioningTest.queryResultSize(result));
- compoundQuery = CompoundQuery.createCompoundQuery(new IQuery[] {getAllBut3, getLatest}, false);
+ compoundQuery = QueryUtil.createCompoundQuery(getAllBut3, getLatest, false);
result = compoundQuery.perform(get123().iterator());
assertEquals(3, AbstractProvisioningTest.queryResultSize(result));
@@ -118,81 +115,17 @@ public class AggregateQueryTest extends TestCase {
}
};
- IQuery compoundQuery = PipedQuery.createPipe(getLatest, getAllBut3);
+ IQuery compoundQuery = QueryUtil.createPipeQuery(getLatest, getAllBut3);
IQueryResult result = compoundQuery.perform(get123().iterator());
assertEquals(0, AbstractProvisioningTest.queryResultSize(result));
- compoundQuery = PipedQuery.createPipe(getAllBut3, getLatest);
+ compoundQuery = QueryUtil.createPipeQuery(getAllBut3, getLatest);
result = compoundQuery.perform(get123().iterator());
assertEquals(1, AbstractProvisioningTest.queryResultSize(result));
assertEquals("2", result.iterator().next());
}
- public void testCompoundAllMatchQueries() {
- IQuery A = new MatchQuery() {
- public boolean isMatch(Object candidate) {
- return false;
- }
- };
- IQuery B = new MatchQuery() {
- public boolean isMatch(Object candidate) {
- return false;
- }
- };
- IQuery C = new MatchQuery() {
- public boolean isMatch(Object candidate) {
- return false;
- }
- };
- IQuery compoundQuery = CompoundQuery.createCompoundQuery(new IQuery[] {A, B, C}, true);
- assertTrue("1.0", compoundQuery instanceof IMatchQuery);
- }
-
- public void testCompoundSomeMatchQueries() {
- IQuery A = new MatchQuery() {
- public boolean isMatch(Object candidate) {
- return false;
- }
- };
- IQuery B = new ContextQuery() {
- public Collector perform(Iterator iterator) {
- // TODO Auto-generated method stub
- return null;
- }
- };
- IQuery C = new MatchQuery() {
- public boolean isMatch(Object candidate) {
- return false;
- }
- };
- IQuery compoundQuery = CompoundQuery.createCompoundQuery(new IQuery[] {A, B, C}, true);
- assertTrue("1.0", !(compoundQuery instanceof IMatchQuery));
- }
-
- public void testCompoundNoMatchQueries() {
- IQuery A = new ContextQuery() {
- public Collector perform(Iterator iterator) {
- // TODO Auto-generated method stub
- return null;
- }
- };
- IQuery B = new ContextQuery() {
- public Collector perform(Iterator iterator) {
- // TODO Auto-generated method stub
- return null;
- }
- };
- IQuery C = new ContextQuery() {
- public Collector perform(Iterator iterator) {
- // TODO Auto-generated method stub
- return null;
- }
- };
- IQuery compoundQuery = CompoundQuery.createCompoundQuery(new IQuery[] {A, B, C}, true);
- assertTrue("1.0", !(compoundQuery instanceof IMatchQuery));
- }
-
public void testIntersection() {
IQuery ABC = new MatchQuery() {
public boolean isMatch(Object candidate) {
@@ -210,7 +143,7 @@ public class AggregateQueryTest extends TestCase {
}
};
- IQuery compoundQuery = CompoundQuery.createCompoundQuery(new IQuery[] {ABC, BCDE}, true);
+ IQuery compoundQuery = QueryUtil.createCompoundQuery(ABC, BCDE, true);
IQueryResult result = compoundQuery.perform(getABCDE().iterator());
assertEquals("1.0", AbstractProvisioningTest.queryResultSize(result), 2);
AbstractProvisioningTest.assertContains("1.1", result, "B");
@@ -242,7 +175,7 @@ public class AggregateQueryTest extends TestCase {
}
};
- IQuery compoundQuery = CompoundQuery.createCompoundQuery(new IQuery[] {ABC, BCDE}, true);
+ IQuery compoundQuery = QueryUtil.createCompoundQuery(ABC, BCDE, true);
IQueryResult result = compoundQuery.perform(getABCDE().iterator());
assertEquals("1.0", AbstractProvisioningTest.queryResultSize(result), 2);
AbstractProvisioningTest.assertContains("1.1", result, "B");
@@ -266,7 +199,7 @@ public class AggregateQueryTest extends TestCase {
}
};
- IQuery compoundQuery = CompoundQuery.createCompoundQuery(new IQuery[] {ABC, BCDE}, false);
+ IQuery compoundQuery = QueryUtil.createCompoundQuery(ABC, BCDE, false);
IQueryResult result = compoundQuery.perform(getABCDE().iterator());
assertEquals("1.0", AbstractProvisioningTest.queryResultSize(result), 5);
AbstractProvisioningTest.assertContains("1.1", result, "A");
@@ -301,7 +234,7 @@ public class AggregateQueryTest extends TestCase {
}
};
- IQuery compoundQuery = CompoundQuery.createCompoundQuery(new IQuery[] {ABC, BCDE}, false);
+ IQuery compoundQuery = QueryUtil.createCompoundQuery(ABC, BCDE, false);
IQueryResult result = compoundQuery.perform(getABCDE().iterator());
assertEquals("1.0", AbstractProvisioningTest.queryResultSize(result), 5);
AbstractProvisioningTest.assertContains("1.1", result, "A");
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CollectorTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CollectorTest.java
index 5a24e5348..a9e330549 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CollectorTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CollectorTest.java
@@ -11,9 +11,8 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.core;
-import org.eclipse.equinox.internal.p2.metadata.query.MatchQuery;
-
import java.util.*;
+import org.eclipse.equinox.internal.p2.metadata.query.MatchQuery;
import org.eclipse.equinox.p2.query.*;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java
index 9a52da388..56e25e479 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java
@@ -9,13 +9,12 @@
******************************************************************************/
package org.eclipse.equinox.p2.tests.core;
-import org.eclipse.equinox.internal.p2.metadata.query.MatchQuery;
-
import java.util.Arrays;
import java.util.Iterator;
import junit.framework.TestCase;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.tests.harness.TestProgressMonitor;
+import org.eclipse.equinox.internal.p2.metadata.query.MatchQuery;
import org.eclipse.equinox.p2.query.*;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
@@ -57,11 +56,11 @@ public class CompoundQueryableTest extends TestCase {
return Arrays.asList(array).iterator();
}
- IQueryable queryable1 = new IQueryable() {
+ IQueryable<Integer> queryable1 = new IQueryable<Integer>() {
Integer[] elements = new Integer[] {1, 2, 3, 4, 5};
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
- IQueryResult collector;
+ public IQueryResult<Integer> query(IQuery<Integer> query, IProgressMonitor monitor) {
+ IQueryResult<Integer> collector;
try {
monitor.beginTask("", 10);
collector = query.perform(createIterator(elements));
@@ -73,11 +72,11 @@ public class CompoundQueryableTest extends TestCase {
}
};
- IQueryable queryable2 = new IQueryable() {
+ IQueryable<Integer> queryable2 = new IQueryable<Integer>() {
Integer[] elements = new Integer[] {4, 6, 8, 10, 12};
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
- IQueryResult collector;
+ public IQueryResult<Integer> query(IQuery<Integer> query, IProgressMonitor monitor) {
+ IQueryResult<Integer> collector;
try {
monitor.beginTask("", 10);
collector = query.perform(createIterator(elements));
@@ -160,7 +159,7 @@ public class CompoundQueryableTest extends TestCase {
};
public void testMatchQuery() {
- CompoundQueryable cQueryable = new CompoundQueryable(queryable1, queryable2);
+ IQueryable cQueryable = QueryUtil.compoundQueryable(queryable1, queryable2);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
IQueryResult queryResult = cQueryable.query(matchQuery, monitor);
assertEquals("1.0", 6, AbstractProvisioningTest.queryResultSize(queryResult));
@@ -173,7 +172,7 @@ public class CompoundQueryableTest extends TestCase {
}
public void testSingleQueryable() {
- CompoundQueryable cQueryable = new CompoundQueryable(Arrays.asList(queryable1));
+ IQueryable cQueryable = QueryUtil.compoundQueryable(Arrays.asList(queryable1));
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
IQueryResult queryResult = cQueryable.query(matchQuery, monitor);
assertEquals("1.0", 2, AbstractProvisioningTest.queryResultSize(queryResult));
@@ -182,7 +181,7 @@ public class CompoundQueryableTest extends TestCase {
}
public void testSingleContextQuery() {
- CompoundQueryable cQueryable = new CompoundQueryable(Arrays.asList(queryable1));
+ IQueryable cQueryable = QueryUtil.compoundQueryable(Arrays.asList(queryable1));
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
IQueryResult queryResult = cQueryable.query(greatestNumberQuery, monitor);
assertEquals("1.0", 1, AbstractProvisioningTest.queryResultSize(queryResult));
@@ -190,7 +189,7 @@ public class CompoundQueryableTest extends TestCase {
}
public void testMultipleContextQueries() {
- CompoundQueryable cQueryable = new CompoundQueryable(queryable1, queryable2);
+ IQueryable cQueryable = QueryUtil.compoundQueryable(queryable1, queryable2);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
IQueryResult queryResult = cQueryable.query(greatestNumberQuery, monitor);
assertEquals("1.0", 1, AbstractProvisioningTest.queryResultSize(queryResult));
@@ -198,9 +197,9 @@ public class CompoundQueryableTest extends TestCase {
}
public void testCompoundMatchAndQuery() {
- CompoundQueryable cQueryable = new CompoundQueryable(queryable1, queryable2);
+ IQueryable cQueryable = QueryUtil.compoundQueryable(queryable1, queryable2);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
- IQueryResult queryResult = cQueryable.query(CompoundQuery.createCompoundQuery(new IQuery[] {matchQuery, matchMod4query}, true), monitor);
+ IQueryResult queryResult = cQueryable.query(QueryUtil.createCompoundQuery(matchQuery, matchMod4query, true), monitor);
assertEquals("1.0", 3, AbstractProvisioningTest.queryResultSize(queryResult));
AbstractProvisioningTest.assertContains("1.2", queryResult, 4);
AbstractProvisioningTest.assertContains("1.4", queryResult, 8);
@@ -208,9 +207,9 @@ public class CompoundQueryableTest extends TestCase {
}
public void testCompoundMatchOrQuery() {
- CompoundQueryable cQueryable = new CompoundQueryable(queryable1, queryable2);
+ IQueryable cQueryable = QueryUtil.compoundQueryable(queryable1, queryable2);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
- IQueryResult queryResult = cQueryable.query(CompoundQuery.createCompoundQuery(new IQuery[] {matchQuery, matchMod4query}, false), monitor);
+ IQueryResult queryResult = cQueryable.query(QueryUtil.createCompoundQuery(matchQuery, matchMod4query, false), monitor);
assertEquals("1.0", 6, AbstractProvisioningTest.queryResultSize(queryResult));
AbstractProvisioningTest.assertContains("1.2", queryResult, 2);
AbstractProvisioningTest.assertContains("1.2", queryResult, 4);
@@ -221,7 +220,7 @@ public class CompoundQueryableTest extends TestCase {
}
public void testMatchQueryProgressMonitor() {
- CompoundQueryable cQueryable = new CompoundQueryable(queryable1, queryable2);
+ IQueryable cQueryable = QueryUtil.compoundQueryable(queryable1, queryable2);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
cQueryable.query(matchQuery, monitor);
assertTrue("1.0", monitor.isDone());
@@ -229,7 +228,7 @@ public class CompoundQueryableTest extends TestCase {
}
public void testSingleQueryableProgressMonitor() {
- CompoundQueryable cQueryable = new CompoundQueryable(Arrays.asList(queryable1));
+ IQueryable cQueryable = QueryUtil.compoundQueryable(Arrays.asList(queryable1));
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
cQueryable.query(matchQuery, monitor);
assertTrue("1.0", monitor.isDone());
@@ -237,7 +236,7 @@ public class CompoundQueryableTest extends TestCase {
}
public void testSingleContextQueryProgressMonitor() {
- CompoundQueryable cQueryable = new CompoundQueryable(Arrays.asList(queryable1));
+ IQueryable cQueryable = QueryUtil.compoundQueryable(Arrays.asList(queryable1));
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
cQueryable.query(greatestNumberQuery, monitor);
assertTrue("1.0", monitor.isDone());
@@ -245,7 +244,7 @@ public class CompoundQueryableTest extends TestCase {
}
public void testMultipleContextQueriesProgressMonitor() {
- CompoundQueryable cQueryable = new CompoundQueryable(queryable1, queryable2);
+ IQueryable cQueryable = QueryUtil.compoundQueryable(queryable1, queryable2);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
cQueryable.query(greatestNumberQuery, monitor);
assertTrue("1.0", monitor.isDone());
@@ -253,17 +252,17 @@ public class CompoundQueryableTest extends TestCase {
}
public void testNullProgressMonitor() {
- CompoundQueryable cQueryable = new CompoundQueryable(queryable1, queryable2);
+ IQueryable cQueryable = QueryUtil.compoundQueryable(queryable1, queryable2);
cQueryable.query(greatestNumberQuery, null);
// this is the same as above will null passed in, this should not throw any exceptions
}
public void testDoubleCompoundContextOrQuery() {
- CompoundQueryable cQueryable1 = new CompoundQueryable(queryable3, queryable2);
- CompoundQueryable cQueryable = new CompoundQueryable(cQueryable1, queryable1);
+ IQueryable cQueryable1 = QueryUtil.compoundQueryable(queryable3, queryable2);
+ IQueryable cQueryable = QueryUtil.compoundQueryable(cQueryable1, queryable1);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
- IQueryResult queryResult = cQueryable.query(CompoundQuery.createCompoundQuery(new IQuery[] {contextQuery, greatestNumberQuery}, false), monitor);
+ IQueryResult queryResult = cQueryable.query(QueryUtil.createCompoundQuery(contextQuery, greatestNumberQuery, false), monitor);
assertEquals("1.0", 7, AbstractProvisioningTest.queryResultSize(queryResult));
AbstractProvisioningTest.assertContains("1.2", queryResult, 2);
AbstractProvisioningTest.assertContains("1.2", queryResult, 4);
@@ -277,10 +276,10 @@ public class CompoundQueryableTest extends TestCase {
}
public void testDoubleCompositeQuery() {
- CompoundQueryable cQueryable1 = new CompoundQueryable(queryable3, queryable2);
- CompoundQueryable cQueryable = new CompoundQueryable(cQueryable1, queryable1);
+ IQueryable cQueryable1 = QueryUtil.compoundQueryable(queryable3, queryable2);
+ IQueryable cQueryable = QueryUtil.compoundQueryable(cQueryable1, queryable1);
CompoundQueryTestProgressMonitor monitor = new CompoundQueryTestProgressMonitor();
- IQueryResult queryResult = cQueryable.query(PipedQuery.createPipe(contextQuery, greatestNumberQuery), monitor);
+ IQueryResult queryResult = cQueryable.query(QueryUtil.createPipeQuery(contextQuery, greatestNumberQuery), monitor);
assertEquals("1.0", 1, AbstractProvisioningTest.queryResultSize(queryResult));
AbstractProvisioningTest.assertContains("1.2", queryResult, 12);
assertTrue("1.0", monitor.isDone());
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ContextQuery.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ContextQuery.java
index adaebd75d..11d0d9643 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ContextQuery.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ContextQuery.java
@@ -9,10 +9,10 @@
******************************************************************************/
package org.eclipse.equinox.p2.tests.core;
-import org.eclipse.equinox.p2.query.*;
-
import java.util.Iterator;
import org.eclipse.equinox.p2.metadata.expression.IExpression;
+import org.eclipse.equinox.p2.query.IQuery;
+import org.eclipse.equinox.p2.query.IQueryResult;
/**
* ContextQuery is the abstract superclass for Queries that require the entire
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/QueryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/QueryTest.java
index c6977d762..428d423b1 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/QueryTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/QueryTest.java
@@ -10,11 +10,10 @@
*******************************************************************************/
package org.eclipse.equinox.p2.tests.core;
-import org.eclipse.equinox.internal.p2.metadata.query.MatchQuery;
-
import java.util.Arrays;
import java.util.List;
import junit.framework.TestCase;
+import org.eclipse.equinox.internal.p2.metadata.query.MatchQuery;
import org.eclipse.equinox.p2.query.*;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
@@ -57,7 +56,7 @@ public class QueryTest extends TestCase {
public void testLimitQuery() {
List items = Arrays.asList("red", "green", "blue");
IQuery query = new AnyStringQuery();
- IQuery limitQuery = new LimitQuery(query, 1);
+ IQuery limitQuery = QueryUtil.createLimitQuery(query, 1);
IQueryResult collector = limitQuery.perform(items.iterator());
assertEquals("1.0", 1, AbstractProvisioningTest.queryResultSize(collector));
AbstractProvisioningTest.assertContains("1.1", collector, "red");
@@ -66,7 +65,7 @@ public class QueryTest extends TestCase {
public void testLimitQuery2() {
List items = Arrays.asList("red", "green", "blue");
IQuery query = new AnyStringQuery();
- IQuery limitQuery = new LimitQuery(query, 2);
+ IQuery limitQuery = QueryUtil.createLimitQuery(query, 2);
IQueryResult collector = limitQuery.perform(items.iterator());
assertEquals("1.0", 2, AbstractProvisioningTest.queryResultSize(collector));
AbstractProvisioningTest.assertContains("1.1", collector, "red");
@@ -76,7 +75,7 @@ public class QueryTest extends TestCase {
public void testLimitQuery3() {
List items = Arrays.asList("red", "green", "blue");
IQuery query = new AnyStringQuery();
- IQuery limitQuery = new LimitQuery(query, 3);
+ IQuery limitQuery = QueryUtil.createLimitQuery(query, 3);
IQueryResult collector = limitQuery.perform(items.iterator());
assertEquals("1.0", 3, AbstractProvisioningTest.queryResultSize(collector));
AbstractProvisioningTest.assertContains("1.1", collector, "red");
@@ -87,7 +86,7 @@ public class QueryTest extends TestCase {
public void testLimitQuery0() {
List items = Arrays.asList("red", "green", "blue");
IQuery query = new AnyStringQuery();
- IQuery limitQuery = new LimitQuery(query, 0);
+ IQuery limitQuery = QueryUtil.createLimitQuery(query, 0);
IQueryResult collector = limitQuery.perform(items.iterator());
assertEquals("1.0", 0, AbstractProvisioningTest.queryResultSize(collector));
}
@@ -102,7 +101,7 @@ public class QueryTest extends TestCase {
// }
// };
// IQuery pipedQuery = new PipedQuery(new IQuery[] {anyString, containsI});
- // IQuery limitQuery = new LimitQuery(pipedQuery, 1);
+ // IQuery limitQuery = LimitQuery.create(pipedQuery, 1);
// Collector collector = limitQuery.perform(items.iterator(), new Collector());
// Collection result = collector.toCollection();
// assertEquals("1.0", 1, result.size());

Back to the top