### Eclipse Workspace Patch 1.0 #P org.eclipse.equinox.p2.tests Index: src/org/eclipse/equinox/p2/tests/mirror/MetadataMirrorApplicationTest.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/MetadataMirrorApplicationTest.java,v retrieving revision 1.7 diff -u -r1.7 MetadataMirrorApplicationTest.java --- src/org/eclipse/equinox/p2/tests/mirror/MetadataMirrorApplicationTest.java 16 Oct 2008 01:37:52 -0000 1.7 +++ src/org/eclipse/equinox/p2/tests/mirror/MetadataMirrorApplicationTest.java 27 Oct 2008 17:28:29 -0000 @@ -11,8 +11,7 @@ package org.eclipse.equinox.p2.tests.mirror; import java.io.File; -import java.net.URI; -import java.net.URL; +import java.net.*; import java.util.HashMap; import java.util.Map; import org.eclipse.equinox.app.IApplicationContext; @@ -795,4 +794,62 @@ fail("25.5", e); } } + + //for Bug 235683 + public void testMirrorCompressedSource() { + File compressedSource = getTestData("0", "/testData/mirror/mirrorCompressedRepo"); + + //Setup: get the content.jar file + File compressedMetadataXML = new File(compressedSource.getAbsoluteFile() + "/content.jar"); + //Setup: make sure content.jar exists + assertTrue("1", compressedMetadataXML.exists()); + + try { + basicRunMirrorApplication("2", compressedSource.toURL(), destRepoLocation.toURL(), false); + } catch (MalformedURLException e) { + fail("3", e); + } catch (Exception e) { + fail("4", e); + } + + //get the content.jar file + File destMetadataXML = new File(destRepoLocation.getAbsolutePath() + "/content.jar"); + //make sure content.jar exists + assertTrue("5", destMetadataXML.exists()); + } + + //for Bug 235683 + public void testMirrorCompressedSourcetoUncompressedDestination() { + File compressedSource = getTestData("0", "/testData/mirror/mirrorCompressedRepo"); + + //Setup: get the content.jar file + File compressedMetadataXML = new File(compressedSource.getAbsoluteFile() + "/content.jar"); + //Setup: make sure content.jar exists + assertTrue("1", compressedMetadataXML.exists()); + + //Setup: create the destination + String name = "Destination Name"; + try { + getManager().createRepository(destRepoLocation.toURI(), name, IMetadataRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); + } catch (ProvisionException e) { + fail("2", e); + } + + try { + basicRunMirrorApplication("3", compressedSource.toURL(), destRepoLocation.toURL(), false); + } catch (MalformedURLException e) { + fail("4", e); + } catch (Exception e) { + fail("5", e); + } + + //get the content.jar file + File destMetadataXML = new File(destRepoLocation.getAbsolutePath() + "/content.jar"); + //make sure content.jar does not exist + assertTrue("6", !destMetadataXML.exists()); + //get the content.xml file + destMetadataXML = new File(destRepoLocation.getAbsolutePath() + "/content.xml"); + //make sure content.xml exists + assertTrue("7", destMetadataXML.exists()); + } } Index: src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java =================================================================== RCS file: /cvsroot/rt/org.eclipse.equinox/p2/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java,v retrieving revision 1.9 diff -u -r1.9 ArtifactMirrorApplicationTest.java --- src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java 16 Oct 2008 01:37:52 -0000 1.9 +++ src/org/eclipse/equinox/p2/tests/mirror/ArtifactMirrorApplicationTest.java 27 Oct 2008 17:28:29 -0000 @@ -11,8 +11,7 @@ package org.eclipse.equinox.p2.tests.mirror; import java.io.*; -import java.net.URI; -import java.net.URL; +import java.net.*; import java.util.*; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.equinox.app.IApplicationContext; @@ -834,7 +833,7 @@ } /** - * Verifies that the mirror application executes processign steps correctly + * Verifies that the mirror application executes processing steps correctly */ public void testArtifactProcessingSteps() { //Setup: load the repository containing packed data @@ -899,4 +898,62 @@ } } } + + //for Bug 235683 + public void testMirrorCompressedSource() { + File compressedSource = getTestData("0", "/testData/mirror/mirrorCompressedRepo"); + + //Setup: get the artifacts.jar file + File compressedArtifactsXML = new File(compressedSource.getAbsoluteFile() + "/artifacts.jar"); + //Setup: make sure artifacts.jar exists + assertTrue("1", compressedArtifactsXML.exists()); + + try { + basicRunMirrorApplication("2", compressedSource.toURL(), destRepoLocation.toURL(), false); + } catch (MalformedURLException e) { + fail("3", e); + } catch (Exception e) { + fail("4", e); + } + + //get the artifacts.jar file + File destArtifactsXML = new File(destRepoLocation.getAbsolutePath() + "/artifacts.jar"); + //make sure artifacts.jar exists + assertTrue("5", destArtifactsXML.exists()); + } + + //for Bug 235683 + public void testMirrorCompressedSourcetoUncompressedDestination() { + File compressedSource = getTestData("0", "/testData/mirror/mirrorCompressedRepo"); + + //Setup: get the artifacts.jar file + File compressedArtifactsXML = new File(compressedSource.getAbsoluteFile() + "/artifacts.jar"); + //Setup: make sure artifacts.jar exists + assertTrue("1", compressedArtifactsXML.exists()); + + //Setup: create the destination + String name = "Destination Name"; + try { + getManager().createRepository(destRepoLocation.toURI(), name, IArtifactRepositoryManager.TYPE_SIMPLE_REPOSITORY, null); + } catch (ProvisionException e) { + fail("2", e); + } + + try { + basicRunMirrorApplication("3", compressedSource.toURL(), destRepoLocation.toURL(), false); + } catch (MalformedURLException e) { + fail("4", e); + } catch (Exception e) { + fail("5", e); + } + + //get the artifacts.jar file + File destArtifactsXML = new File(destRepoLocation.getAbsolutePath() + "/artifacts.jar"); + //make sure artifacts.jar does not exist + assertTrue("6", !destArtifactsXML.exists()); + //get the artifacts.xml file + destArtifactsXML = new File(destRepoLocation.getAbsolutePath() + "/artifacts.xml"); + //make sure artifacts.xml exists + assertTrue("7", destArtifactsXML.exists()); + } }