diff options
author | DJ Houghton | 2008-09-23 19:52:32 +0000 |
---|---|---|
committer | DJ Houghton | 2008-09-23 19:52:32 +0000 |
commit | 11eaeb97b3974499fcf7a6e1011dfcd4b4409247 (patch) | |
tree | bfc05c26991f43379fc176db686ee60449567ce4 /bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/FeaturePatchTest.java | |
parent | 25673cfc28a5d4a848ae060ba472a53d6b8c4caa (diff) | |
download | rt.equinox.p2-11eaeb97b3974499fcf7a6e1011dfcd4b4409247.tar.gz rt.equinox.p2-11eaeb97b3974499fcf7a6e1011dfcd4b4409247.tar.xz rt.equinox.p2-11eaeb97b3974499fcf7a6e1011dfcd4b4409247.zip |
Bug 223506 - Need to improve reconciler tests
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/FeaturePatchTest.java')
-rw-r--r-- | bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/FeaturePatchTest.java | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/FeaturePatchTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/FeaturePatchTest.java new file mode 100644 index 000000000..d09f542d6 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/reconciler/dropins/FeaturePatchTest.java @@ -0,0 +1,98 @@ +/******************************************************************************* + * Copyright (c) 2008 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.reconciler.dropins; + +import java.io.File; +import junit.framework.Test; +import junit.framework.TestSuite; + +/* + * Test suite for feature patches. + */ +public class FeaturePatchTest extends AbstractReconcilerTest { + + public FeaturePatchTest(String name) { + super(name); + } + + /* + * The list of tests for this class. Order is important since some of them rely + * on the state from the previous test run. + */ + public static Test suite() { + TestSuite suite = new ReconcilerTestSuite(); + suite.addTest(new FeaturePatchTest("testPatchingDroppedInFeature")); + suite.addTest(new FeaturePatchTest("testAddBundle")); + return suite; + } + + /* + * Test the case where we have a feature in the drop-ins folder and then + * we try and apply a feature patch to it. + */ + public void testPatchingDroppedInFeature() { + // copy the feature into the dropins folder + File file = getTestData("1.0", "testData/reconciler/features/myFeature_1.0.0"); + add("1.1", "dropins/features", file); + file = getTestData("1.2", "testData/reconciler/plugins/myBundle_1.0.0.jar"); + add("1.3", "dropins/plugins", file); + // reconcile + reconcile("1.4"); + // check all is good + assertExistsInBundlesInfo("1.5", "myBundle", "1.0.0"); + + // copy the patch into the dropins folder + file = getTestData("2.0", "testData/reconciler/features/myFeaturePatch_2.0.0"); + add("2.1", "dropins/features", file); + file = getTestData("2.2", "testData/reconciler/plugins/myBundle_2.0.0.jar"); + add("2.3", "dropins/plugins", file); + // reconcile + reconcile("2.4"); + // check all is good + assertExistsInBundlesInfo("2.5", "myBundle", "1.0.0"); + assertExistsInBundlesInfo("2.6", "myBundle", "2.0.0"); + + // cleanup + remove("3.0", "dropins/features", "myFeature_1.0.0"); + remove("3.1", "dropins/plugins", "myBundle_1.0.0.jar"); + remove("3.2", "dropins/features", "myFeaturePatch_2.0.0"); + remove("3.3", "dropins/plugins", "myBundle_2.0.0.jar"); + assertDoesNotExistInBundlesInfo("3.4", "myBundle"); + } + + /* + * Test the case where the feature patch adds a new bundle (with a new id) to the system. + */ + public void testAddBundle() { + File file = getTestData("1.0", "testData/reconciler/features/myFeature_1.0.0"); + add("1.1", "dropins/features", file); + file = getTestData("1.2", "testData/reconciler/plugins/myBundle_1.0.0.jar"); + add("1.3", "dropins/plugins", file); + reconcile("1.4"); + assertExistsInBundlesInfo("1.5", "myBundle", "1.0.0"); + + file = getTestData("2.0", "testData/reconciler/features/myFeaturePatch_1.0.0"); + add("2.1", "dropins/features", file); + file = getTestData("2.2", "testData/reconciler/plugins/mySingletonBundle_1.0.0.jar"); + add("2.3", "dropins/plugins", file); + reconcile("2.4"); + assertExistsInBundlesInfo("2.5", "myBundle", "1.0.0"); + assertExistsInBundlesInfo("2.6", "mySingletonBundle", "1.0.0"); + + remove("3.0", "dropins/features", "myFeature_1.0.0"); + remove("3.1", "dropins/plugins", "myBundle_1.0.0.jar"); + remove("3.2", "dropins/features", "myFeaturePatch_1.0.0"); + remove("3.3", "dropins/plugins", "mySingletonBundle_1.0.0.jar"); + assertDoesNotExistInBundlesInfo("3.4", "myBundle"); + assertDoesNotExistInBundlesInfo("3.5", "mySingletonBundle"); + } + +} |