You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by hi...@apache.org on 2014/01/04 14:06:39 UTC
svn commit: r1555344 [2/3] - in /ant/ivy/core/trunk: ./ META-INF/
src/java/org/apache/ivy/ant/ src/java/org/apache/ivy/core/cache/
src/java/org/apache/ivy/core/pack/ src/java/org/apache/ivy/core/report/
src/java/org/apache/ivy/core/resolve/ src/java/or...
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/xml/OBRXMLParser.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/xml/OBRXMLParser.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/xml/OBRXMLParser.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/xml/OBRXMLParser.java Sat Jan 4 13:06:37 2014
@@ -25,9 +25,11 @@ import java.text.ParseException;
import javax.xml.parsers.ParserConfigurationException;
+import org.apache.ivy.osgi.core.BundleArtifact;
import org.apache.ivy.osgi.core.BundleInfo;
import org.apache.ivy.osgi.core.ExecutionEnvironmentProfileProvider;
-import org.apache.ivy.osgi.obr.filter.RequirementFilterParser;
+import org.apache.ivy.osgi.filter.OSGiFilter;
+import org.apache.ivy.osgi.filter.OSGiFilterParser;
import org.apache.ivy.osgi.repo.BundleRepoDescriptor;
import org.apache.ivy.osgi.util.DelegatingHandler;
import org.apache.ivy.osgi.util.Version;
@@ -117,7 +119,7 @@ public class OBRXMLParser {
return;
}
try {
- bundleInfo.setSourceURI(new URI(uri));
+ bundleInfo.addArtifact(new BundleArtifact(true, new URI(uri), null));
} catch (URISyntaxException e) {
log(Message.MSG_WARN, "Incorrect uri " + uri + ". The source of "
+ bundleInfo.getSymbolicName() + " is then ignored.");
@@ -212,7 +214,7 @@ public class OBRXMLParser {
String uri = atts.getValue(URI);
if (uri != null) {
try {
- bundleInfo.setUri(new URI(uri));
+ bundleInfo.addArtifact(new BundleArtifact(false, new URI(uri), null));
} catch (URISyntaxException e) {
log(Message.MSG_ERR, "Incorrect uri " + uri + ". The resource " + symbolicname
+ " is then ignored.");
@@ -350,7 +352,7 @@ public class OBRXMLParser {
Requirement requirement;
- RequirementFilter filter;
+ OSGiFilter filter;
public AbstractRequirementHandler(String name) {
super(name);
@@ -363,7 +365,7 @@ public class OBRXMLParser {
filter = null;
if (filterText != null) {
try {
- filter = RequirementFilterParser.parse(filterText);
+ filter = OSGiFilterParser.parse(filterText);
} catch (ParseException e) {
throw new SAXParseException("Requirement with illformed filter: " + filterText,
getLocator());
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/xml/OBRXMLWriter.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/xml/OBRXMLWriter.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/xml/OBRXMLWriter.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/xml/OBRXMLWriter.java Sat Jan 4 13:06:37 2014
@@ -29,6 +29,7 @@ import javax.xml.transform.sax.Transform
import javax.xml.transform.stream.StreamResult;
import org.apache.ivy.core.IvyContext;
+import org.apache.ivy.osgi.core.BundleArtifact;
import org.apache.ivy.osgi.core.BundleCapability;
import org.apache.ivy.osgi.core.BundleInfo;
import org.apache.ivy.osgi.core.BundleRequirement;
@@ -73,7 +74,7 @@ public class OBRXMLWriter {
BundleInfo bundleInfo;
try {
bundleInfo = ManifestParser.parseManifest(manifestAndLocation.getManifest());
- bundleInfo.setUri(manifestAndLocation.getUri());
+ bundleInfo.addArtifact(new BundleArtifact(false, manifestAndLocation.getUri(), null));
nbOk++;
} catch (ParseException e) {
nbRejected++;
@@ -109,8 +110,9 @@ public class OBRXMLWriter {
AttributesImpl atts = new AttributesImpl();
addAttr(atts, ResourceHandler.SYMBOLIC_NAME, bundleInfo.getSymbolicName());
addAttr(atts, ResourceHandler.VERSION, bundleInfo.getRawVersion());
- if (bundleInfo.getUri() != null) {
- addAttr(atts, ResourceHandler.URI, bundleInfo.getUri().toString());
+ if (!bundleInfo.getArtifacts().isEmpty()) {
+ // TODO handle several artifacts
+ addAttr(atts, ResourceHandler.URI, bundleInfo.getArtifacts().get(0).getUri().toString());
}
handler.startElement("", ResourceHandler.RESOURCE, ResourceHandler.RESOURCE, atts);
for (BundleCapability capability : bundleInfo.getCapabilities()) {
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/xml/Requirement.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/xml/Requirement.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/xml/Requirement.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/xml/Requirement.java Sat Jan 4 13:06:37 2014
@@ -17,17 +17,19 @@
*/
package org.apache.ivy.osgi.obr.xml;
+import org.apache.ivy.osgi.filter.OSGiFilter;
+
public class Requirement {
private final String name;
private boolean optional;
- private final RequirementFilter filter;
+ private final OSGiFilter filter;
private boolean multiple = false;
- public Requirement(String name, RequirementFilter filter) {
+ public Requirement(String name, OSGiFilter filter) {
this.name = name;
this.filter = filter;
}
@@ -36,7 +38,7 @@ public class Requirement {
return name;
}
- public RequirementFilter getFilter() {
+ public OSGiFilter getFilter() {
return filter;
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/xml/RequirementAdapter.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/xml/RequirementAdapter.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/xml/RequirementAdapter.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/obr/xml/RequirementAdapter.java Sat Jan 4 13:06:37 2014
@@ -21,10 +21,11 @@ import java.text.ParseException;
import org.apache.ivy.osgi.core.BundleInfo;
import org.apache.ivy.osgi.core.BundleRequirement;
-import org.apache.ivy.osgi.obr.filter.AndFilter;
-import org.apache.ivy.osgi.obr.filter.CompareFilter;
-import org.apache.ivy.osgi.obr.filter.CompareFilter.Operator;
-import org.apache.ivy.osgi.obr.filter.NotFilter;
+import org.apache.ivy.osgi.filter.AndFilter;
+import org.apache.ivy.osgi.filter.CompareFilter;
+import org.apache.ivy.osgi.filter.NotFilter;
+import org.apache.ivy.osgi.filter.OSGiFilter;
+import org.apache.ivy.osgi.filter.CompareFilter.Operator;
import org.apache.ivy.osgi.util.Version;
import org.apache.ivy.osgi.util.VersionRange;
@@ -49,11 +50,11 @@ public class RequirementAdapter {
adapter.adapt(info, requirement.isOptional());
}
- private void extractFilter(RequirementFilter filter) throws UnsupportedFilterException,
+ private void extractFilter(OSGiFilter filter) throws UnsupportedFilterException,
ParseException {
if (filter instanceof AndFilter) {
AndFilter andFilter = (AndFilter) filter;
- for (RequirementFilter subFilter : andFilter.getSubFilters()) {
+ for (OSGiFilter subFilter : andFilter.getSubFilters()) {
extractFilter(subFilter);
}
} else if (filter instanceof CompareFilter) {
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2Artifact.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2Artifact.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2Artifact.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2Artifact.java Sat Jan 4 13:06:37 2014
@@ -44,4 +44,10 @@ public class P2Artifact {
public Version getVersion() {
return version;
}
+
+ @Override
+ public String toString() {
+ return id + "@" + version + " (" + classifier + ")";
+ }
+
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2ArtifactParser.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2ArtifactParser.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2ArtifactParser.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2ArtifactParser.java Sat Jan 4 13:06:37 2014
@@ -19,18 +19,27 @@ package org.apache.ivy.osgi.p2;
import java.io.IOException;
import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
import java.text.ParseException;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import javax.xml.parsers.ParserConfigurationException;
+import org.apache.ivy.osgi.filter.OSGiFilter;
+import org.apache.ivy.osgi.filter.OSGiFilterParser;
+import org.apache.ivy.osgi.p2.PropertiesParser.PropertiesHandler;
import org.apache.ivy.osgi.util.DelegatingHandler;
import org.apache.ivy.osgi.util.Version;
import org.apache.ivy.util.XMLHelper;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
public class P2ArtifactParser implements XMLInputParser {
@@ -62,7 +71,7 @@ public class P2ArtifactParser implements
//
// private static final String VERSION = "version";
- private Map<String, String> patternsByClassifier = new HashMap<String, String>();
+ private Map<OSGiFilter, String> artifactPatterns = new LinkedHashMap<OSGiFilter, String>();
public RepositoryHandler(final P2Descriptor p2Descriptor, String repoUrl) {
super(REPOSITORY);
@@ -73,18 +82,18 @@ public class P2ArtifactParser implements
addChild(new MappingsHandler(), new ChildElementHandler<MappingsHandler>() {
public void childHanlded(MappingsHandler child) {
for (Entry<String, String> entry : child.outputByFilter.entrySet()) {
- String filter = entry.getKey();
- if (filter.startsWith("(& (classifier=") && filter.endsWith("")) {
- String classifier = filter.substring(15, filter.length() - 2);
- patternsByClassifier.put(classifier, entry.getValue());
- } else {
+ OSGiFilter filter;
+ try {
+ filter = OSGiFilterParser.parse(entry.getKey());
+ } catch (ParseException e) {
throw new IllegalStateException();
}
+ artifactPatterns.put(filter, entry.getValue());
}
}
});
- addChild(new ArtifactsHandler(p2Descriptor, patternsByClassifier, repoUrl),
+ addChild(new ArtifactsHandler(p2Descriptor, artifactPatterns, repoUrl),
new ChildElementHandler<ArtifactsHandler>() {
public void childHanlded(ArtifactsHandler child) {
// nothing to do
@@ -117,7 +126,7 @@ public class P2ArtifactParser implements
protected void handleAttributes(Attributes atts) {
int size = Integer.parseInt(atts.getValue(SIZE));
- outputByFilter = new HashMap<String, String>(size);
+ outputByFilter = new LinkedHashMap<String, String>(size);
}
}
@@ -152,18 +161,41 @@ public class P2ArtifactParser implements
// private static final String SIZE = "size";
public ArtifactsHandler(final P2Descriptor p2Descriptor,
- final Map<String, String> patternsByClassifier, final String repoUrl) {
+ final Map<OSGiFilter, String> artifactPatterns, final String repoUrl) {
super(ARTIFACTS);
addChild(new ArtifactHandler(), new ChildElementHandler<ArtifactHandler>() {
- public void childHanlded(ArtifactHandler child) {
- P2Artifact a = child.p2Artifact;
- String url = patternsByClassifier.get(a.getClassifier());
- if (url.startsWith("${repoUrl}")) { // try to avoid costly regexp
- url = repoUrl + url.substring(10);
- } else {
+ public void childHanlded(ArtifactHandler child) throws SAXParseException {
+ String url = getPattern(child.p2Artifact, child.properties);
+ if (url != null) {
url = url.replaceAll("\\$\\{repoUrl\\}", repoUrl);
+ url = url.replaceAll("\\$\\{id\\}", child.p2Artifact.getId());
+ url = url.replaceAll("\\$\\{version\\}", child.p2Artifact.getVersion()
+ .toString());
+ URI uri;
+ try {
+ uri = new URL(url).toURI();
+ } catch (MalformedURLException e) {
+ throw new SAXParseException("Incorrect artifact url '" + url + "' ("
+ + e.getMessage() + ")", getLocator(), e);
+ } catch (URISyntaxException e) {
+ throw new SAXParseException("Incorrect artifact url '" + url + "' ("
+ + e.getMessage() + ")", getLocator(), e);
+ }
+ p2Descriptor.addArtifactUrl(child.p2Artifact.getClassifier(),
+ child.p2Artifact.getId(), child.p2Artifact.getVersion(), uri,
+ child.properties.get("format"));
+ }
+ }
+
+ private String getPattern(P2Artifact p2Artifact, Map<String, String> properties) {
+ Map<String, String> props = new HashMap<String, String>(properties);
+ props.put("classifier", p2Artifact.getClassifier());
+ for (Entry<OSGiFilter, String> pattern : artifactPatterns.entrySet()) {
+ if (pattern.getKey().eval(props)) {
+ return pattern.getValue();
+ }
}
- p2Descriptor.addArtifactUrl(a.getClassifier(), a.getId(), a.getVersion(), url);
+ return null;
}
});
}
@@ -185,14 +217,17 @@ public class P2ArtifactParser implements
private static final String VERSION = "version";
- P2Artifact p2Artifact;
+ private P2Artifact p2Artifact;
+
+ private Map<String, String> properties;
public ArtifactHandler() {
super(ARTIFACT);
- // addChild(new PropertiesHandler(), new ChildElementHandler<PropertiesHandler>() {
- // public void childHanlded(PropertiesHandler child) {
- // }
- // });
+ addChild(new PropertiesHandler(), new ChildElementHandler<PropertiesHandler>() {
+ public void childHanlded(PropertiesHandler child) {
+ properties = child.properties;
+ }
+ });
}
protected void handleAttributes(Attributes atts) throws SAXException {
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2Descriptor.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2Descriptor.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2Descriptor.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2Descriptor.java Sat Jan 4 13:06:37 2014
@@ -18,11 +18,11 @@
package org.apache.ivy.osgi.p2;
import java.net.URI;
-import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
+import org.apache.ivy.osgi.core.BundleArtifact;
import org.apache.ivy.osgi.core.BundleInfo;
import org.apache.ivy.osgi.core.ExecutionEnvironmentProfileProvider;
import org.apache.ivy.osgi.repo.EditableRepoDescriptor;
@@ -32,114 +32,121 @@ import org.apache.ivy.util.Message;
public class P2Descriptor extends EditableRepoDescriptor {
- private long timestamp;
+ private Map<String, Map<Version, BundleInfo>> sourceTargetBundles = new HashMap<String, Map<Version, BundleInfo>>();
- private Map<String, Map<Version, String>> artifactUrlPatterns = new HashMap<String, Map<Version, String>>();
-
- private Map<String, Map<String, URI>> sourceURIs = new HashMap<String, Map<String, URI>>();
+ private Map<String, Map<Version, BundleInfo>> sourceBundles = new HashMap<String, Map<Version, BundleInfo>>();
public P2Descriptor(URI repoUri, ExecutionEnvironmentProfileProvider profileProvider) {
super(repoUri, profileProvider);
}
- public void setTimestamp(long timestamp) {
- this.timestamp = timestamp;
- }
-
public void addBundle(BundleInfo bundleInfo) {
if (bundleInfo.isSource()) {
if (bundleInfo.getSymbolicNameTarget() == null || bundleInfo.getVersionTarget() == null) {
if (getLogLevel() <= Message.MSG_VERBOSE) {
Message.verbose("The source bundle " + bundleInfo.getSymbolicName()
- + " did declare its target. Ignoring it");
+ + " did not declare its target. Ignoring it");
}
return;
}
- Map<String, URI> byVersion = sourceURIs.get(bundleInfo.getSymbolicNameTarget());
+ Map<Version, BundleInfo> byVersion = sourceBundles.get(bundleInfo.getSymbolicName());
if (byVersion == null) {
- byVersion = new HashMap<String, URI>();
- sourceURIs.put(bundleInfo.getSymbolicNameTarget(), byVersion);
+ byVersion = new HashMap<Version, BundleInfo>();
+ sourceBundles.put(bundleInfo.getSymbolicName(), byVersion);
}
- URI sourceUri = getArtifactURI(bundleInfo);
- if (sourceUri == null) {
- if (getLogLevel() <= Message.MSG_VERBOSE) {
- Message.verbose("The source bundle " + bundleInfo.getSymbolicName()
- + " has no actual artifact. Ignoring it");
- }
- return;
+ byVersion.put(bundleInfo.getVersion(), bundleInfo);
+
+ Map<Version, BundleInfo> byTargetVersion = sourceTargetBundles.get(bundleInfo
+ .getSymbolicNameTarget());
+ if (byTargetVersion == null) {
+ byTargetVersion = new HashMap<Version, BundleInfo>();
+ sourceTargetBundles.put(bundleInfo.getSymbolicNameTarget(), byTargetVersion);
}
- URI old = byVersion.put(bundleInfo.getVersionTarget().toString(), sourceUri);
- if (old != null && !old.equals(sourceUri)) {
+ BundleInfo old = byTargetVersion.put(bundleInfo.getVersionTarget(), bundleInfo);
+ if (old != null && !old.equals(bundleInfo)) {
if (getLogLevel() <= Message.MSG_VERBOSE) {
Message.verbose("Duplicate source for the bundle "
+ bundleInfo.getSymbolicNameTarget() + "@"
- + bundleInfo.getVersionTarget() + " : " + sourceUri + " is replacing "
+ + bundleInfo.getVersionTarget() + " : " + bundleInfo + " is replacing "
+ old);
}
}
return;
}
- // before transforming it and adding it into the repo, let's add the artifacts
- // and if no artifact, then no bundle
- bundleInfo.setUri(getArtifactURI(bundleInfo));
super.addBundle(bundleInfo);
}
- private URI getArtifactURI(BundleInfo bundleInfo) {
- Map<Version, String> urlPatternsByVersion = artifactUrlPatterns.get(bundleInfo
- .getSymbolicName());
- if (urlPatternsByVersion != null) {
- String urlPattern = urlPatternsByVersion.get(bundleInfo.getVersion());
- if (urlPattern != null) {
- String url = urlPattern.replaceAll("\\$\\{id\\}", bundleInfo.getSymbolicName());
- url = url.replaceAll("\\$\\{version\\}", bundleInfo.getVersion().toString());
- try {
- return new URI(url);
- } catch (URISyntaxException e) {
- throw new RuntimeException("Unable to build the artifact uri of " + bundleInfo,
- e);
+ public void finish() {
+ sourceBundles = null;
+ Set<String> bundleIds = getCapabilityValues(BundleInfo.BUNDLE_TYPE);
+ if (bundleIds == null) {
+ return;
+ }
+ for (String bundleId : bundleIds) {
+ Set<ModuleDescriptorWrapper> modules = findModules(BundleInfo.BUNDLE_TYPE, bundleId);
+ for (ModuleDescriptorWrapper mdw : modules) {
+ String symbolicName = mdw.getBundleInfo().getSymbolicName();
+ Map<Version, BundleInfo> byVersion = sourceTargetBundles.get(symbolicName);
+ if (byVersion == null) {
+ continue;
+ }
+ BundleInfo source = byVersion.get(mdw.getBundleInfo().getVersion());
+ if (source == null) {
+ continue;
+ }
+ for (BundleArtifact artifact : source.getArtifacts()) {
+ mdw.getBundleInfo().addArtifact(artifact);
}
}
}
- return null;
+ sourceTargetBundles = null;
}
- public void addArtifactUrl(String classifier, String id, Version version, String url) {
+ public void addArtifactUrl(String classifier, String id, Version version, URI uri, String format) {
if (!classifier.equals("osgi.bundle")) {
// we only support OSGi bundle, no Eclipse feature or anything else
return;
}
- Map<Version, String> byVersion = artifactUrlPatterns.get(id);
+ ModuleDescriptorWrapper module = findModule(id, version);
+ if (module != null) {
+ addArtifact(module.getBundleInfo(), new BundleArtifact(false, uri, format));
+ return;
+ }
+
+ // not found in the regular bundle. Let's look up in the source ones
+ Map<Version, BundleInfo> byVersion = sourceBundles.get(id);
if (byVersion == null) {
- byVersion = new HashMap<Version, String>();
- artifactUrlPatterns.put(id, byVersion);
+ return;
+ }
+ BundleInfo source = byVersion.get(version);
+ if (source == null) {
+ return;
}
- byVersion.put(version, url);
+ addArtifact(source, new BundleArtifact(true, uri, format));
}
- public void finish() {
- artifactUrlPatterns = null;
- Set<String> bundleNames = getCapabilityValues(BundleInfo.BUNDLE_TYPE);
- if (bundleNames == null) {
- return;
+ private void addArtifact(BundleInfo bundle, BundleArtifact artifact) {
+ // find an existing artifact that might be a duplicate
+ BundleArtifact same = null;
+ for (BundleArtifact a : bundle.getArtifacts()) {
+ if (a.isSource() == artifact.isSource()) {
+ same = a;
+ break;
+ }
}
- for (String bundleName : bundleNames) {
- Set<ModuleDescriptorWrapper> modules = findModule(BundleInfo.BUNDLE_TYPE, bundleName);
- for (ModuleDescriptorWrapper mdw : modules) {
- String symbolicName = mdw.getBundleInfo().getSymbolicName();
- Map<String, URI> byVersion = sourceURIs.get(symbolicName);
- if (byVersion == null) {
- continue;
- }
- String rev = mdw.getBundleInfo().getVersion().toString();
- URI source = (URI) byVersion.get(rev);
- if (source == null) {
- continue;
- }
- mdw.setSource(source);
+
+ BundleArtifact best = artifact;
+
+ if (same != null) {
+ // we have two artifacts for the same bundle, let's choose a "packed" one
+ if (artifact.getFormat() == null || same.getFormat() != null) {
+ // the new one cannot be better
+ return;
}
+ bundle.removeArtifact(same);
}
- sourceURIs = null;
+
+ bundle.addArtifact(best);
}
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/p2/P2MetadataParser.java Sat Jan 4 13:06:37 2014
@@ -67,7 +67,7 @@ public class P2MetadataParser implements
private class RepositoryHandler extends DelegatingHandler {
- private static final String P2_TIMESTAMP = "p2.timestamp";
+ // private static final String P2_TIMESTAMP = "p2.timestamp";
private static final String REPOSITORY = "repository";
@@ -83,15 +83,15 @@ public class P2MetadataParser implements
public RepositoryHandler(final P2Descriptor p2Descriptor) {
super(REPOSITORY);
- addChild(new PropertiesHandler(P2_TIMESTAMP),
- new ChildElementHandler<PropertiesHandler>() {
- public void childHanlded(PropertiesHandler child) {
- String timestamp = child.properties.get(P2_TIMESTAMP);
- if (timestamp != null) {
- p2Descriptor.setTimestamp(Long.parseLong(timestamp));
- }
- }
- });
+ // addChild(new PropertiesHandler(P2_TIMESTAMP),
+ // new ChildElementHandler<PropertiesHandler>() {
+ // public void childHanlded(PropertiesHandler child) {
+ // String timestamp = child.properties.get(P2_TIMESTAMP);
+ // if (timestamp != null) {
+ // p2Descriptor.setTimestamp(Long.parseLong(timestamp));
+ // }
+ // }
+ // });
addChild(new UnitsHandler(), new ChildElementHandler<UnitsHandler>() {
public void childHanlded(UnitsHandler child) {
for (BundleInfo bundle : child.bundles) {
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AbstractOSGiResolver.java Sat Jan 4 13:06:37 2014
@@ -142,7 +142,7 @@ public abstract class AbstractOSGiResolv
}
String id = mrid.getName();
Collection<ModuleDescriptor> mds = ModuleDescriptorWrapper.unwrap(getRepoDescriptor()
- .findModule(osgiType, id));
+ .findModules(osgiType, id));
if (mds == null || mds.isEmpty()) {
Message.verbose("\t " + id + " not found.");
return null;
@@ -333,7 +333,7 @@ public abstract class AbstractOSGiResolv
if (IvyPatternHelper.REVISION_KEY.equals(token)) {
String name = (String) tokenValues.get(IvyPatternHelper.MODULE_KEY);
List<String> versions = new ArrayList<String>();
- Set<ModuleDescriptorWrapper> mds = getRepoDescriptor().findModule(osgiType, name);
+ Set<ModuleDescriptorWrapper> mds = getRepoDescriptor().findModules(osgiType, name);
if (mds != null) {
for (ModuleDescriptorWrapper md : mds) {
versions.add(md.getBundleInfo().getVersion().toString());
@@ -351,7 +351,7 @@ public abstract class AbstractOSGiResolv
return Collections.singletonList(BundleInfoAdapter.CONF_USE_PREFIX + name);
}
Collection<ModuleDescriptor> mds = ModuleDescriptorWrapper.unwrap(getRepoDescriptor()
- .findModule(osgiType, name));
+ .findModules(osgiType, name));
if (mds == null) {
return Collections.EMPTY_LIST;
}
@@ -459,7 +459,7 @@ public abstract class AbstractOSGiResolv
remainingTokens.remove(IvyPatternHelper.REVISION_KEY);
String rev = criteria.get(IvyPatternHelper.REVISION_KEY);
if (rev == null) {
- Set<ModuleDescriptorWrapper> mdws = getRepoDescriptor().findModule(osgiType, module);
+ Set<ModuleDescriptorWrapper> mdws = getRepoDescriptor().findModules(osgiType, module);
if (mdws == null || mdws.isEmpty()) {
return Collections.emptySet();
}
@@ -481,7 +481,7 @@ public abstract class AbstractOSGiResolv
values.put(IvyPatternHelper.CONF_KEY, BundleInfoAdapter.CONF_USE_PREFIX + module);
return Collections.singleton(values);
}
- Set<ModuleDescriptorWrapper> bundles = getRepoDescriptor().findModule(osgiType, module);
+ Set<ModuleDescriptorWrapper> bundles = getRepoDescriptor().findModules(osgiType, module);
if (bundles == null) {
return Collections.emptySet();
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AggregatedRepoDescriptor.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AggregatedRepoDescriptor.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AggregatedRepoDescriptor.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/AggregatedRepoDescriptor.java Sat Jan 4 13:06:37 2014
@@ -86,10 +86,10 @@ public class AggregatedRepoDescriptor ex
}
@Override
- public Set<ModuleDescriptorWrapper> findModule(String requirement, String value) {
+ public Set<ModuleDescriptorWrapper> findModules(String requirement, String value) {
Set<ModuleDescriptorWrapper> ret = new HashSet<ModuleDescriptorWrapper>();
for (RepoDescriptor repo : repos) {
- Set<ModuleDescriptorWrapper> modules = repo.findModule(requirement, value);
+ Set<ModuleDescriptorWrapper> modules = repo.findModules(requirement, value);
if (modules != null) {
ret.addAll(modules);
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/ArtifactReportManifestIterable.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/ArtifactReportManifestIterable.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/ArtifactReportManifestIterable.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/ArtifactReportManifestIterable.java Sat Jan 4 13:06:37 2014
@@ -55,26 +55,58 @@ public class ArtifactReportManifestItera
public boolean hasNext() {
while (next == null && it.hasNext()) {
ArtifactDownloadReport report = (ArtifactDownloadReport) it.next();
- File artifact = report.getLocalFile();
- JarInputStream in = null;
- try {
- in = new JarInputStream(new FileInputStream(artifact));
- Manifest manifest = in.getManifest();
- if (manifest != null) {
- next = new ManifestAndLocation(manifest, artifact.toURI());
+ if (report.getUnpackedLocalFile() != null
+ && report.getUnpackedLocalFile().isDirectory()) {
+ FileInputStream in = null;
+ try {
+ in = new FileInputStream(new File(report.getUnpackedLocalFile(),
+ "META-INF/MANIFEST.MF"));
+ next = new ManifestAndLocation(new Manifest(in), report
+ .getUnpackedLocalFile().toURI());
return true;
+ } catch (FileNotFoundException e) {
+ Message.debug(
+ "Bundle directory file just removed: " + report.getUnpackedLocalFile(),
+ e);
+ } catch (IOException e) {
+ Message.debug("The Manifest in the bundle directory could not be read: "
+ + report.getUnpackedLocalFile(), e);
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ } else {
+ File artifact;
+ if (report.getUnpackedLocalFile() != null) {
+ artifact = report.getUnpackedLocalFile();
+ } else {
+ artifact = report.getLocalFile();
}
- Message.debug("No manifest in jar: " + artifact);
- } catch (FileNotFoundException e) {
- Message.debug("Jar file just removed: " + artifact, e);
- } catch (IOException e) {
- Message.warn("Unreadable jar: " + artifact, e);
- } finally {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- // Don't care
+ JarInputStream in = null;
+ try {
+ in = new JarInputStream(new FileInputStream(artifact));
+ Manifest manifest = in.getManifest();
+ if (manifest != null) {
+ next = new ManifestAndLocation(manifest, artifact.toURI());
+ return true;
+ }
+ Message.debug("No manifest in jar: " + artifact);
+ } catch (FileNotFoundException e) {
+ Message.debug("Jar file just removed: " + artifact, e);
+ } catch (IOException e) {
+ Message.warn("Unreadable jar: " + artifact, e);
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {
+ // Don't care
+ }
}
}
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/BundleRepoDescriptor.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/BundleRepoDescriptor.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/BundleRepoDescriptor.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/BundleRepoDescriptor.java Sat Jan 4 13:06:37 2014
@@ -21,6 +21,7 @@ import java.net.URI;
import java.text.ParseException;
import java.util.Iterator;
+import org.apache.ivy.osgi.core.BundleArtifact;
import org.apache.ivy.osgi.core.BundleInfo;
import org.apache.ivy.osgi.core.ExecutionEnvironmentProfileProvider;
import org.apache.ivy.osgi.core.ManifestParser;
@@ -58,7 +59,7 @@ public class BundleRepoDescriptor extend
try {
BundleInfo bundleInfo = ManifestParser.parseManifest(manifestAndLocation
.getManifest());
- bundleInfo.setUri(manifestAndLocation.getUri());
+ bundleInfo.addArtifact(new BundleArtifact(false, manifestAndLocation.getUri(), null));
addBundle(bundleInfo);
} catch (ParseException e) {
Message.error("Rejected " + manifestAndLocation.getUri() + ": " + e.getMessage());
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/EditableRepoDescriptor.java Sat Jan 4 13:06:37 2014
@@ -28,6 +28,7 @@ import java.util.Set;
import org.apache.ivy.osgi.core.BundleCapability;
import org.apache.ivy.osgi.core.BundleInfo;
import org.apache.ivy.osgi.core.ExecutionEnvironmentProfileProvider;
+import org.apache.ivy.osgi.util.Version;
import org.apache.ivy.util.Message;
public class EditableRepoDescriptor extends RepoDescriptor {
@@ -67,7 +68,7 @@ public class EditableRepoDescriptor exte
return moduleByCapabilities.keySet();
}
- public Set<ModuleDescriptorWrapper> findModule(String requirement, String value) {
+ public Set<ModuleDescriptorWrapper> findModules(String requirement, String value) {
Map<String, Set<ModuleDescriptorWrapper>> modules = moduleByCapabilities.get(requirement);
if (modules == null) {
return null;
@@ -75,6 +76,19 @@ public class EditableRepoDescriptor exte
return modules.get(value);
}
+ public ModuleDescriptorWrapper findModule(String symbolicName, Version version) {
+ Set<ModuleDescriptorWrapper> modules = findModules(BundleInfo.BUNDLE_TYPE, symbolicName);
+ if (modules == null) {
+ return null;
+ }
+ for (ModuleDescriptorWrapper module : modules) {
+ if (module.getBundleInfo().getVersion().equals(version)) {
+ return module;
+ }
+ }
+ return null;
+ }
+
public Set<String> getCapabilityValues(String capabilityName) {
Map<String, Set<ModuleDescriptorWrapper>> modules = moduleByCapabilities
.get(capabilityName);
@@ -84,7 +98,7 @@ public class EditableRepoDescriptor exte
return modules.keySet();
}
- public void add(String type, String value, ModuleDescriptorWrapper md) {
+ private void add(String type, String value, ModuleDescriptorWrapper md) {
modules.add(md);
Map<String, Set<ModuleDescriptorWrapper>> map = moduleByCapabilities.get(type);
if (map == null) {
@@ -106,6 +120,13 @@ public class EditableRepoDescriptor exte
}
public void addBundle(BundleInfo bundleInfo) {
+ ModuleDescriptorWrapper module = findModule(bundleInfo.getSymbolicName(),
+ bundleInfo.getVersion());
+ if (module != null) {
+ Message.debug("Duplicate module " + bundleInfo.getSymbolicName() + "@"
+ + bundleInfo.getVersion());
+ return;
+ }
ModuleDescriptorWrapper md = new ModuleDescriptorWrapper(bundleInfo, baseUri,
profileProvider);
add(BundleInfo.BUNDLE_TYPE, bundleInfo.getSymbolicName(), md);
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/ModuleDescriptorWrapper.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/ModuleDescriptorWrapper.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/ModuleDescriptorWrapper.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/ModuleDescriptorWrapper.java Sat Jan 4 13:06:37 2014
@@ -23,7 +23,6 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
-import org.apache.ivy.core.module.descriptor.DefaultArtifact;
import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
import org.apache.ivy.osgi.core.BundleInfo;
@@ -41,8 +40,6 @@ public class ModuleDescriptorWrapper {
private ExecutionEnvironmentProfileProvider profileProvider;
- private URI source;
-
public ModuleDescriptorWrapper(BundleInfo bundleInfo, URI baseUri,
ExecutionEnvironmentProfileProvider profileProvider) {
this.bundleInfo = bundleInfo;
@@ -50,10 +47,6 @@ public class ModuleDescriptorWrapper {
this.profileProvider = profileProvider;
}
- public void setSource(URI source) {
- this.source = source;
- }
-
public BundleInfo getBundleInfo() {
return bundleInfo;
}
@@ -66,12 +59,6 @@ public class ModuleDescriptorWrapper {
}
md = BundleInfoAdapter.toModuleDescriptor(OSGiManifestParser.getInstance(),
baseUri, bundleInfo, profileProvider);
- if (source != null) {
- String compression = md.getAllArtifacts()[0].getExtraAttribute("compression");
- DefaultArtifact sourceArtifact = BundleInfoAdapter.buildArtifact(
- md.getModuleRevisionId(), baseUri, source, "source", compression);
- md.addArtifact(BundleInfoAdapter.CONF_NAME_DEFAULT, sourceArtifact);
- }
}
}
return md;
@@ -108,4 +95,5 @@ public class ModuleDescriptorWrapper {
public String toString() {
return getModuleDescriptor().toString();
}
+
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/RepoDescriptor.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/RepoDescriptor.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/RepoDescriptor.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/repo/RepoDescriptor.java Sat Jan 4 13:06:37 2014
@@ -26,7 +26,7 @@ public abstract class RepoDescriptor {
abstract public Set<String> getCapabilities();
- abstract public Set<ModuleDescriptorWrapper> findModule(String requirement, String value);
+ abstract public Set<ModuleDescriptorWrapper> findModules(String requirement, String value);
abstract public Set<String> getCapabilityValues(String capabilityName);
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/PluginAdapter.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/PluginAdapter.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/PluginAdapter.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/PluginAdapter.java Sat Jan 4 13:06:37 2014
@@ -19,6 +19,7 @@ package org.apache.ivy.osgi.updatesite;
import java.net.URI;
+import org.apache.ivy.osgi.core.BundleArtifact;
import org.apache.ivy.osgi.core.BundleInfo;
import org.apache.ivy.osgi.core.BundleRequirement;
import org.apache.ivy.osgi.updatesite.xml.EclipseFeature;
@@ -31,12 +32,14 @@ public class PluginAdapter {
public static BundleInfo featureAsBundle(URI baseUri, EclipseFeature feature) {
BundleInfo b = new BundleInfo(feature.getId(), feature.getVersion());
+ URI uri;
if (feature.getUrl() == null) {
- b.setUri(baseUri.resolve("features/" + feature.getId() + '_' + feature.getVersion()
- + ".jar"));
+ uri = baseUri.resolve("features/" + feature.getId() + '_' + feature.getVersion()
+ + ".jar");
} else {
- b.setUri(baseUri.resolve(feature.getUrl()));
+ uri = baseUri.resolve(feature.getUrl());
}
+ b.addArtifact(new BundleArtifact(false, uri, null));
b.setDescription(feature.getDescription());
b.setLicense(feature.getLicense());
@@ -70,7 +73,8 @@ public class PluginAdapter {
public static BundleInfo pluginAsBundle(URI baseUri, EclipsePlugin plugin) {
BundleInfo b = new BundleInfo(plugin.getId(), plugin.getVersion());
- b.setUri(baseUri.resolve("plugins/" + plugin.getId() + '_' + plugin.getVersion() + ".jar"));
+ URI uri = baseUri.resolve("plugins/" + plugin.getId() + '_' + plugin.getVersion() + ".jar");
+ b.addArtifact(new BundleArtifact(false, uri, null));
return b;
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoader.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoader.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoader.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/osgi/updatesite/UpdateSiteLoader.java Sat Jan 4 13:06:37 2014
@@ -24,7 +24,6 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.text.ParseException;
-import java.util.Iterator;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
@@ -114,24 +113,50 @@ public class UpdateSiteLoader {
private boolean populateP2Descriptor(URI repoUri, P2Descriptor p2Descriptor)
throws IOException, ParseException, SAXException {
Message.verbose("Loading P2 repository " + repoUri);
+ boolean contentExists = readContent(repoUri, p2Descriptor);
+ boolean artifactExists = readArtifacts(repoUri, p2Descriptor);
+ return artifactExists || contentExists;
+ }
- boolean artifactExists = readComposite(repoUri, "compositeArtifacts", p2Descriptor);
- if (!artifactExists) {
- artifactExists = readJarOrXml(repoUri, "artifacts", new P2ArtifactParser(p2Descriptor,
- repoUri.toURL().toExternalForm()));
- }
-
- boolean contentExists = readComposite(repoUri, "compositeContent", p2Descriptor);
+ private boolean readContent(URI repoUri, P2Descriptor p2Descriptor)
+ throws IOException, ParseException, SAXException {
+ boolean contentExists = readCompositeContent(repoUri, "compositeContent", p2Descriptor);
if (!contentExists) {
P2MetadataParser metadataParser = new P2MetadataParser(p2Descriptor);
metadataParser.setLogLevel(logLevel);
contentExists = readJarOrXml(repoUri, "content", metadataParser);
}
+ return contentExists;
+ }
- return artifactExists || contentExists;
+ private boolean readArtifacts(URI repoUri, P2Descriptor p2Descriptor)
+ throws IOException, ParseException, SAXException {
+ boolean artifactExists = readCompositeArtifact(repoUri, "compositeArtifacts", p2Descriptor);
+ if (!artifactExists) {
+ artifactExists = readJarOrXml(repoUri, "artifacts", new P2ArtifactParser(p2Descriptor,
+ repoUri.toURL().toExternalForm()));
+ }
+
+ return artifactExists;
+ }
+
+ private boolean readCompositeContent(URI repoUri, String name, P2Descriptor p2Descriptor)
+ throws IOException, ParseException, SAXException {
+ P2CompositeParser p2CompositeParser = new P2CompositeParser();
+ boolean exist = readJarOrXml(repoUri, name, p2CompositeParser);
+ if (exist) {
+ for (String childLocation : p2CompositeParser.getChildLocations()) {
+ if (!childLocation.endsWith("/")) {
+ childLocation += "/";
+ }
+ URI childUri = repoUri.resolve(childLocation);
+ readContent(childUri, p2Descriptor);
+ }
+ }
+ return exist;
}
- private boolean readComposite(URI repoUri, String name, P2Descriptor p2Descriptor)
+ private boolean readCompositeArtifact(URI repoUri, String name, P2Descriptor p2Descriptor)
throws IOException, ParseException, SAXException {
P2CompositeParser p2CompositeParser = new P2CompositeParser();
boolean exist = readJarOrXml(repoUri, name, p2CompositeParser);
@@ -141,7 +166,7 @@ public class UpdateSiteLoader {
childLocation += "/";
}
URI childUri = repoUri.resolve(childLocation);
- populateP2Descriptor(childUri, p2Descriptor);
+ readArtifacts(childUri, p2Descriptor);
}
}
return exist;
@@ -273,9 +298,7 @@ public class UpdateSiteLoader {
UpdateSiteDescriptor repoDescriptor = new UpdateSiteDescriptor(site.getUri(),
ExecutionEnvironmentProfileProvider.getInstance());
- Iterator itFeatures = site.getFeatures().iterator();
- while (itFeatures.hasNext()) {
- EclipseFeature feature = (EclipseFeature) itFeatures.next();
+ for (EclipseFeature feature : site.getFeatures()) {
URL url = site.getUri().resolve(feature.getUrl()).toURL();
URLResource res = new URLResource(url);
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/xml/ivy.xsd Sat Jan 4 13:06:37 2014
@@ -147,7 +147,7 @@
<xs:attribute name="ext" type="xs:string"/>
<xs:attribute name="conf" type="xs:string"/>
<xs:attribute name="url" type="xs:string"/>
- <xs:attribute name="compression" type="xs:string"/>
+ <xs:attribute name="packaging" type="xs:string"/>
<xs:anyAttribute namespace="##other" processContents="lax" />
</xs:complexType>
</xs:element>
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportParser.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportParser.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportParser.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportParser.java Sat Jan 4 13:06:37 2014
@@ -168,9 +168,9 @@ public class XmlReportParser {
if (attributes.getValue("location") != null) {
aReport.setLocalFile(new File(attributes.getValue("location")));
}
- if (attributes.getValue("uncompressedDir") != null) {
- aReport.setUncompressedLocalDir(new File(attributes
- .getValue("uncompressedDir")));
+ if (attributes.getValue("unpackedFile") != null) {
+ aReport.setUnpackedLocalFile(new File(attributes
+ .getValue("unpackedFile")));
}
revisionArtifacts.add(aReport);
} else if ("origin-location".equals(qName)) {
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportWriter.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportWriter.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportWriter.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/report/XmlReportWriter.java Sat Jan 4 13:06:37 2014
@@ -302,9 +302,9 @@ public class XmlReportWriter {
out.print(" location=\""
+ XMLHelper.escape(adr[i].getLocalFile().getAbsolutePath()) + "\"");
}
- if (adr[i].getUncompressedLocalDir() != null) {
- out.print(" uncompressedDir=\""
- + XMLHelper.escape(adr[i].getUncompressedLocalDir().getAbsolutePath())
+ if (adr[i].getUnpackedLocalFile() != null) {
+ out.print(" unpackedFile=\""
+ + XMLHelper.escape(adr[i].getUnpackedLocalFile().getAbsolutePath())
+ "\"");
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/resolver/AbstractResolver.java Sat Jan 4 13:06:37 2014
@@ -446,7 +446,6 @@ public abstract class AbstractResolver
protected CacheDownloadOptions getCacheDownloadOptions(DownloadOptions options) {
CacheDownloadOptions cacheDownloadOptions = new CacheDownloadOptions();
- cacheDownloadOptions.setUncompress(options.isUncompress());
cacheDownloadOptions.setListener(getDownloadListener(options));
return cacheDownloadOptions;
}
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCachePathTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCachePathTest.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCachePathTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCachePathTest.java Sat Jan 4 13:06:37 2014
@@ -239,13 +239,12 @@ public class IvyCachePathTest extends Te
path.execute();
}
- public void testUncompress() throws Exception {
+ public void testUnpack() throws Exception {
project.setProperty("ivy.dep.file",
- "test/repositories/1/compression/module1/ivys/ivy-1.0.xml");
- path.setPathid("testUncompress");
- path.setUncompress(true);
+ "test/repositories/1/packaging/module1/ivys/ivy-1.0.xml");
+ path.setPathid("testUnpack");
path.execute();
- Object ref = project.getReference("testUncompress");
+ Object ref = project.getReference("testUnpack");
assertNotNull(ref);
assertTrue(ref instanceof Path);
Path p = (Path) ref;
@@ -255,9 +254,8 @@ public class IvyCachePathTest extends Te
public void testOSGi() throws Exception {
project.setProperty("ivy.dep.file",
- "test/repositories/1/compression/module5/ivys/ivy-1.0.xml");
+ "test/repositories/1/packaging/module5/ivys/ivy-1.0.xml");
path.setPathid("testOSGi");
- path.setUncompress(true);
path.setOsgi(true);
path.execute();
Object ref = project.getReference("testOSGi");
@@ -266,18 +264,17 @@ public class IvyCachePathTest extends Te
Path p = (Path) ref;
assertEquals(4, p.size());
File cacheDir = path.getSettings().getDefaultRepositoryCacheBasedir();
- File uncompressed = new File(cacheDir, "compression/module3/jar_uncompresseds/module3-1.0");
- assertEquals(new File(uncompressed, "lib/ant-antlr.jar"), new File(p.list()[0]));
- assertEquals(new File(uncompressed, "lib/ant-apache-bcel.jar"), new File(p.list()[1]));
- assertEquals(new File(uncompressed, "lib/ant-apache-bsf.jar"), new File(p.list()[2]));
- assertEquals(new File(uncompressed, "lib/ant-apache-log4j.jar"), new File(p.list()[3]));
+ File unpacked = new File(cacheDir, "packaging/module3/jar_unpackeds/module3-1.0");
+ assertEquals(new File(unpacked, "lib/ant-antlr.jar"), new File(p.list()[0]));
+ assertEquals(new File(unpacked, "lib/ant-apache-bcel.jar"), new File(p.list()[1]));
+ assertEquals(new File(unpacked, "lib/ant-apache-bsf.jar"), new File(p.list()[2]));
+ assertEquals(new File(unpacked, "lib/ant-apache-log4j.jar"), new File(p.list()[3]));
}
public void testOSGi2() throws Exception {
project.setProperty("ivy.dep.file",
- "test/repositories/1/compression/module6/ivys/ivy-1.0.xml");
+ "test/repositories/1/packaging/module6/ivys/ivy-1.0.xml");
path.setPathid("testOSGi");
- path.setUncompress(true);
path.setOsgi(true);
path.execute();
Object ref = project.getReference("testOSGi");
@@ -286,8 +283,8 @@ public class IvyCachePathTest extends Te
Path p = (Path) ref;
assertEquals(1, p.size());
File cacheDir = path.getSettings().getDefaultRepositoryCacheBasedir();
- File uncompressed = new File(cacheDir, "compression/module4/jar_uncompresseds/module4-1.0");
- assertEquals(uncompressed, new File(p.list()[0]));
+ File unpacked = new File(cacheDir, "packaging/module4/jar_unpackeds/module4-1.0");
+ assertEquals(unpacked, new File(p.list()[0]));
}
private File getArchiveFileInCache(String organisation, String module, String revision,
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/report/ResolveReportTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/report/ResolveReportTest.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/report/ResolveReportTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/report/ResolveReportTest.java Sat Jan 4 13:06:37 2014
@@ -79,8 +79,7 @@ public class ResolveReportTest extends T
private void checkFixedMdDependency(DependencyDescriptor dep, String org, String mod,
String rev, String conf, String[] targetConfs) {
assertEquals(ModuleRevisionId.newInstance(org, mod, rev), dep.getDependencyRevisionId());
- assertEquals(Arrays.asList(new String[] {conf}),
- Arrays.asList(dep.getModuleConfigurations()));
+ assertTrue(Arrays.asList(dep.getModuleConfigurations()).contains(conf));
assertEquals(Arrays.asList(targetConfs),
Arrays.asList(dep.getDependencyConfigurations(conf)));
}
@@ -205,8 +204,10 @@ public class ResolveReportTest extends T
assertEquals(1, fixedMd.getDependencies().length);
- checkFixedMdDependency(fixedMd.getDependencies()[0], "org1", "mod1.2", "[1.0,2.0[", "*",
- new String[] {"*"});
+ checkFixedMdDependency(fixedMd.getDependencies()[0], "org1", "mod1.2", "[1.0,2.0[",
+ "default", new String[] {"*"});
+ checkFixedMdDependency(fixedMd.getDependencies()[0], "org1", "mod1.2", "[1.0,2.0[",
+ "compile", new String[] {"*"});
}
}
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/resolve/ResolveTest.java Sat Jan 4 13:06:37 2014
@@ -5539,11 +5539,10 @@ public class ResolveTest extends TestCas
assertFalse(report.hasError());
}
- public void testUncompress() throws Exception {
+ public void testUnpack() throws Exception {
ResolveOptions options = getResolveOptions(new String[] {"*"});
- options.setUncompress(true);
- URL url = new File("test/repositories/1/compression/module1/ivys/ivy-1.0.xml").toURI().toURL();
+ URL url = new File("test/repositories/1/packaging/module1/ivys/ivy-1.0.xml").toURI().toURL();
// normal resolve, the file goes in the cache
ResolveReport report = ivy.resolve(url, options);
@@ -5551,16 +5550,16 @@ public class ResolveTest extends TestCas
ArtifactDownloadReport adr = report.getAllArtifactsReports()[0];
File cacheDir = ivy.getSettings().getDefaultRepositoryCacheBasedir();
- assertEquals(new File(cacheDir, "compression/module2/jars/module2-1.0.jar"),
+ assertEquals(new File(cacheDir, "packaging/module2/jars/module2-1.0.jar"),
adr.getLocalFile());
- assertEquals(new File(cacheDir, "compression/module2/jar_uncompresseds/module2-1.0"),
- adr.getUncompressedLocalDir());
+ assertEquals(new File(cacheDir, "packaging/module2/jar_unpackeds/module2-1.0"),
+ adr.getUnpackedLocalFile());
- File[] jarContents = adr.getUncompressedLocalDir().listFiles();
+ File[] jarContents = adr.getUnpackedLocalFile().listFiles();
Arrays.sort(jarContents);
- assertEquals(new File(adr.getUncompressedLocalDir(), "META-INF"), jarContents[0]);
- assertEquals(new File(adr.getUncompressedLocalDir(), "test.txt"), jarContents[1]);
- assertEquals(new File(adr.getUncompressedLocalDir(), "META-INF/MANIFEST.MF"),
+ assertEquals(new File(adr.getUnpackedLocalFile(), "META-INF"), jarContents[0]);
+ assertEquals(new File(adr.getUnpackedLocalFile(), "test.txt"), jarContents[1]);
+ assertEquals(new File(adr.getUnpackedLocalFile(), "META-INF/MANIFEST.MF"),
jarContents[0].listFiles()[0]);
}
}
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java Sat Jan 4 13:06:37 2014
@@ -307,11 +307,10 @@ public class RetrieveTest extends TestCa
assertEquals(3, artifactsToCopy.size());
}
- public void testUncompress() throws Exception {
+ public void testUnpack() throws Exception {
ResolveOptions roptions = getResolveOptions(new String[] {"*"});
- roptions.setUncompress(true);
- URL url = new File("test/repositories/1/compression/module1/ivys/ivy-1.0.xml").toURI()
+ URL url = new File("test/repositories/1/packaging/module1/ivys/ivy-1.0.xml").toURI()
.toURL();
// normal resolve, the file goes in the cache
@@ -323,10 +322,9 @@ public class RetrieveTest extends TestCa
String pattern = "build/test/retrieve/[organization]/[module]/[conf]/[type]s/[artifact]-[revision](.[ext])";
RetrieveOptions options = getRetrieveOptions();
- options.setUncompress(true);
ivy.retrieve(md.getModuleRevisionId(), pattern, options);
- File dest = new File("build/test/retrieve/compression/module2/default/jars/module2-1.0");
+ File dest = new File("build/test/retrieve/packaging/module2/default/jars/module2-1.0");
assertTrue(dest.exists());
assertTrue(dest.isDirectory());
File[] jarContents = dest.listFiles();
@@ -336,11 +334,10 @@ public class RetrieveTest extends TestCa
assertEquals(new File(dest, "META-INF/MANIFEST.MF"), jarContents[0].listFiles()[0]);
}
- public void testUncompressSync() throws Exception {
+ public void testUnpackSync() throws Exception {
ResolveOptions roptions = getResolveOptions(new String[] {"*"});
- roptions.setUncompress(true);
- URL url = new File("test/repositories/1/compression/module1/ivys/ivy-1.0.xml").toURI()
+ URL url = new File("test/repositories/1/packaging/module1/ivys/ivy-1.0.xml").toURI()
.toURL();
// normal resolve, the file goes in the cache
@@ -352,11 +349,10 @@ public class RetrieveTest extends TestCa
String pattern = "build/test/retrieve/[organization]/[module]/[conf]/[type]s/[artifact]-[revision](.[ext])";
RetrieveOptions options = getRetrieveOptions();
- options.setUncompress(true);
options.setSync(true);
ivy.retrieve(md.getModuleRevisionId(), pattern, options);
- File dest = new File("build/test/retrieve/compression/module2/default/jars/module2-1.0");
+ File dest = new File("build/test/retrieve/packaging/module2/default/jars/module2-1.0");
assertTrue(dest.exists());
assertTrue(dest.isDirectory());
File[] jarContents = dest.listFiles();
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/core/ManifestParserTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/core/ManifestParserTest.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/core/ManifestParserTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/core/ManifestParserTest.java Sat Jan 4 13:06:37 2014
@@ -38,7 +38,7 @@ public class ManifestParserTest extends
assertEquals("20080101", bundleInfo.getVersion().qualifier());
assertEquals("1.0.0.20080101", bundleInfo.getVersion().toString());
assertEquals(2, bundleInfo.getRequires().size());
- Set/* <BundleRequirement> */expectedRequires = new HashSet/* <BundleRequirement> */();
+ Set<BundleRequirement> expectedRequires = new HashSet<BundleRequirement>();
expectedRequires.add(new BundleRequirement(BundleInfo.BUNDLE_TYPE, "com.acme.bravo",
new VersionRange("2.0.0"), null));
expectedRequires.add(new BundleRequirement(BundleInfo.BUNDLE_TYPE, "com.acme.delta",
@@ -59,7 +59,7 @@ public class ManifestParserTest extends
assertEquals("20080202", bundleInfo.getVersion().qualifier());
assertEquals("2.0.0.20080202", bundleInfo.getVersion().toString());
assertEquals(1, bundleInfo.getRequires().size());
- expectedRequires = new HashSet/* <BundleRequirement> */();
+ expectedRequires = new HashSet<BundleRequirement>();
expectedRequires.add(new BundleRequirement(BundleInfo.BUNDLE_TYPE, "com.acme.charlie",
new VersionRange("3.0.0"), null));
assertEquals(1, bundleInfo.getExports().size());
@@ -77,14 +77,15 @@ public class ManifestParserTest extends
} finally {
in.close();
}
- List/* <String> */cp = bundleInfo.getClasspath();
+ List<String> cp = bundleInfo.getClasspath();
assertNotNull(cp);
assertEquals(4, cp.size());
assertEquals(
Arrays.asList(new String[] {"lib/ant-antlr.jar", "lib/ant-apache-bcel.jar",
"lib/ant-apache-bsf.jar", "lib/ant-apache-log4j.jar"}), cp);
- in = this.getClass().getResourceAsStream("/org/apache/ivy/osgi/core/MANIFEST_classpath2.MF");
+ in = this.getClass()
+ .getResourceAsStream("/org/apache/ivy/osgi/core/MANIFEST_classpath2.MF");
try {
bundleInfo = ManifestParser.parseManifest(in);
} finally {
Copied: ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/filter/OSGiFilterTest.java (from r1554557, ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/obr/RequirementFilterTest.java)
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/filter/OSGiFilterTest.java?p2=ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/filter/OSGiFilterTest.java&p1=ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/obr/RequirementFilterTest.java&r1=1554557&r2=1555344&rev=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/obr/RequirementFilterTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/filter/OSGiFilterTest.java Sat Jan 4 13:06:37 2014
@@ -15,49 +15,48 @@
* limitations under the License.
*
*/
-package org.apache.ivy.osgi.obr;
+package org.apache.ivy.osgi.filter;
import java.text.ParseException;
import junit.framework.Assert;
import junit.framework.TestCase;
-import org.apache.ivy.osgi.obr.filter.AndFilter;
-import org.apache.ivy.osgi.obr.filter.CompareFilter;
-import org.apache.ivy.osgi.obr.filter.CompareFilter.Operator;
-import org.apache.ivy.osgi.obr.filter.NotFilter;
-import org.apache.ivy.osgi.obr.filter.RequirementFilterParser;
-import org.apache.ivy.osgi.obr.xml.RequirementFilter;
+import org.apache.ivy.osgi.filter.AndFilter;
+import org.apache.ivy.osgi.filter.CompareFilter;
+import org.apache.ivy.osgi.filter.NotFilter;
+import org.apache.ivy.osgi.filter.OSGiFilterParser;
+import org.apache.ivy.osgi.filter.CompareFilter.Operator;
-public class RequirementFilterTest extends TestCase {
+public class OSGiFilterTest extends TestCase {
public void testParser() throws Exception {
assertParseFail("c>2");
assertParseFail("");
assertParseFail(")");
- RequirementFilter cgt2 = new CompareFilter("c", Operator.GREATER_THAN, "2");
+ OSGiFilter cgt2 = new CompareFilter("c", Operator.GREATER_THAN, "2");
checkParse(cgt2, "(c>2)");
- RequirementFilter twoeqd = new CompareFilter("2", Operator.EQUALS, "d");
+ OSGiFilter twoeqd = new CompareFilter("2", Operator.EQUALS, "d");
checkParse(twoeqd, "(2=d)");
- RequirementFilter foodotbarge0dot0 = new CompareFilter("foo.bar",
+ OSGiFilter foodotbarge0dot0 = new CompareFilter("foo.bar",
Operator.GREATER_OR_EQUAL, "0.0");
checkParse(foodotbarge0dot0, "(foo.bar>=0.0)");
- RequirementFilter and = new AndFilter(new RequirementFilter[] {foodotbarge0dot0});
+ OSGiFilter and = new AndFilter(new OSGiFilter[] {foodotbarge0dot0});
checkParse(and, "(&(foo.bar>=0.0))");
- RequirementFilter and2 = new AndFilter(new RequirementFilter[] {cgt2, twoeqd,
+ OSGiFilter and2 = new AndFilter(new OSGiFilter[] {cgt2, twoeqd,
foodotbarge0dot0});
checkParse(and2, "(&(c>2)(2=d)(foo.bar>=0.0))");
- RequirementFilter spaceAfterAnd = new AndFilter(new RequirementFilter[] {twoeqd});
+ OSGiFilter spaceAfterAnd = new AndFilter(new OSGiFilter[] {twoeqd});
checkParse(spaceAfterAnd, "(& (2=d))");
- RequirementFilter version350 = new CompareFilter("version", Operator.GREATER_OR_EQUAL,
+ OSGiFilter version350 = new CompareFilter("version", Operator.GREATER_OR_EQUAL,
"3.5.0");
- RequirementFilter version400 = new CompareFilter("version", Operator.GREATER_OR_EQUAL,
+ OSGiFilter version400 = new CompareFilter("version", Operator.GREATER_OR_EQUAL,
"4.0.0");
- RequirementFilter notVersion400 = new NotFilter(version400);
- RequirementFilter bundle = new CompareFilter("bundle", Operator.EQUALS,
+ OSGiFilter notVersion400 = new NotFilter(version400);
+ OSGiFilter bundle = new CompareFilter("bundle", Operator.EQUALS,
"org.eclipse.core.runtime");
- RequirementFilter andEverythingWithSpace = new AndFilter(new RequirementFilter[] {
+ OSGiFilter andEverythingWithSpace = new AndFilter(new OSGiFilter[] {
version350, notVersion400, bundle});
checkParse(andEverythingWithSpace,
"(& (version>=3.5.0) (!(version>=4.0.0)) (bundle=org.eclipse.core.runtime) )");
@@ -65,15 +64,15 @@ public class RequirementFilterTest exten
private void assertParseFail(String toParse) {
try {
- RequirementFilterParser.parse(toParse);
+ OSGiFilterParser.parse(toParse);
Assert.fail("Expecting a ParseException");
} catch (ParseException e) {
// OK
}
}
- private void checkParse(RequirementFilter expected, String toParse) throws ParseException {
- RequirementFilter parsed = RequirementFilterParser.parse(toParse);
+ private void checkParse(OSGiFilter expected, String toParse) throws ParseException {
+ OSGiFilter parsed = OSGiFilterParser.parse(toParse);
Assert.assertEquals(expected, parsed);
}
}
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/obr/OBRResolverTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/obr/OBRResolverTest.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/obr/OBRResolverTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/obr/OBRResolverTest.java Sat Jan 4 13:06:37 2014
@@ -22,7 +22,6 @@ import java.io.FileInputStream;
import java.text.ParseException;
import java.util.Arrays;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.jar.JarInputStream;
@@ -45,6 +44,7 @@ import org.apache.ivy.core.resolve.Resol
import org.apache.ivy.core.resolve.ResolveOptions;
import org.apache.ivy.core.resolve.ResolvedModuleRevision;
import org.apache.ivy.core.settings.IvySettings;
+import org.apache.ivy.osgi.core.BundleArtifact;
import org.apache.ivy.osgi.core.BundleInfo;
import org.apache.ivy.osgi.core.BundleInfoAdapter;
import org.apache.ivy.osgi.core.ExecutionEnvironmentProfileProvider;
@@ -97,7 +97,8 @@ public class OBRResolverTest extends Tes
private DualResolver dualResolver;
- private ExecutionEnvironmentProfileProvider profileProvider = ExecutionEnvironmentProfileProvider.getInstance();
+ private ExecutionEnvironmentProfileProvider profileProvider = ExecutionEnvironmentProfileProvider
+ .getInstance();
public void setUp() throws Exception {
settings = new IvySettings();
@@ -154,20 +155,20 @@ public class OBRResolverTest extends Tes
}
public void testSimpleResolve() throws Exception {
- ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE, "org.apache.ivy.osgi.testbundle",
- "1.2.3");
+ ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE,
+ "org.apache.ivy.osgi.testbundle", "1.2.3");
genericTestResolveDownload(bundleResolver, mrid);
}
public void testSimpleUrlResolve() throws Exception {
- ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE, "org.apache.ivy.osgi.testbundle",
- "1.2.3");
+ ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE,
+ "org.apache.ivy.osgi.testbundle", "1.2.3");
genericTestResolveDownload(bundleUrlResolver, mrid);
}
public void testResolveDual() throws Exception {
- ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE, "org.apache.ivy.osgi.testbundle",
- "1.2.3");
+ ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE,
+ "org.apache.ivy.osgi.testbundle", "1.2.3");
genericTestResolveDownload(dualResolver, mrid);
}
@@ -296,25 +297,25 @@ public class OBRResolverTest extends Tes
JarInputStream in = new JarInputStream(new FileInputStream("test/test-repo/bundlerepo/"
+ jarName));
BundleInfo bundleInfo = ManifestParser.parseManifest(in.getManifest());
- bundleInfo.setUri(new File("test/test-repo/bundlerepo/" + jarName).toURI());
+ bundleInfo.addArtifact(new BundleArtifact(false, new File("test/test-repo/bundlerepo/"
+ + jarName).toURI(), null));
DefaultModuleDescriptor md = BundleInfoAdapter.toModuleDescriptor(
OSGiManifestParser.getInstance(), null, bundleInfo, profileProvider);
ResolveReport resolveReport = ivy.resolve(md,
new ResolveOptions().setConfs(new String[] {conf}).setOutputReport(false));
assertFalse("resolve failed " + resolveReport.getAllProblemMessages(),
resolveReport.hasError());
- Set/* <ModuleRevisionId> */actual = new HashSet/* <ModuleRevisionId> */();
- List/* <Artifact> */artifacts = resolveReport.getArtifacts();
- Iterator itArtfact = artifacts.iterator();
- while (itArtfact.hasNext()) {
- Artifact artfact = (Artifact) itArtfact.next();
+ Set<ModuleRevisionId> actual = new HashSet<ModuleRevisionId>();
+ List<Artifact> artifacts = resolveReport.getArtifacts();
+ for (Artifact artfact : artifacts) {
actual.add(artfact.getModuleRevisionId());
}
- Set/* <ModuleRevisionId> */expected = new HashSet(Arrays.asList(expectedMrids));
+ Set<ModuleRevisionId> expected = new HashSet<ModuleRevisionId>(Arrays.asList(expectedMrids));
if (expected2Mrids != null) {
// in this use case, we have two choices, let's try the second one
try {
- Set/* <ModuleRevisionId> */expected2 = new HashSet(Arrays.asList(expected2Mrids));
+ Set<ModuleRevisionId> expected2 = new HashSet<ModuleRevisionId>(
+ Arrays.asList(expected2Mrids));
assertEquals(expected2, actual);
return; // test passed
} catch (AssertionFailedError e) {
@@ -328,7 +329,8 @@ public class OBRResolverTest extends Tes
JarInputStream in = new JarInputStream(new FileInputStream("test/test-repo/bundlerepo/"
+ jarName));
BundleInfo bundleInfo = ManifestParser.parseManifest(in.getManifest());
- bundleInfo.setUri(new File("test/test-repo/bundlerepo/" + jarName).toURI());
+ bundleInfo.addArtifact(new BundleArtifact(false, new File("test/test-repo/bundlerepo/"
+ + jarName).toURI(), null));
DefaultModuleDescriptor md = BundleInfoAdapter.toModuleDescriptor(
OSGiManifestParser.getInstance(), null, bundleInfo, profileProvider);
ResolveReport resolveReport = ivy.resolve(md,
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/p2/P2DescriptorTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/p2/P2DescriptorTest.java?rev=1555344&r1=1555343&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/p2/P2DescriptorTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/osgi/p2/P2DescriptorTest.java Sat Jan 4 13:06:37 2014
@@ -47,6 +47,8 @@ public class P2DescriptorTest extends Te
private UpdateSiteResolver p2ZippedResolver;
+ private UpdateSiteResolver p2WithPackedResolver;
+
private Ivy ivy;
private ResolveData data;
@@ -66,6 +68,13 @@ public class P2DescriptorTest extends Te
p2ZippedResolver.setSettings(settings);
settings.addResolver(p2ZippedResolver);
+ p2WithPackedResolver = new UpdateSiteResolver();
+ p2WithPackedResolver.setName("p2-with-packed");
+ p2WithPackedResolver.setUrl(new File("test/test-p2/packed").toURI().toURL()
+ .toExternalForm());
+ p2WithPackedResolver.setSettings(settings);
+ settings.addResolver(p2WithPackedResolver);
+
cache = new File("build/cache");
cache.mkdirs();
settings.setDefaultCache(cache);
@@ -83,6 +92,11 @@ public class P2DescriptorTest extends Te
data = new ResolveData(ivy.getResolveEngine(), new ResolveOptions());
}
+ @Override
+ protected void tearDown() throws Exception {
+ ivy.getLoggerEngine().sumupProblems();
+ }
+
public void testResolveSource() throws Exception {
settings.setDefaultResolver("p2-sources");
@@ -139,7 +153,6 @@ public class P2DescriptorTest extends Te
assertEquals(1, rmr.getDescriptor().getAllArtifacts().length);
DownloadOptions options = new DownloadOptions();
- options.setUncompress(true);
DownloadReport report = p2ZippedResolver.download(rmr.getDescriptor().getAllArtifacts(),
options);
assertNotNull(report);
@@ -152,7 +165,7 @@ public class P2DescriptorTest extends Te
assertEquals(artifact, ar.getArtifact());
assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());
- assertNull(ar.getUncompressedLocalDir());
+ assertNull(ar.getUnpackedLocalFile());
}
public void testResolveZipped() throws Exception {
@@ -169,7 +182,6 @@ public class P2DescriptorTest extends Te
assertEquals(2, rmr.getDescriptor().getAllArtifacts().length);
DownloadOptions options = new DownloadOptions();
- options.setUncompress(true);
DownloadReport report = p2ZippedResolver.download(rmr.getDescriptor().getAllArtifacts(),
options);
assertNotNull(report);
@@ -180,10 +192,39 @@ public class P2DescriptorTest extends Te
Artifact artifact = rmr.getDescriptor().getAllArtifacts()[i];
ArtifactDownloadReport ar = report.getArtifactReport(artifact);
assertNotNull(ar);
-
+
assertEquals(artifact, ar.getArtifact());
assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());
- assertNotNull(ar.getUncompressedLocalDir());
+ assertNotNull(ar.getUnpackedLocalFile());
}
}
+
+ public void testResolvePacked() throws Exception {
+ settings.setDefaultResolver("p2-with-packed");
+
+ ModuleRevisionId mrid = ModuleRevisionId.newInstance(BundleInfo.BUNDLE_TYPE, "org.junit",
+ "4.10.0.v4_10_0_v20120426-0900");
+
+ ResolvedModuleRevision rmr = p2WithPackedResolver.getDependency(
+ new DefaultDependencyDescriptor(mrid, false), data);
+ assertNotNull(rmr);
+ assertEquals(mrid, rmr.getId());
+
+ assertEquals(1, rmr.getDescriptor().getAllArtifacts().length);
+
+ DownloadOptions options = new DownloadOptions();
+ DownloadReport report = p2WithPackedResolver.download(
+ rmr.getDescriptor().getAllArtifacts(), options);
+ assertNotNull(report);
+
+ assertEquals(1, report.getArtifactsReports().length);
+
+ Artifact artifact = rmr.getDescriptor().getAllArtifacts()[0];
+ ArtifactDownloadReport ar = report.getArtifactReport(artifact);
+ assertNotNull(ar);
+
+ assertEquals(artifact, ar.getArtifact());
+ assertEquals(DownloadStatus.SUCCESSFUL, ar.getDownloadStatus());
+ assertNotNull(ar.getUnpackedLocalFile());
+ }
}
Modified: ant/ivy/core/trunk/test/repositories/1/packaging/module1/ivys/ivy-1.0.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/1/packaging/module1/ivys/ivy-1.0.xml?rev=1555344&r1=1554632&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/repositories/1/packaging/module1/ivys/ivy-1.0.xml (original)
+++ ant/ivy/core/trunk/test/repositories/1/packaging/module1/ivys/ivy-1.0.xml Sat Jan 4 13:06:37 2014
@@ -17,11 +17,11 @@
under the License.
-->
<ivy-module version="1.0">
- <info organisation="compression" module="module1" revision="1.0" />
+ <info organisation="packaging" module="module1" revision="1.0" />
<configurations>
<conf name="default" />
</configurations>
<dependencies>
- <dependency org="compression" name="module2" rev="1.0" />
+ <dependency org="packaging" name="module2" rev="1.0" />
</dependencies>
</ivy-module>
Modified: ant/ivy/core/trunk/test/repositories/1/packaging/module2/ivys/ivy-1.0.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/1/packaging/module2/ivys/ivy-1.0.xml?rev=1555344&r1=1554632&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/repositories/1/packaging/module2/ivys/ivy-1.0.xml (original)
+++ ant/ivy/core/trunk/test/repositories/1/packaging/module2/ivys/ivy-1.0.xml Sat Jan 4 13:06:37 2014
@@ -17,11 +17,11 @@
under the License.
-->
<ivy-module version="1.0">
- <info organisation="compression" module="module2" revision="1.0" />
+ <info organisation="packaging" module="module2" revision="1.0" />
<configurations>
<conf name="default" />
</configurations>
<publications>
- <artifact name="module2" type="jar" ext="jar" compression="jar" />
+ <artifact name="module2" type="jar" ext="jar" packaging="jar" />
</publications>
</ivy-module>
Modified: ant/ivy/core/trunk/test/repositories/1/packaging/module3/ivys/ivy-1.0.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/1/packaging/module3/ivys/ivy-1.0.xml?rev=1555344&r1=1554632&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/repositories/1/packaging/module3/ivys/ivy-1.0.xml (original)
+++ ant/ivy/core/trunk/test/repositories/1/packaging/module3/ivys/ivy-1.0.xml Sat Jan 4 13:06:37 2014
@@ -17,11 +17,11 @@
under the License.
-->
<ivy-module version="1.0">
- <info organisation="compression" module="module3" revision="1.0" />
+ <info organisation="packaging" module="module3" revision="1.0" />
<configurations>
<conf name="default" />
</configurations>
<publications>
- <artifact name="module3" type="jar" ext="jar" compression="jar" />
+ <artifact name="module3" type="jar" ext="jar" packaging="jar" />
</publications>
</ivy-module>
Modified: ant/ivy/core/trunk/test/repositories/1/packaging/module4/ivys/ivy-1.0.xml
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/repositories/1/packaging/module4/ivys/ivy-1.0.xml?rev=1555344&r1=1554632&r2=1555344&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/repositories/1/packaging/module4/ivys/ivy-1.0.xml (original)
+++ ant/ivy/core/trunk/test/repositories/1/packaging/module4/ivys/ivy-1.0.xml Sat Jan 4 13:06:37 2014
@@ -17,11 +17,11 @@
under the License.
-->
<ivy-module version="1.0">
- <info organisation="compression" module="module4" revision="1.0" />
+ <info organisation="packaging" module="module4" revision="1.0" />
<configurations>
<conf name="default" />
</configurations>
<publications>
- <artifact name="module4" type="jar" ext="jar" compression="jar" />
+ <artifact name="module4" type="jar" ext="jar" packaging="jar" />
</publications>
</ivy-module>