diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java')
-rw-r--r-- | bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java index 1bc399980..f84d2418f 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/ant/Repo2RunnableTaskTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2010 IBM Corporation and others. + * Copyright (c) 2009, 2013 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 @@ -7,10 +7,11 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Red Hat, Inc. - fragments support added. *******************************************************************************/ package org.eclipse.equinox.p2.tests.ant; -import java.io.File; +import java.io.*; import java.net.URI; import java.util.Iterator; import org.eclipse.core.runtime.NullProgressMonitor; @@ -53,6 +54,25 @@ public class Repo2RunnableTaskTests extends AbstractAntProvisioningTest { assertTrue("Unexpected format", expectedFormat(destination)); } + public void testRepo2RunnableFragments() throws IOException { + createRepo2RunnableTaskElementFragments(TYPE_BOTH); + + runAntTask(); + assertEquals("Number of artifact keys differs", getArtifactKeyCount(source), getArtifactKeyCount(destination)); + assertTrue("Unexpected format", expectedFormat(destination)); + File f = new File(destination); + assertTrue("Missing content.jar", new File(f, "content.jar").exists()); + assertTrue("Missing artifacts.jar", new File(f, "artifacts.jar").exists()); + assertTrue("Missing artifacts.jar", new File(f, "fragment.profile").exists()); + assertTrue("Missing artifacts.jar", new File(f, "fragment.info").exists()); + BufferedReader br = new BufferedReader(new FileReader(new File(f, "fragment.profile"))); + while (br.ready()) + System.out.println(br.readLine()); + br = new BufferedReader(new FileReader(new File(f, "fragment.info"))); + while (br.ready()) + System.out.println(br.readLine()); + } + /* * Test that when an IU is specified that it is used */ @@ -157,4 +177,20 @@ public class Repo2RunnableTaskTests extends AbstractAntProvisioningTest { return task; } + + protected AntTaskElement createRepo2RunnableTaskElementFragments(String type) { + AntTaskElement task = createRepo2RunnableTaskElement(); + task.addElement(getRepositoryElement(destination, type)); + + AntTaskElement sourceElement = new AntTaskElement("source"); + sourceElement.addElement(getRepositoryElement(source, type)); + task.addElement(sourceElement); + + // AntTaskElement fragmentsElement = new AntTaskElement("createFragments"); + // fragmentsElement.a + // task.addElement(fragmentsElement); + + task.addAttribute("createFragments", "true"); + return task; + } } |