diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/PublisherPerformanceTest.java')
-rw-r--r-- | bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/PublisherPerformanceTest.java | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/PublisherPerformanceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/PublisherPerformanceTest.java new file mode 100644 index 000000000..a1a1c5eac --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/PublisherPerformanceTest.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2009 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 + *******************************************************************************/ +package org.eclipse.equinox.p2.tests.perf; + +import org.eclipse.core.tests.harness.PerformanceTestRunner; +import org.eclipse.equinox.p2.metadata.IInstallableUnit; +import org.eclipse.equinox.p2.metadata.query.InstallableUnitQuery; +import org.eclipse.equinox.p2.publisher.IPublisherResult; +import org.eclipse.equinox.p2.publisher.PublisherResult; +import org.eclipse.equinox.p2.query.IQuery; + +/** + * Performance tests for the p2 publisher + */ +public class PublisherPerformanceTest extends ProvisioningPerformanceTest { + private static final int REPEATS = 5; + + public void testQueryPublisherResult() { + final int IU_COUNT = 3000; + new PerformanceTestRunner() { + IQuery[] queries = new IQuery[IU_COUNT]; + PublisherResult result; + + protected void setUp() { + IInstallableUnit[] ius = new IInstallableUnit[IU_COUNT]; + result = new PublisherResult(); + for (int i = 0; i < ius.length; i++) { + ius[i] = generateIU(i); + result.addIU(ius[i], IPublisherResult.ROOT); + queries[i] = new InstallableUnitQuery(ius[i].getId(), ius[i].getVersion()); + } + } + + protected void tearDown() { + } + + protected void test() { + for (int i = 0; i < queries.length; i++) { + result.query(queries[i], null); + } + } + }.run(this, "Test query PublisherResult for " + IU_COUNT + " ius", REPEATS, 10); + + } +} |