diff options
3 files changed, 58 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/p2/metadata/generator/messages.properties b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/p2/metadata/generator/messages.properties index dbb853140..c0650b68c 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/p2/metadata/generator/messages.properties +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/p2/metadata/generator/messages.properties @@ -20,6 +20,6 @@ exception_metadataRepoLocationURL = Metadata repository location is not a valid exception_metadataRepoNotWritable = Metadata repository not writable: {0}. exception_metadataRepoNotSpecified = A metadata repository location was not specified. exception_baseLocationNotSpecified = Eclipse base location not specified. -exception_artifactRepoNoAppendDestroysInput== Not appending to artifact repository ({0}) will destroy input files. +exception_artifactRepoNoAppendDestroysInput = Not appending to artifact repository ({0}) will destroy input files. message_generatingMetadata = Generating metadata for {0}. message_generationCompleted = Generation completed with success [{0} seconds].
\ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/generator/AllTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/generator/AllTests.java index fd550a815..ee8f29bf7 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/generator/AllTests.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/generator/AllTests.java @@ -22,6 +22,7 @@ public class AllTests extends TestCase { suite.addTestSuite(EclipseSDK33Test.class); suite.addTestSuite(FeatureToIU.class); suite.addTestSuite(SiteParserTest.class); + suite.addTestSuite(GeneratorTests.class); return suite; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/generator/GeneratorTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/generator/GeneratorTests.java new file mode 100644 index 000000000..e4a555d9f --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/generator/GeneratorTests.java @@ -0,0 +1,56 @@ +package org.eclipse.equinox.p2.tests.generator; + +import java.io.File; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.equinox.internal.p2.metadata.generator.EclipseGeneratorApplication; +import org.eclipse.equinox.internal.p2.metadata.generator.Messages; +import org.eclipse.equinox.p2.tests.AbstractProvisioningTest; +import org.eclipse.equinox.p2.tests.TestActivator; +import org.eclipse.osgi.util.NLS; +import org.osgi.framework.BundleContext; + +public class GeneratorTests extends AbstractProvisioningTest { + + public void test233240_artifactsDeleted() throws Exception { + //this also covers 220494 + File rootFolder = getTempFolder(); + + //copy some bundles over + File plugins = new File(rootFolder, "plugins"); + plugins.mkdir(); + + for (int i = 0; i < 3; i++) { + BundleContext context = TestActivator.getContext(); + File bundle = FileLocator.getBundleFile(context.getBundle(i)); + + copy("1.0 Populating input bundles.", bundle, new File(plugins, bundle.getName())); + } + + String[] arguments = new String[] {"-metadataRepository", rootFolder.toURL().toExternalForm().toString(), "-artifactRepository", rootFolder.toURL().toExternalForm().toString(), "-source", rootFolder.getAbsolutePath(), "-publishArtifacts", "-noDefaultIUs"}; + EclipseGeneratorApplication application = new EclipseGeneratorApplication(); + application.run(arguments); + + assertTrue("2.0 - initial artifact repo existance", new File(rootFolder, "artifacts.xml").exists()); + assertTrue("2.1 - initial artifact repo contents", plugins.listFiles().length > 0); + + //Taunt you one more time + application = new EclipseGeneratorApplication(); + try { + application.run(arguments); + fail("3.0 - Expected Illegal Argument Exception not thrown."); + } catch (IllegalArgumentException e) { + assertTrue("3.0 - Expected Illegal Argument", e.getMessage().equals(NLS.bind(Messages.exception_artifactRepoNoAppendDestroysInput, rootFolder.toURL().toExternalForm().toString()))); + } + + assertTrue("3.1 - artifact repo existance", new File(rootFolder, "artifacts.xml").exists()); + + //with -updateSite + arguments = new String[] {"-metadataRepository", rootFolder.toURL().toExternalForm().toString(), "-artifactRepository", rootFolder.toURL().toExternalForm().toString(), "-updateSite", rootFolder.getAbsolutePath(), "-publishArtifacts", "-noDefaultIUs"}; + application.run(arguments); + + assertTrue("4.0 - artifact repo existance", new File(rootFolder, "artifacts.xml").exists()); + assertTrue("4.1 - artifact repo contents", plugins.listFiles().length > 0); + + delete(rootFolder); + } +} |