Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
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.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/BackupTest.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CollectorTest.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/CompoundQueryableTest.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/ContextQuery.java20
5 files changed, 50 insertions, 24 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 647ec941a..7a0b61c2a 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
@@ -1,5 +1,5 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 EclipseSource and others. All rights reserved. This
+/*******************************************************************************
+* Copyright (c) 2009, 2017 EclipseSource and others. All rights reserved. This
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -9,8 +9,6 @@
******************************************************************************/
package org.eclipse.equinox.p2.tests.core;
-import org.eclipse.equinox.p2.query.MatchQuery;
-
import java.util.*;
import junit.framework.TestCase;
import org.eclipse.equinox.p2.query.*;
@@ -18,7 +16,7 @@ import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
/**
* This tests both Compound and Composite queries
- *
+ *
*/
public class AggregateQueryTest extends TestCase {
@@ -40,6 +38,7 @@ public class AggregateQueryTest extends TestCase {
public void testSymmetry() {
IQuery getLatest = new ContextQuery() {
+ @Override
public Collector perform(Iterator iterator) {
Collector result = new Collector();
List list = new ArrayList();
@@ -54,6 +53,7 @@ public class AggregateQueryTest extends TestCase {
IQuery getAllBut3 = new ContextQuery() {
+ @Override
public Collector perform(Iterator iterator) {
Collector result = new Collector();
while (iterator.hasNext()) {
@@ -90,6 +90,7 @@ public class AggregateQueryTest extends TestCase {
public void testNonSymmetry() {
IQuery getLatest = new ContextQuery() {
+ @Override
public Collector perform(Iterator iterator) {
Collector result = new Collector();
List list = new ArrayList();
@@ -104,6 +105,7 @@ public class AggregateQueryTest extends TestCase {
IQuery getAllBut3 = new ContextQuery() {
+ @Override
public Collector perform(Iterator iterator) {
Collector result = new Collector();
@@ -129,6 +131,7 @@ public class AggregateQueryTest extends TestCase {
public void testIntersection() {
IQuery ABC = new MatchQuery() {
+ @Override
public boolean isMatch(Object candidate) {
if (candidate.equals("A") || candidate.equals("B") || candidate.equals("C"))
return true;
@@ -137,6 +140,7 @@ public class AggregateQueryTest extends TestCase {
};
IQuery BCDE = new MatchQuery() {
+ @Override
public boolean isMatch(Object candidate) {
if (candidate.equals("B") || candidate.equals("C") || candidate.equals("D") || candidate.equals("E"))
return true;
@@ -153,6 +157,7 @@ public class AggregateQueryTest extends TestCase {
public void testIntersection2() {
IQuery ABC = new ContextQuery() {
+ @Override
public Collector perform(Iterator iterator) {
Collector result = new Collector();
while (iterator.hasNext()) {
@@ -165,6 +170,7 @@ public class AggregateQueryTest extends TestCase {
};
IQuery BCDE = new ContextQuery() {
+ @Override
public Collector perform(Iterator iterator) {
Collector result = new Collector();
while (iterator.hasNext()) {
@@ -185,6 +191,7 @@ public class AggregateQueryTest extends TestCase {
public void testUnion() {
IQuery ABC = new MatchQuery() {
+ @Override
public boolean isMatch(Object candidate) {
if (candidate.equals("A") || candidate.equals("B") || candidate.equals("C"))
return true;
@@ -193,6 +200,7 @@ public class AggregateQueryTest extends TestCase {
};
IQuery BCDE = new MatchQuery() {
+ @Override
public boolean isMatch(Object candidate) {
if (candidate.equals("B") || candidate.equals("C") || candidate.equals("D") || candidate.equals("E"))
return true;
@@ -212,6 +220,7 @@ public class AggregateQueryTest extends TestCase {
public void testUnion2() {
IQuery ABC = new ContextQuery() {
+ @Override
public Collector perform(Iterator iterator) {
Collector result = new Collector();
while (iterator.hasNext()) {
@@ -224,6 +233,7 @@ public class AggregateQueryTest extends TestCase {
};
IQuery BCDE = new ContextQuery() {
+ @Override
public Collector perform(Iterator iterator) {
Collector result = new Collector();
while (iterator.hasNext()) {
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/BackupTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/BackupTest.java
index a43211702..00256f36d 100644
--- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/BackupTest.java
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/BackupTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Cloudsmith Inc. and others.
+ * Copyright (c) 2009, 2017 Cloudsmith Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -39,9 +39,10 @@ public class BackupTest extends AbstractProvisioningTest {
* </ul>
* </ul>
*/
+ @Override
public void setUp() {
// create some test files under user.home
- // do not want them under /tmp as it may be on its own file system (and even
+ // do not want them under /tmp as it may be on its own file system (and even
// be an in-memory file system).
//
String userHome = System.getProperty("user.home");
@@ -80,6 +81,7 @@ public class BackupTest extends AbstractProvisioningTest {
}
}
+ @Override
public void tearDown() {
fullyDelete(sourceDir);
}
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 c54a86c02..3b8c5b112 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
@@ -1,18 +1,16 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* EclipseSource - ongoing development
*******************************************************************************/
package org.eclipse.equinox.p2.tests.core;
-import org.eclipse.equinox.p2.query.MatchQuery;
-
import java.util.*;
import org.eclipse.equinox.p2.query.*;
import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
@@ -51,6 +49,7 @@ public class CollectorTest extends AbstractProvisioningTest {
List list = Arrays.asList(s);
IQuery numeric = new MatchQuery() {
+ @Override
public boolean isMatch(Object candidate) {
if (((String) candidate).compareTo("0") > 0 && ((String) candidate).compareTo("8") < 0) {
return true;
@@ -60,6 +59,7 @@ public class CollectorTest extends AbstractProvisioningTest {
};
IQuery fourOrFiveOrABC = new MatchQuery() {
+ @Override
public boolean isMatch(Object candidate) {
if (((String) candidate).equals("4") || ((String) candidate).equals("5") || ((String) candidate).equals("A") || ((String) candidate).equals("B") || ((String) candidate).equals("C")) {
return true;
@@ -81,6 +81,7 @@ public class CollectorTest extends AbstractProvisioningTest {
List list = Arrays.asList(s);
IQuery numeric = new MatchQuery() {
+ @Override
public boolean isMatch(Object candidate) {
if (((String) candidate).compareTo("0") > 0 && ((String) candidate).compareTo("8") < 0) {
return true;
@@ -90,6 +91,7 @@ public class CollectorTest extends AbstractProvisioningTest {
};
IQuery fourOrFiveOrABC = new MatchQuery() {
+ @Override
public boolean isMatch(Object candidate) {
if (((String) candidate).equals("4") || ((String) candidate).equals("5") || ((String) candidate).equals("A") || ((String) candidate).equals("B") || ((String) candidate).equals("C")) {
return true;
@@ -114,6 +116,7 @@ public class CollectorTest extends AbstractProvisioningTest {
List list = Arrays.asList(s);
IQuery eightOrNine = new MatchQuery() {
+ @Override
public boolean isMatch(Object candidate) {
if (((String) candidate).compareTo("8") > 0 && ((String) candidate).compareTo("9") < 0) {
return true;
@@ -123,6 +126,7 @@ public class CollectorTest extends AbstractProvisioningTest {
};
IQuery fourOrFiveOrABC = new MatchQuery() {
+ @Override
public boolean isMatch(Object candidate) {
if (((String) candidate).equals("4") || ((String) candidate).equals("5") || ((String) candidate).equals("A") || ((String) candidate).equals("B") || ((String) candidate).equals("C")) {
return true;
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 8bc3de4b1..de898fb31 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
@@ -1,5 +1,5 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 EclipseSource and others. All rights reserved. This
+/*******************************************************************************
+* Copyright (c) 2009, 2017 EclipseSource and others. All rights reserved. This
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -9,8 +9,6 @@
******************************************************************************/
package org.eclipse.equinox.p2.tests.core;
-import org.eclipse.equinox.p2.query.MatchQuery;
-
import java.util.Arrays;
import java.util.Iterator;
import junit.framework.TestCase;
@@ -30,11 +28,13 @@ public class CompoundQueryableTest extends TestCase {
private int assignedWork = 0;
private int amountWorked = 0;
+ @Override
public void beginTask(String name, int totalWork) {
super.beginTask(name, totalWork);
this.assignedWork += totalWork;
}
+ @Override
public void worked(int work) {
amountWorked += work;
}
@@ -47,6 +47,7 @@ public class CompoundQueryableTest extends TestCase {
return this.isDone;
}
+ @Override
public void done() {
super.done();
this.isDone = true;
@@ -60,6 +61,7 @@ public class CompoundQueryableTest extends TestCase {
IQueryable<Integer> queryable1 = new IQueryable<Integer>() {
Integer[] elements = new Integer[] {1, 2, 3, 4, 5};
+ @Override
public IQueryResult<Integer> query(IQuery<Integer> query, IProgressMonitor monitor) {
IQueryResult<Integer> collector;
try {
@@ -76,6 +78,7 @@ public class CompoundQueryableTest extends TestCase {
IQueryable<Integer> queryable2 = new IQueryable<Integer>() {
Integer[] elements = new Integer[] {4, 6, 8, 10, 12};
+ @Override
public IQueryResult<Integer> query(IQuery<Integer> query, IProgressMonitor monitor) {
IQueryResult<Integer> collector;
try {
@@ -92,6 +95,7 @@ public class CompoundQueryableTest extends TestCase {
IQueryable queryable3 = new IQueryable() {
Integer[] elements = new Integer[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
+ @Override
public IQueryResult query(IQuery query, IProgressMonitor monitor) {
IQueryResult collector;
try {
@@ -107,6 +111,7 @@ public class CompoundQueryableTest extends TestCase {
IQuery matchQuery = new MatchQuery() {
+ @Override
public boolean isMatch(Object candidate) {
if (candidate instanceof Integer) {
int x = ((Integer) candidate).intValue();
@@ -118,6 +123,7 @@ public class CompoundQueryableTest extends TestCase {
};
IQuery matchMod4query = new MatchQuery() {
+ @Override
public boolean isMatch(Object candidate) {
if (candidate instanceof Integer) {
int x = ((Integer) candidate).intValue();
@@ -130,6 +136,7 @@ public class CompoundQueryableTest extends TestCase {
IQuery contextQuery = new ContextQuery() {
+ @Override
public Collector perform(Iterator iterator) {
Collector result = new Collector();
while (iterator.hasNext()) {
@@ -144,6 +151,7 @@ public class CompoundQueryableTest extends TestCase {
};
IQuery greatestNumberQuery = new ContextQuery() {
+ @Override
public Collector perform(Iterator iterator) {
Collector result = new Collector();
int greatest = Integer.MIN_VALUE;
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 061b90caf..0e403e28e 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
@@ -1,5 +1,5 @@
-/*******************************************************************************
-* Copyright (c) 2009, 2010 EclipseSource and others. All rights reserved. This
+/*******************************************************************************
+* Copyright (c) 2009, 2017 EclipseSource and others. All rights reserved. This
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -18,33 +18,35 @@ import org.eclipse.equinox.p2.query.IQueryResult;
* ContextQuery is the abstract superclass for Queries that require the entire
* input to evaluate the results. Queries must consider the group of elements before
* processing the results. <P>
- *
- * ContextQueries must also be transitive. That is, if run on a subset of the
- * input, the order in which they are executed must not matter. If there is the
+ *
+ * ContextQueries must also be transitive. That is, if run on a subset of the
+ * input, the order in which they are executed must not matter. If there is the
* need for a non-transitive query, please see:
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=261403
* <p>
- * Users of this query must call {@link #perform(Iterator)} to compute
+ * Users of this query must call {@link #perform(Iterator)} to compute
* the results. <P>
* This class may be subclassed by clients. Subclasses should specify the type
* of object they support querying on. Subclasses are also encouraged to clearly
* specify their match algorithm, and expose the parameters involved in the match
* computation, to allow {@link IQueryable} implementations to optimize their
* execution of the query. <P>
- *
+ *
* @since 2.0
*/
public abstract class ContextQuery<T> implements IQuery<T> {
/**
- * Evaluates the query for a specific input.
- *
+ * Evaluates the query for a specific input.
+ *
* @param iterator The elements for which to evaluate the query on
* @return The results of the query. The collector returned must be
* the collector passed in.
*/
+ @Override
public abstract IQueryResult<T> perform(Iterator<T> iterator);
+ @Override
public IExpression getExpression() {
return null;
}

Back to the top