Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rapicault2010-01-13 17:29:41 +0000
committerPascal Rapicault2010-01-13 17:29:41 +0000
commit18189f0d42f7375660762dc6c885cf31683ae562 (patch)
tree17775d847bed9a33f3c68b74db2df75a2139c0bc /bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf
parentc363f2984a09b73c422e38f4556fd3b23eafe958 (diff)
downloadrt.equinox.p2-18189f0d42f7375660762dc6c885cf31683ae562.tar.gz
rt.equinox.p2-18189f0d42f7375660762dc6c885cf31683ae562.tar.xz
rt.equinox.p2-18189f0d42f7375660762dc6c885cf31683ae562.zip
Merging api branch back to HEADv20100113
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf')
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/MetadataRepositoryPerformanceTest.java69
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/ProvisioningPerformanceTest.java31
-rw-r--r--bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/PublisherPerformanceTest.java53
3 files changed, 153 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/MetadataRepositoryPerformanceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/MetadataRepositoryPerformanceTest.java
new file mode 100644
index 000000000..fcda75acc
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/MetadataRepositoryPerformanceTest.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * 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 java.io.File;
+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.query.IQuery;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
+
+/**
+ * Performance tests for metadata repositories
+ */
+public class MetadataRepositoryPerformanceTest extends ProvisioningPerformanceTest {
+ private static final int REPEATS = 5;
+ protected File repoLocation;
+ IMetadataRepository repository;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ String tempDir = System.getProperty("java.io.tmpdir");
+ repoLocation = new File(tempDir, "MetadataRepositoryPerformanceTest");
+ delete(repoLocation);
+ repoLocation.mkdir();
+ IMetadataRepositoryManager manager = getMetadataRepositoryManager();
+ repository = manager.createRepository(repoLocation.toURI(), "TestRepo", IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, null);
+ }
+
+ protected void tearDown() throws Exception {
+ getMetadataRepositoryManager().removeRepository(repoLocation.toURI());
+ delete(repoLocation);
+ super.tearDown();
+ }
+
+ public void testQueryLocalRepository() {
+ final int IU_COUNT = 3000;
+ new PerformanceTestRunner() {
+ IQuery[] queries = new IQuery[IU_COUNT];
+
+ protected void setUp() {
+ IInstallableUnit[] ius = new IInstallableUnit[IU_COUNT];
+ for (int i = 0; i < ius.length; i++) {
+ ius[i] = generateIU(i);
+ queries[i] = new InstallableUnitQuery(ius[i].getId(), ius[i].getVersion());
+ }
+ repository.addInstallableUnits(ius);
+ }
+
+ protected void tearDown() {
+ }
+
+ protected void test() {
+ for (int i = 0; i < queries.length; i++) {
+ repository.query(queries[i], null);
+ }
+ }
+ }.run(this, "Test query local metadata repo for " + IU_COUNT + " ius", REPEATS, 10);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/ProvisioningPerformanceTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/ProvisioningPerformanceTest.java
new file mode 100644
index 000000000..cec1ec4e8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/perf/ProvisioningPerformanceTest.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * 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.equinox.p2.metadata.Version;
+
+import org.eclipse.equinox.internal.provisional.p2.metadata.MetadataFactory;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.tests.AbstractProvisioningTest;
+
+/**
+ *
+ */
+public class ProvisioningPerformanceTest extends AbstractProvisioningTest {
+
+ protected IInstallableUnit generateIU(int i) {
+ MetadataFactory.InstallableUnitDescription desc = new MetadataFactory.InstallableUnitDescription();
+ desc.setId("org.eclipse.someiu" + i);
+ desc.setVersion(Version.createOSGi(1, 1, i));
+ return MetadataFactory.createInstallableUnit(desc);
+ }
+
+}
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);
+
+ }
+}

Back to the top