Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 237811 Details for
Bug 422776
Bundle is still unpacked although it specifies Eclipse-BundleShap: jar while "unpack" is not specifies at all in the feature
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Attached a test class to test the behavior
FeatureUnpackActionTest.java (text/java), 5.12 KB, created by
Michael Adada
on 2013-11-28 10:42:16 EST
(
hide
)
Description:
Attached a test class to test the behavior
Filename:
MIME Type:
Creator:
Michael Adada
Created:
2013-11-28 10:42:16 EST
Size:
5.12 KB
patch
obsolete
>/******************************************************************************* > * Copyright (c) 2008, 2012 Code 9 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: > * Code 9 - initial API and implementation > * IBM - ongoing development > * SAP AG - ongoing development > ******************************************************************************/ >package org.eclipse.equinox.p2.tests.publisher.actions; > >import java.io.File; >import java.util.Dictionary; >import java.util.Properties; >import junit.framework.TestCase; >import org.eclipse.core.runtime.NullProgressMonitor; >import org.eclipse.equinox.p2.metadata.*; >import org.eclipse.equinox.p2.publisher.*; >import org.eclipse.equinox.p2.publisher.eclipse.*; >import org.eclipse.osgi.service.resolver.BundleDescription; > >public class FeatureUnpackActionTest extends TestCase { > > private PublisherInfo publisherInfo; > private PublisherResult publisherResult; > > public void setUp() throws Exception { > publisherInfo = new PublisherInfo(); > publisherResult = new PublisherResult(); > } > > public void testFeaturesUnpackedBundleJar() throws Exception { > IInstallableUnit iu = processFeaturesAndBundles(true, IBundleShapeAdvice.JAR); > assertTrue("the 'zipped' p2 instruction should be set to 'true'", isZippedInstructionExists(iu)); > } > > public void testFeaturesUnpackedBundleDir() throws Exception { > IInstallableUnit iu = processFeaturesAndBundles(true, IBundleShapeAdvice.DIR); > assertTrue("the 'zipped' p2 instruction should be set to 'true'", isZippedInstructionExists(iu)); > } > > public void testFeaturesUnpackedBundleNone() throws Exception { > IInstallableUnit iu = processFeaturesAndBundles(true, null); > assertTrue("the 'zipped' p2 instruction should be set to 'true'", isZippedInstructionExists(iu)); > } > > public void testFeaturesPackedBundleJar() throws Exception { > IInstallableUnit iu = processFeaturesAndBundles(false, IBundleShapeAdvice.JAR); > assertFalse("the 'zipped' p2 instruction should not exist", isZippedInstructionExists(iu)); > } > > public void testFeaturesPackedBundleDir() throws Exception { > IInstallableUnit iu = processFeaturesAndBundles(false, IBundleShapeAdvice.DIR); > assertFalse("the 'zipped' p2 instruction should not exist", isZippedInstructionExists(iu)); > } > > public void testFeaturesPackedBundleNone() throws Exception { > IInstallableUnit iu = processFeaturesAndBundles(false, null); > assertFalse("the 'zipped' p2 instruction should not exist", isZippedInstructionExists(iu)); > } > > public void testFeaturesNoneBundleJar() throws Exception { > IInstallableUnit iu = processFeaturesAndBundles(null, IBundleShapeAdvice.JAR); > assertFalse("the 'zipped' p2 instruction should not exist", isZippedInstructionExists(iu)); > } > > public void testFeaturesNoneBundleDir() throws Exception { > IInstallableUnit iu = processFeaturesAndBundles(null, IBundleShapeAdvice.DIR); > assertTrue("the 'zipped' p2 instruction should be set to 'true'", isZippedInstructionExists(iu)); > } > > public void testFeaturesNoneBundleNone() throws Exception { > IInstallableUnit iu = processFeaturesAndBundles(null, null); > assertTrue("the 'zipped' p2 instruction should be set to 'true'", isZippedInstructionExists(iu)); > } > > private IInstallableUnit processFeaturesAndBundles(Boolean featureUnpack, String eclipseBundleShape) { > Feature feature = new Feature("com.feature.shape.test", "1.0.0"); > feature.setLocation(System.getProperty("java.io.tmpdir") + "/feature"); > > FeatureEntry featureEntry = new FeatureEntry("com.plugin.shape.test", "1.0.0", true); > if (featureUnpack != null) { > featureEntry.setUnpack(featureUnpack); > } > feature.addEntry(featureEntry); > FeaturesAction featuresAction = new FeaturesAction(new Feature[] {feature}); > > featuresAction.perform(publisherInfo, publisherResult, new NullProgressMonitor()); > > Dictionary mockManifest = new Properties(); > mockManifest.put("Manifest-Version", "1.0"); //$NON-NLS-1$ //$NON-NLS-2$ > mockManifest.put("Bundle-ManifestVersion", "2"); //$NON-NLS-1$ //$NON-NLS-2$ > mockManifest.put("Bundle-SymbolicName", "com.plugin.shape.test"); //$NON-NLS-1$ > mockManifest.put("Bundle-Version", "1.0.0"); //$NON-NLS-1$ > if (eclipseBundleShape != null) { > mockManifest.put("Eclipse-BundleShape", eclipseBundleShape); //$NON-NLS-1$ > } > > BundleDescription bundleDescription = BundlesAction.createBundleDescription(mockManifest, new File(System.getProperty("java.io.tmpdir") + "/plugin")); > BundlesAction bundlesAction = new BundlesAction(new BundleDescription[] {bundleDescription}); > > bundlesAction.perform(publisherInfo, publisherResult, new NullProgressMonitor()); > > return publisherResult.getIU("com.plugin.shape.test", Version.createOSGi(1, 0, 0), IPublisherResult.ROOT); > } > > private boolean isZippedInstructionExists(IInstallableUnit iu) { > for (ITouchpointData data : iu.getTouchpointData()) { > ITouchpointInstruction instruction = data.getInstruction("zipped"); > if (instruction != null) { > return Boolean.valueOf(instruction.getBody()); > } > } > return false; > } >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 422776
:
237809
|
237810
| 237811