svn_apply_autoprops, mainly for line endings

git-svn-id: https://svn.apache.org/repos/asf/ant/ivy/core/trunk@1049146 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nicolas Lalevee 2010-12-14 16:28:01 +00:00
parent 1959884c91
commit 88d62a6976
219 changed files with 9878 additions and 9878 deletions

View File

@ -1,47 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<projectDescription>
<name>ivy</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<projectDescription>
<name>ivy</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>com.atlassw.tools.eclipse.checkstyle.CheckstyleNature</nature>
</natures>
</projectDescription>

View File

@ -1,38 +1,38 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivysettings>
<property name="upload.url" value="https://repository.apache.org/service/local/staging/deploy/maven2" />
<property name="pgp.keyId" value="auto" override="false" />
<credentials host="repository.apache.org" realm="Sonatype Nexus Repository Manager" username="${upload.user}" passwd="${upload.password}"/>
<signers>
<pgp name="apache-sig" secring="${user.home}/.gnupg/secring.gpg" password="${pgp.password}" keyId="${pgp.keyId}"/>
</signers>
<settings defaultResolver="default" />
<resolvers>
<chain name="default">
<ibiblio name="public" m2compatible="true" />
<ibiblio name="snapshot" m2compatible="true" root="http://people.apache.org/repo/m2-snapshot-repository" />
</chain>
<url name="nexus" m2compatible="true" signer="apache-sig">
<artifact pattern="${upload.url}/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]" />
</url>
</resolvers>
</ivysettings>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivysettings>
<property name="upload.url" value="https://repository.apache.org/service/local/staging/deploy/maven2" />
<property name="pgp.keyId" value="auto" override="false" />
<credentials host="repository.apache.org" realm="Sonatype Nexus Repository Manager" username="${upload.user}" passwd="${upload.password}"/>
<signers>
<pgp name="apache-sig" secring="${user.home}/.gnupg/secring.gpg" password="${pgp.password}" keyId="${pgp.keyId}"/>
</signers>
<settings defaultResolver="default" />
<resolvers>
<chain name="default">
<ibiblio name="public" m2compatible="true" />
<ibiblio name="snapshot" m2compatible="true" root="http://people.apache.org/repo/m2-snapshot-repository" />
</chain>
<url name="nexus" m2compatible="true" signer="apache-sig">
<artifact pattern="${upload.url}/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier]).[ext]" />
</url>
</resolvers>
</ivysettings>

View File

@ -1,39 +1,39 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.cache;
public class CacheDownloadOptions {
private DownloadListener listener = null;
private boolean force = false;
public DownloadListener getListener() {
return listener;
}
public CacheDownloadOptions setListener(DownloadListener listener) {
this.listener = listener;
return this;
}
public boolean isForce() {
return force;
}
public CacheDownloadOptions setForce(boolean force) {
this.force = force;
return this;
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.cache;
public class CacheDownloadOptions {
private DownloadListener listener = null;
private boolean force = false;
public DownloadListener getListener() {
return listener;
}
public CacheDownloadOptions setListener(DownloadListener listener) {
this.listener = listener;
return this;
}
public boolean isForce() {
return force;
}
public CacheDownloadOptions setForce(boolean force) {
this.force = force;
return this;
}
}

View File

@ -1,34 +1,34 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.cache;
import java.io.File;
import org.apache.ivy.core.module.descriptor.Artifact;
import org.apache.ivy.core.report.ArtifactDownloadReport;
import org.apache.ivy.plugins.resolver.util.ResolvedResource;
public interface DownloadListener {
public void needArtifact(RepositoryCacheManager cache, Artifact artifact);
public void startArtifactDownload(
RepositoryCacheManager cache, ResolvedResource rres,
Artifact artifact, ArtifactOrigin origin);
public void endArtifactDownload(
RepositoryCacheManager cache, Artifact artifact,
ArtifactDownloadReport adr, File archiveFile);
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.cache;
import java.io.File;
import org.apache.ivy.core.module.descriptor.Artifact;
import org.apache.ivy.core.report.ArtifactDownloadReport;
import org.apache.ivy.plugins.resolver.util.ResolvedResource;
public interface DownloadListener {
public void needArtifact(RepositoryCacheManager cache, Artifact artifact);
public void startArtifactDownload(
RepositoryCacheManager cache, ResolvedResource rres,
Artifact artifact, ArtifactOrigin origin);
public void endArtifactDownload(
RepositoryCacheManager cache, Artifact artifact,
ArtifactDownloadReport adr, File archiveFile);
}

View File

@ -1,168 +1,168 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.cache;
import java.text.ParseException;
import org.apache.ivy.core.module.descriptor.Artifact;
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.report.ArtifactDownloadReport;
import org.apache.ivy.core.resolve.ResolvedModuleRevision;
import org.apache.ivy.plugins.repository.ArtifactResourceResolver;
import org.apache.ivy.plugins.repository.ResourceDownloader;
import org.apache.ivy.plugins.resolver.DependencyResolver;
import org.apache.ivy.plugins.resolver.util.ResolvedResource;
public interface RepositoryCacheManager {
/**
* Returns the name of the repository cache manager.
* @return the name of the repository cache manager.
*/
public abstract String getName();
/**
* Saves the information of which resolvers were used to resolve a module (both for metadata and
* artifact), so that this info can be loaded later (even after a jvm restart) for the use of
* {@link #findModuleInCache(DependencyDescriptor, CacheMetadataOptions, String)}.
*
* @param md
* the module descriptor resolved
* @param metadataResolverName
* metadata resolver name
* @param artifactResolverName
* artifact resolver name
*/
public abstract void saveResolvers(
ModuleDescriptor descriptor, String metadataResolverName, String artifactResolverName);
/**
* Returns the artifact origin of the given artifact as saved in this cache.
* <p>
* If the origin is unknown, the returned ArtifactOrigin instance will return true when
* {@link ArtifactOrigin#isUnknown(ArtifactOrigin)} is called.
*
* @param artifact
* the artifact for which the saved artifact origin should be returned.
* @return the artifact origin of the given artifact as saved in this cache
*/
public abstract ArtifactOrigin getSavedArtifactOrigin(Artifact artifact);
/**
* Search a module descriptor in cache for a mrid
*
* @param dd
* the dependency descriptor identifying the module to search
* @param requestedRevisionId
* the requested dependency module revision id identifying the module to search
* @param options
* options on how caching should be handled
* @param expectedResolver
* the resolver with which the md in cache must have been resolved to be returned,
* null if this doesn't matter
* @return the ResolvedModuleRevision corresponding to the module found, null if none correct
* has been found in cache
*/
public abstract ResolvedModuleRevision findModuleInCache(
DependencyDescriptor dd, ModuleRevisionId requestedRevisionId,
CacheMetadataOptions options, String expectedResolver);
/**
* Downloads an artifact to this cache.
*
* @param artifact
* the artifact to download
* @param resourceResolver
* a resource resolver to use if the artifact needs to be resolved to a Resource for
* downloading
* @param resourceDownloader
* a resource downloader to use if actual download of the resource is needed
* @param options
* a set of options to adjust the download
* @return a report indicating how the download was performed
*/
public abstract ArtifactDownloadReport download(
Artifact artifact,
ArtifactResourceResolver resourceResolver,
ResourceDownloader resourceDownloader,
CacheDownloadOptions options);
/**
* Caches an original module descriptor.
* <p>
* After this call, the original module descriptor file (with no modification nor conversion)
* should be available as a local file.
* </p>
*
* @param resolver
* the dependency resolver from which the cache request comes from
* @param orginalMetadataRef
* a resolved resource pointing to the remote original module descriptor
* @param dd
* the dependency descriptor for which the module descriptor should be cached
* @param requestedMetadataArtifact
* the module descriptor artifact as requested originally
* @param downloader
* a ResourceDownloader able to download the original module descriptor resource if
* required by this cache implementation
* @param options
* options to apply to cache this module descriptor
* @return a {@link ResolvedModuleRevision} representing the local cached module descriptor, or
* null if it failed
* @throws ParseException
* if an exception occurred while parsing the module descriptor
*/
public ResolvedModuleRevision cacheModuleDescriptor(DependencyResolver resolver,
ResolvedResource orginalMetadataRef, DependencyDescriptor dd,
Artifact requestedMetadataArtifact, ResourceDownloader downloader,
CacheMetadataOptions options) throws ParseException;
/**
* Stores a standardized version of an original module descriptor in the cache for later use.
*
* @param resolver
* the dependency resolver from which the cache request comes from
* @param orginalMetadataRef
* a resolved resource pointing to the remote original module descriptor
* @param requestedMetadataArtifact
* the module descriptor artifact as requested originally
* @param rmr
* the {@link ResolvedModuleRevision} representing the local cached module descriptor
* @param writer
* a {@link ModuleDescriptorWriter} able to write the module descriptor to a stream.
*/
public void originalToCachedModuleDescriptor(DependencyResolver resolver,
ResolvedResource orginalMetadataRef, Artifact requestedMetadataArtifact,
ResolvedModuleRevision rmr, ModuleDescriptorWriter writer);
/**
* Cleans the whole cache.
*/
public void clean();
/**
* Caches a dynamic revision constraint resolution.
*
* @param dynamicMrid the dynamic module revision id
* @param revision the resolved revision
*/
public void saveResolvedRevision(ModuleRevisionId dynamicMrid, String revision);
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.cache;
import java.text.ParseException;
import org.apache.ivy.core.module.descriptor.Artifact;
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.report.ArtifactDownloadReport;
import org.apache.ivy.core.resolve.ResolvedModuleRevision;
import org.apache.ivy.plugins.repository.ArtifactResourceResolver;
import org.apache.ivy.plugins.repository.ResourceDownloader;
import org.apache.ivy.plugins.resolver.DependencyResolver;
import org.apache.ivy.plugins.resolver.util.ResolvedResource;
public interface RepositoryCacheManager {
/**
* Returns the name of the repository cache manager.
* @return the name of the repository cache manager.
*/
public abstract String getName();
/**
* Saves the information of which resolvers were used to resolve a module (both for metadata and
* artifact), so that this info can be loaded later (even after a jvm restart) for the use of
* {@link #findModuleInCache(DependencyDescriptor, CacheMetadataOptions, String)}.
*
* @param md
* the module descriptor resolved
* @param metadataResolverName
* metadata resolver name
* @param artifactResolverName
* artifact resolver name
*/
public abstract void saveResolvers(
ModuleDescriptor descriptor, String metadataResolverName, String artifactResolverName);
/**
* Returns the artifact origin of the given artifact as saved in this cache.
* <p>
* If the origin is unknown, the returned ArtifactOrigin instance will return true when
* {@link ArtifactOrigin#isUnknown(ArtifactOrigin)} is called.
*
* @param artifact
* the artifact for which the saved artifact origin should be returned.
* @return the artifact origin of the given artifact as saved in this cache
*/
public abstract ArtifactOrigin getSavedArtifactOrigin(Artifact artifact);
/**
* Search a module descriptor in cache for a mrid
*
* @param dd
* the dependency descriptor identifying the module to search
* @param requestedRevisionId
* the requested dependency module revision id identifying the module to search
* @param options
* options on how caching should be handled
* @param expectedResolver
* the resolver with which the md in cache must have been resolved to be returned,
* null if this doesn't matter
* @return the ResolvedModuleRevision corresponding to the module found, null if none correct
* has been found in cache
*/
public abstract ResolvedModuleRevision findModuleInCache(
DependencyDescriptor dd, ModuleRevisionId requestedRevisionId,
CacheMetadataOptions options, String expectedResolver);
/**
* Downloads an artifact to this cache.
*
* @param artifact
* the artifact to download
* @param resourceResolver
* a resource resolver to use if the artifact needs to be resolved to a Resource for
* downloading
* @param resourceDownloader
* a resource downloader to use if actual download of the resource is needed
* @param options
* a set of options to adjust the download
* @return a report indicating how the download was performed
*/
public abstract ArtifactDownloadReport download(
Artifact artifact,
ArtifactResourceResolver resourceResolver,
ResourceDownloader resourceDownloader,
CacheDownloadOptions options);
/**
* Caches an original module descriptor.
* <p>
* After this call, the original module descriptor file (with no modification nor conversion)
* should be available as a local file.
* </p>
*
* @param resolver
* the dependency resolver from which the cache request comes from
* @param orginalMetadataRef
* a resolved resource pointing to the remote original module descriptor
* @param dd
* the dependency descriptor for which the module descriptor should be cached
* @param requestedMetadataArtifact
* the module descriptor artifact as requested originally
* @param downloader
* a ResourceDownloader able to download the original module descriptor resource if
* required by this cache implementation
* @param options
* options to apply to cache this module descriptor
* @return a {@link ResolvedModuleRevision} representing the local cached module descriptor, or
* null if it failed
* @throws ParseException
* if an exception occurred while parsing the module descriptor
*/
public ResolvedModuleRevision cacheModuleDescriptor(DependencyResolver resolver,
ResolvedResource orginalMetadataRef, DependencyDescriptor dd,
Artifact requestedMetadataArtifact, ResourceDownloader downloader,
CacheMetadataOptions options) throws ParseException;
/**
* Stores a standardized version of an original module descriptor in the cache for later use.
*
* @param resolver
* the dependency resolver from which the cache request comes from
* @param orginalMetadataRef
* a resolved resource pointing to the remote original module descriptor
* @param requestedMetadataArtifact
* the module descriptor artifact as requested originally
* @param rmr
* the {@link ResolvedModuleRevision} representing the local cached module descriptor
* @param writer
* a {@link ModuleDescriptorWriter} able to write the module descriptor to a stream.
*/
public void originalToCachedModuleDescriptor(DependencyResolver resolver,
ResolvedResource orginalMetadataRef, Artifact requestedMetadataArtifact,
ResolvedModuleRevision rmr, ModuleDescriptorWriter writer);
/**
* Cleans the whole cache.
*/
public void clean();
/**
* Caches a dynamic revision constraint resolution.
*
* @param dynamicMrid the dynamic module revision id
* @param revision the resolved revision
*/
public void saveResolvedRevision(ModuleRevisionId dynamicMrid, String revision);
}

View File

@ -1,39 +1,39 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.cache;
import java.io.File;
import org.apache.ivy.core.module.id.ModuleRevisionId;
public interface ResolutionCacheManager {
public abstract File getResolutionCacheRoot();
public abstract File getResolvedIvyFileInCache(ModuleRevisionId mrid);
public abstract File getResolvedIvyPropertiesInCache(ModuleRevisionId mrid);
public abstract File getConfigurationResolveReportInCache(String resolveId, String conf);
public abstract File[] getConfigurationResolveReportsInCache(final String resolveId);
/**
* Cleans the whole cache.
*/
public void clean();
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.cache;
import java.io.File;
import org.apache.ivy.core.module.id.ModuleRevisionId;
public interface ResolutionCacheManager {
public abstract File getResolutionCacheRoot();
public abstract File getResolvedIvyFileInCache(ModuleRevisionId mrid);
public abstract File getResolvedIvyPropertiesInCache(ModuleRevisionId mrid);
public abstract File getConfigurationResolveReportInCache(String resolveId, String conf);
public abstract File[] getConfigurationResolveReportsInCache(final String resolveId);
/**
* Cleans the whole cache.
*/
public void clean();
}

View File

@ -1,31 +1,31 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.event.retrieve;
import java.io.File;
import org.apache.ivy.core.report.ArtifactDownloadReport;
public class EndRetrieveArtifactEvent extends RetrieveArtifactEvent {
public static final String NAME = "post-retrieve-artifact";
public EndRetrieveArtifactEvent(
ArtifactDownloadReport report, File destFile) {
super(NAME, report, destFile);
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.event.retrieve;
import java.io.File;
import org.apache.ivy.core.report.ArtifactDownloadReport;
public class EndRetrieveArtifactEvent extends RetrieveArtifactEvent {
public static final String NAME = "post-retrieve-artifact";
public EndRetrieveArtifactEvent(
ArtifactDownloadReport report, File destFile) {
super(NAME, report, destFile);
}
}

View File

@ -1,83 +1,83 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.event.retrieve;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.retrieve.RetrieveOptions;
public class EndRetrieveEvent extends RetrieveEvent {
public static final String NAME = "post-retrieve";
private long duration;
private int nbCopied;
private int nbUpToDate;
private long totalCopiedSize;
public EndRetrieveEvent(ModuleRevisionId mrid, String[] confs, long elapsedTime,
int targetsCopied, int targetsUpToDate, long totalCopiedSize, RetrieveOptions options) {
super(NAME, mrid, confs, options);
this.duration = elapsedTime;
this.nbCopied = targetsCopied;
this.nbUpToDate = targetsUpToDate;
this.totalCopiedSize = totalCopiedSize;
addAttribute("duration", String.valueOf(elapsedTime));
addAttribute("size", String.valueOf(totalCopiedSize));
addAttribute("nbCopied", String.valueOf(targetsCopied));
addAttribute("nbUptodate", String.valueOf(targetsUpToDate));
}
/**
* Duration of the retrieve operation, in ms.
*
* @return Duration of the retrieve operation, in ms.
*/
public long getDuration() {
return duration;
}
/**
* Number of artifacts which were copied (or symlinked) during the retrieve
*
* @return Number of artifacts which were copied during the retrieve.
*/
public int getNbCopied() {
return nbCopied;
}
/**
* Number of artifacts which were not copied since they were already present and up to date.
*
* @return Number of artifacts which were not copied since they were already present and up to
* date.
*/
public int getNbUpToDate() {
return nbUpToDate;
}
/**
* Total size of all copied (or symlinked) artifacts, in bytes.
* @return Total size of all copied (or symlinked) artifacts, in bytes.
*/
public long getTotalCopiedSize() {
return totalCopiedSize;
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.event.retrieve;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.retrieve.RetrieveOptions;
public class EndRetrieveEvent extends RetrieveEvent {
public static final String NAME = "post-retrieve";
private long duration;
private int nbCopied;
private int nbUpToDate;
private long totalCopiedSize;
public EndRetrieveEvent(ModuleRevisionId mrid, String[] confs, long elapsedTime,
int targetsCopied, int targetsUpToDate, long totalCopiedSize, RetrieveOptions options) {
super(NAME, mrid, confs, options);
this.duration = elapsedTime;
this.nbCopied = targetsCopied;
this.nbUpToDate = targetsUpToDate;
this.totalCopiedSize = totalCopiedSize;
addAttribute("duration", String.valueOf(elapsedTime));
addAttribute("size", String.valueOf(totalCopiedSize));
addAttribute("nbCopied", String.valueOf(targetsCopied));
addAttribute("nbUptodate", String.valueOf(targetsUpToDate));
}
/**
* Duration of the retrieve operation, in ms.
*
* @return Duration of the retrieve operation, in ms.
*/
public long getDuration() {
return duration;
}
/**
* Number of artifacts which were copied (or symlinked) during the retrieve
*
* @return Number of artifacts which were copied during the retrieve.
*/
public int getNbCopied() {
return nbCopied;
}
/**
* Number of artifacts which were not copied since they were already present and up to date.
*
* @return Number of artifacts which were not copied since they were already present and up to
* date.
*/
public int getNbUpToDate() {
return nbUpToDate;
}
/**
* Total size of all copied (or symlinked) artifacts, in bytes.
* @return Total size of all copied (or symlinked) artifacts, in bytes.
*/
public long getTotalCopiedSize() {
return totalCopiedSize;
}
}

View File

@ -1,57 +1,57 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.event.retrieve;
import java.io.File;
import org.apache.ivy.core.event.IvyEvent;
import org.apache.ivy.core.module.descriptor.Artifact;
import org.apache.ivy.core.report.ArtifactDownloadReport;
public class RetrieveArtifactEvent extends IvyEvent {
private ArtifactDownloadReport report;
private File destFile;
public RetrieveArtifactEvent(
String name,
ArtifactDownloadReport report, File destFile) {
super(name);
addArtifactAttributes(report.getArtifact());
this.report = report;
this.destFile = destFile;
addAttribute("from", report.getLocalFile().getAbsolutePath());
addAttribute("to", destFile.getAbsolutePath());
addAttribute("size", String.valueOf(destFile.length()));
}
protected void addArtifactAttributes(Artifact artifact) {
addMridAttributes(artifact.getModuleRevisionId());
addAttributes(artifact.getAttributes());
addAttribute("metadata", String.valueOf(artifact.isMetadata()));
}
public File getDestFile() {
return destFile;
}
public ArtifactDownloadReport getReport() {
return report;
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.event.retrieve;
import java.io.File;
import org.apache.ivy.core.event.IvyEvent;
import org.apache.ivy.core.module.descriptor.Artifact;
import org.apache.ivy.core.report.ArtifactDownloadReport;
public class RetrieveArtifactEvent extends IvyEvent {
private ArtifactDownloadReport report;
private File destFile;
public RetrieveArtifactEvent(
String name,
ArtifactDownloadReport report, File destFile) {
super(name);
addArtifactAttributes(report.getArtifact());
this.report = report;
this.destFile = destFile;
addAttribute("from", report.getLocalFile().getAbsolutePath());
addAttribute("to", destFile.getAbsolutePath());
addAttribute("size", String.valueOf(destFile.length()));
}
protected void addArtifactAttributes(Artifact artifact) {
addMridAttributes(artifact.getModuleRevisionId());
addAttributes(artifact.getAttributes());
addAttribute("metadata", String.valueOf(artifact.isMetadata()));
}
public File getDestFile() {
return destFile;
}
public ArtifactDownloadReport getReport() {
return report;
}
}

View File

@ -1,46 +1,46 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.event.retrieve;
import org.apache.ivy.core.event.IvyEvent;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.retrieve.RetrieveOptions;
public class RetrieveEvent extends IvyEvent {
private ModuleRevisionId mrid;
private RetrieveOptions options;
protected RetrieveEvent(String name, ModuleRevisionId mrid,
String[] confs, RetrieveOptions options) {
super(name);
this.mrid = mrid;
addMridAttributes(mrid);
addConfsAttribute(confs);
addAttribute("symlink", String.valueOf(options.isMakeSymlinks()));
addAttribute("sync", String.valueOf(options.isSync()));
this.options = options;
}
public ModuleRevisionId getModuleRevisionId() {
return mrid;
}
public RetrieveOptions getOptions() {
return options;
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.event.retrieve;
import org.apache.ivy.core.event.IvyEvent;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.retrieve.RetrieveOptions;
public class RetrieveEvent extends IvyEvent {
private ModuleRevisionId mrid;
private RetrieveOptions options;
protected RetrieveEvent(String name, ModuleRevisionId mrid,
String[] confs, RetrieveOptions options) {
super(name);
this.mrid = mrid;
addMridAttributes(mrid);
addConfsAttribute(confs);
addAttribute("symlink", String.valueOf(options.isMakeSymlinks()));
addAttribute("sync", String.valueOf(options.isSync()));
this.options = options;
}
public ModuleRevisionId getModuleRevisionId() {
return mrid;
}
public RetrieveOptions getOptions() {
return options;
}
}

View File

@ -1,31 +1,31 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.event.retrieve;
import java.io.File;
import org.apache.ivy.core.report.ArtifactDownloadReport;
public class StartRetrieveArtifactEvent extends RetrieveArtifactEvent {
public static final String NAME = "pre-retrieve-artifact";
public StartRetrieveArtifactEvent(
ArtifactDownloadReport report, File destFile) {
super(NAME, report, destFile);
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.event.retrieve;
import java.io.File;
import org.apache.ivy.core.report.ArtifactDownloadReport;
public class StartRetrieveArtifactEvent extends RetrieveArtifactEvent {
public static final String NAME = "pre-retrieve-artifact";
public StartRetrieveArtifactEvent(
ArtifactDownloadReport report, File destFile) {
super(NAME, report, destFile);
}
}

View File

@ -1,29 +1,29 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.event.retrieve;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.retrieve.RetrieveOptions;
public class StartRetrieveEvent extends RetrieveEvent {
public static final String NAME = "pre-retrieve";
public StartRetrieveEvent(ModuleRevisionId mrid, String[] confs, RetrieveOptions options) {
super(NAME, mrid, confs, options);
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.event.retrieve;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.retrieve.RetrieveOptions;
public class StartRetrieveEvent extends RetrieveEvent {
public static final String NAME = "pre-retrieve";
public StartRetrieveEvent(ModuleRevisionId mrid, String[] confs, RetrieveOptions options) {
super(NAME, mrid, confs, options);
}
}

View File

@ -1,72 +1,72 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.module.descriptor;
import java.util.Iterator;
import java.util.Map;
/**
* A configuration which is actually a group of several configurations.
*/
public class ConfigurationGroup extends Configuration {
private final Map/*<String, Configuration>*/ members;
public ConfigurationGroup(String confName, Map /*<String, Configuration>*/ members) {
super(confName);
this.members = members;
}
/**
* Returns the list of configurations' names this object is a group of.
* <p>
* This list is built from the configuration name, if some of these configuration names have
* actually not been recognized in the module, they will be <code>null</code> when accessed from
* {@link #getIntersectedConfiguration(String)}.
* </p>
*
* @return the list of configurations' names this object is an intersection of.
*/
public String[] getMembersConfigurationNames() {
return (String[]) members.keySet()
.toArray(new String[members.size()]);
}
/**
* Returns the {@link Configuration} object for the given conf name, or
* <code>null</code> if the given conf name is not part of this group or if this conf
* name isn't defined in the module in which this group has been built.
*
* @param confName
* the name of the configuration to return.
* @return the member {@link Configuration} object for the given conf name
*/
public Configuration getMemberConfiguration(String confName) {
return (Configuration) members.get(confName);
}
public Visibility getVisibility() {
for (Iterator it = members.values().iterator(); it.hasNext();) {
Configuration c = (Configuration) it.next();
if (c != null && Visibility.PRIVATE.equals(c.getVisibility())) {
return Visibility.PRIVATE;
}
}
return Visibility.PUBLIC;
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.module.descriptor;
import java.util.Iterator;
import java.util.Map;
/**
* A configuration which is actually a group of several configurations.
*/
public class ConfigurationGroup extends Configuration {
private final Map/*<String, Configuration>*/ members;
public ConfigurationGroup(String confName, Map /*<String, Configuration>*/ members) {
super(confName);
this.members = members;
}
/**
* Returns the list of configurations' names this object is a group of.
* <p>
* This list is built from the configuration name, if some of these configuration names have
* actually not been recognized in the module, they will be <code>null</code> when accessed from
* {@link #getIntersectedConfiguration(String)}.
* </p>
*
* @return the list of configurations' names this object is an intersection of.
*/
public String[] getMembersConfigurationNames() {
return (String[]) members.keySet()
.toArray(new String[members.size()]);
}
/**
* Returns the {@link Configuration} object for the given conf name, or
* <code>null</code> if the given conf name is not part of this group or if this conf
* name isn't defined in the module in which this group has been built.
*
* @param confName
* the name of the configuration to return.
* @return the member {@link Configuration} object for the given conf name
*/
public Configuration getMemberConfiguration(String confName) {
return (Configuration) members.get(confName);
}
public Visibility getVisibility() {
for (Iterator it = members.values().iterator(); it.hasNext();) {
Configuration c = (Configuration) it.next();
if (c != null && Visibility.PRIVATE.equals(c.getVisibility())) {
return Visibility.PRIVATE;
}
}
return Visibility.PUBLIC;
}
}

View File

@ -1,72 +1,72 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.module.descriptor;
import java.util.Iterator;
import java.util.Map;
/**
* A configuration which is actually the intersection of several configurations.
*/
public class ConfigurationIntersection extends Configuration {
private final Map/*<String, Configuration>*/ intersectedConfs;
public ConfigurationIntersection(String confName, Map /*<String, Configuration>*/ intersectedConfs) {
super(confName);
this.intersectedConfs = intersectedConfs;
}
/**
* Returns the list of configurations' names this object is an intersection of.
* <p>
* This list is built from the configuration name, if some of these configuration names have
* actually not been recognized in the module, they will be <code>null</code> when accessed from
* {@link #getIntersectedConfiguration(String)}.
* </p>
*
* @return the list of configurations' names this object is an intersection of.
*/
public String[] getIntersectedConfigurationNames() {
return (String[]) intersectedConfs.keySet()
.toArray(new String[intersectedConfs.size()]);
}
/**
* Returns the intersected {@link Configuration} object for the given conf name, or
* <code>null</code> if the given conf name is not part of this intersection or if this conf
* name isn't defined in the module in which this intersection has been built.
*
* @param confName
* the name of the configuration to return.
* @return the intersected {@link Configuration} object for the given conf name
*/
public Configuration getIntersectedConfiguration(String confName) {
return (Configuration) intersectedConfs.get(confName);
}
public Visibility getVisibility() {
for (Iterator it = intersectedConfs.values().iterator(); it.hasNext();) {
Configuration c = (Configuration) it.next();
if (c != null && Visibility.PRIVATE.equals(c.getVisibility())) {
return Visibility.PRIVATE;
}
}
return Visibility.PUBLIC;
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.module.descriptor;
import java.util.Iterator;
import java.util.Map;
/**
* A configuration which is actually the intersection of several configurations.
*/
public class ConfigurationIntersection extends Configuration {
private final Map/*<String, Configuration>*/ intersectedConfs;
public ConfigurationIntersection(String confName, Map /*<String, Configuration>*/ intersectedConfs) {
super(confName);
this.intersectedConfs = intersectedConfs;
}
/**
* Returns the list of configurations' names this object is an intersection of.
* <p>
* This list is built from the configuration name, if some of these configuration names have
* actually not been recognized in the module, they will be <code>null</code> when accessed from
* {@link #getIntersectedConfiguration(String)}.
* </p>
*
* @return the list of configurations' names this object is an intersection of.
*/
public String[] getIntersectedConfigurationNames() {
return (String[]) intersectedConfs.keySet()
.toArray(new String[intersectedConfs.size()]);
}
/**
* Returns the intersected {@link Configuration} object for the given conf name, or
* <code>null</code> if the given conf name is not part of this intersection or if this conf
* name isn't defined in the module in which this intersection has been built.
*
* @param confName
* the name of the configuration to return.
* @return the intersected {@link Configuration} object for the given conf name
*/
public Configuration getIntersectedConfiguration(String confName) {
return (Configuration) intersectedConfs.get(confName);
}
public Visibility getVisibility() {
for (Iterator it = intersectedConfs.values().iterator(); it.hasNext();) {
Configuration c = (Configuration) it.next();
if (c != null && Visibility.PRIVATE.equals(c.getVisibility())) {
return Visibility.PRIVATE;
}
}
return Visibility.PUBLIC;
}
}

View File

@ -1,79 +1,79 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.module.descriptor;
import java.util.ArrayList;
import java.util.List;
import org.apache.ivy.core.module.id.ModuleRevisionId;
public class DefaultExtendsDescriptor implements ExtendsDescriptor {
private ModuleRevisionId parentRevisionId;
private ModuleRevisionId resolvedParentRevisionId;
private String location;
private List extendsTypes;
public DefaultExtendsDescriptor(ModuleRevisionId parentRevisionId,
ModuleRevisionId resolvedParentRevisionId,
String location, String[] types) {
this.parentRevisionId = parentRevisionId;
this.resolvedParentRevisionId = resolvedParentRevisionId;
this.location = location;
this.extendsTypes = new ArrayList(types.length);
for (int i = 0; i < types.length; ++i) {
extendsTypes.add(types[i]);
}
}
public ModuleRevisionId getParentRevisionId() {
return parentRevisionId;
}
public ModuleRevisionId getResolvedParentRevisionId() {
return resolvedParentRevisionId;
}
public String getLocation() {
return location;
}
public String[] getExtendsTypes() {
return (String[]) extendsTypes.toArray(new String[extendsTypes.size()]);
}
public boolean isAllInherited() {
return extendsTypes.contains("all");
}
public boolean isInfoInherited() {
return isAllInherited() || extendsTypes.contains("info");
}
public boolean isDescriptionInherited() {
return isAllInherited() || extendsTypes.contains("description");
}
public boolean areConfigurationsInherited() {
return isAllInherited() || extendsTypes.contains("configurations");
}
public boolean areDependenciesInherited() {
return isAllInherited() || extendsTypes.contains("dependencies");
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.module.descriptor;
import java.util.ArrayList;
import java.util.List;
import org.apache.ivy.core.module.id.ModuleRevisionId;
public class DefaultExtendsDescriptor implements ExtendsDescriptor {
private ModuleRevisionId parentRevisionId;
private ModuleRevisionId resolvedParentRevisionId;
private String location;
private List extendsTypes;
public DefaultExtendsDescriptor(ModuleRevisionId parentRevisionId,
ModuleRevisionId resolvedParentRevisionId,
String location, String[] types) {
this.parentRevisionId = parentRevisionId;
this.resolvedParentRevisionId = resolvedParentRevisionId;
this.location = location;
this.extendsTypes = new ArrayList(types.length);
for (int i = 0; i < types.length; ++i) {
extendsTypes.add(types[i]);
}
}
public ModuleRevisionId getParentRevisionId() {
return parentRevisionId;
}
public ModuleRevisionId getResolvedParentRevisionId() {
return resolvedParentRevisionId;
}
public String getLocation() {
return location;
}
public String[] getExtendsTypes() {
return (String[]) extendsTypes.toArray(new String[extendsTypes.size()]);
}
public boolean isAllInherited() {
return extendsTypes.contains("all");
}
public boolean isInfoInherited() {
return isAllInherited() || extendsTypes.contains("info");
}
public boolean isDescriptionInherited() {
return isAllInherited() || extendsTypes.contains("description");
}
public boolean areConfigurationsInherited() {
return isAllInherited() || extendsTypes.contains("configurations");
}
public boolean areDependenciesInherited() {
return isAllInherited() || extendsTypes.contains("dependencies");
}
}

View File

@ -1,63 +1,63 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.module.descriptor;
import org.apache.ivy.core.module.id.ModuleRevisionId;
/**
* Describes parent descriptor information for a module descriptor.
*/
public interface ExtendsDescriptor {
/** get the module revision id of the declared parent descriptor */
public ModuleRevisionId getParentRevisionId();
/**
* get the resolved revision id for {@link #getParentRevisionId}, see
* {@link org.apache.ivy.core.module.descriptor.ModuleDescriptor#getResolvedModuleRevisionId()} }
*/
public ModuleRevisionId getResolvedParentRevisionId();
/**
* If there is an explicit path to check for the parent descriptor, return it.
* Otherwise returns null.
*/
public String getLocation();
/**
* Get the parts of the parent descriptor that are inherited. Default
* supported types are <code>info</code>, <code>description</code>,
* <code>configurations</code>, <code>dependencies</code>, and/or <code>all</code>.
* Ivy extensions may add support for additional extends types.
*/
public String[] getExtendsTypes();
/** @return true if the <code>all</code> extend type is specified, implying all other types */
public boolean isAllInherited();
/** @return true if parent info attributes are inherited (organisation, branch, revision, etc)*/
public boolean isInfoInherited();
/** @return true if parent description is inherited */
public boolean isDescriptionInherited();
/** @return true if parent configurations are inherited */
public boolean areConfigurationsInherited();
/** @return true if parent dependencies are inherited */
public boolean areDependenciesInherited();
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.module.descriptor;
import org.apache.ivy.core.module.id.ModuleRevisionId;
/**
* Describes parent descriptor information for a module descriptor.
*/
public interface ExtendsDescriptor {
/** get the module revision id of the declared parent descriptor */
public ModuleRevisionId getParentRevisionId();
/**
* get the resolved revision id for {@link #getParentRevisionId}, see
* {@link org.apache.ivy.core.module.descriptor.ModuleDescriptor#getResolvedModuleRevisionId()} }
*/
public ModuleRevisionId getResolvedParentRevisionId();
/**
* If there is an explicit path to check for the parent descriptor, return it.
* Otherwise returns null.
*/
public String getLocation();
/**
* Get the parts of the parent descriptor that are inherited. Default
* supported types are <code>info</code>, <code>description</code>,
* <code>configurations</code>, <code>dependencies</code>, and/or <code>all</code>.
* Ivy extensions may add support for additional extends types.
*/
public String[] getExtendsTypes();
/** @return true if the <code>all</code> extend type is specified, implying all other types */
public boolean isAllInherited();
/** @return true if parent info attributes are inherited (organisation, branch, revision, etc)*/
public boolean isInfoInherited();
/** @return true if parent description is inherited */
public boolean isDescriptionInherited();
/** @return true if parent configurations are inherited */
public boolean areConfigurationsInherited();
/** @return true if parent dependencies are inherited */
public boolean areDependenciesInherited();
}

View File

@ -1,34 +1,34 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.module.descriptor;
import org.apache.ivy.core.module.id.ModuleRevisionId;
/**
* Interface for elements that can be inherited from a parent descriptor
* by a child descriptor.
* @see Configuration
* @see DependencyDescriptor
*/
public interface InheritableItem {
/**
* @return the module in which this item was actually defined, if different
* from the module in which the item appears. May be null.
*/
public ModuleRevisionId getSourceModule();
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.module.descriptor;
import org.apache.ivy.core.module.id.ModuleRevisionId;
/**
* Interface for elements that can be inherited from a parent descriptor
* by a child descriptor.
* @see Configuration
* @see DependencyDescriptor
*/
public interface InheritableItem {
/**
* @return the module in which this item was actually defined, if different
* from the module in which the item appears. May be null.
*/
public ModuleRevisionId getSourceModule();
}

View File

@ -1,61 +1,61 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<html>
<head>
</head>
<body>
<p>
This packages gathers classes used to represent identifiers of objects involved in dependency management.
</p>
<p>
As identifiers, they do not store any information on the module content and detailed metadata (like dependencies).
</p>
<h2>Classes</h2>
<p>
<ul>
<li>ModuleId</li> is used as the identifier of module, without considering its version. It's basically an organization and module name couple.
<li>ModuleRevisionId</li> is used as the identifier of a module in a particular version or version constraint. It is composed of a ModuleId, a revision, and optionally a branch and extra attributes.
<li>ArtifactId</li> identifies an artifact without considering its version. It's basically a ModuleId and an artifact name, type and extension, plus optional extra attributes.
<li>ArtifactRevisionId</li> identifies an artifact of a module in a particular version. It is composed of a ModuleRevisionId along with artifact identifier like the name type and extension.
</ul>
</p>
<h2>Text Representation</h2>
<p>
These classes share an homogeneous text representation, which can be easily obtained through the toString() method.
</p>
<p>
The general pattern is: <code>[organisation]#[module]#[branch];[revision]![artifact].[ext]([type])</code>
The # before the branch is present only if the branch is not empty.<br/>
The type and surrounding parenthesis are present only if different from the extension.
</p>
<p>
A textual representation can be parsed into an object (supported for ModuleRevisionId only yet), as long as a strict set of characters is used for each field (which is recommended).<br/>
Allowed characters are:
<ul>
<li>organisation</li> a-z A-Z 0-9 - / . _ + =
<li>module</li> a-z A-Z 0-9 - / . _ + =
<li>branch</li> a-z A-Z 0-9 - / . _ + =
<li>revision</li> a-z A-Z 0-9 - / . _ + = , [ ] { } ( ) : @
<li>artifact</li> a-z A-Z 0-9 - / . _ + =
<li>extension</li> a-z A-Z 0-9 - / . _ + =
<li>type</li> a-z A-Z 0-9 - / . _ + =
</ul>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<html>
<head>
</head>
<body>
<p>
This packages gathers classes used to represent identifiers of objects involved in dependency management.
</p>
<p>
As identifiers, they do not store any information on the module content and detailed metadata (like dependencies).
</p>
<h2>Classes</h2>
<p>
<ul>
<li>ModuleId</li> is used as the identifier of module, without considering its version. It's basically an organization and module name couple.
<li>ModuleRevisionId</li> is used as the identifier of a module in a particular version or version constraint. It is composed of a ModuleId, a revision, and optionally a branch and extra attributes.
<li>ArtifactId</li> identifies an artifact without considering its version. It's basically a ModuleId and an artifact name, type and extension, plus optional extra attributes.
<li>ArtifactRevisionId</li> identifies an artifact of a module in a particular version. It is composed of a ModuleRevisionId along with artifact identifier like the name type and extension.
</ul>
</p>
<h2>Text Representation</h2>
<p>
These classes share an homogeneous text representation, which can be easily obtained through the toString() method.
</p>
<p>
The general pattern is: <code>[organisation]#[module]#[branch];[revision]![artifact].[ext]([type])</code>
The # before the branch is present only if the branch is not empty.<br/>
The type and surrounding parenthesis are present only if different from the extension.
</p>
<p>
A textual representation can be parsed into an object (supported for ModuleRevisionId only yet), as long as a strict set of characters is used for each field (which is recommended).<br/>
Allowed characters are:
<ul>
<li>organisation</li> a-z A-Z 0-9 - / . _ + =
<li>module</li> a-z A-Z 0-9 - / . _ + =
<li>branch</li> a-z A-Z 0-9 - / . _ + =
<li>revision</li> a-z A-Z 0-9 - / . _ + = , [ ] { } ( ) : @
<li>artifact</li> a-z A-Z 0-9 - / . _ + =
<li>extension</li> a-z A-Z 0-9 - / . _ + =
<li>type</li> a-z A-Z 0-9 - / . _ + =
</ul>
</body>

View File

@ -1,336 +1,336 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.repository;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeSet;
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.resolve.ResolveData;
import org.apache.ivy.core.resolve.ResolveEngine;
import org.apache.ivy.core.resolve.ResolveOptions;
import org.apache.ivy.core.resolve.ResolvedModuleRevision;
import org.apache.ivy.core.search.SearchEngine;
import org.apache.ivy.plugins.latest.ArtifactInfo;
import org.apache.ivy.plugins.matcher.PatternMatcher;
import org.apache.ivy.plugins.matcher.RegexpPatternMatcher;
import org.apache.ivy.plugins.version.VersionMatcher;
import org.apache.ivy.util.MemoryUtil;
import org.apache.ivy.util.Message;
/**
* The repository management can be used to load all metadata from a repository, analyze them, and
* provide a bunch of information about the whole repository state.
* <p>
* Since loading all metadata from a repository is not a light task, this engine should only be used
* on a machine having good access to the repository (on the same filesystem being usually the best
* suited).
* </p>
* <p>
* To access information, you usually have before to call a method to init the data: {@link #load()}
* is used to load repository metadata, {@link #analyze()} is used to analyze them. These methods
* being very time consuming, they must always be called explicitly.
* </p>
* <p>
* On a large repository, this engine can be very memory consuming to use, it is not suited to be
* used in a long running process, but rather in short process loading data and taking action about
* the current state of the repository.
* </p>
* <p>
* This engine is not intended to be used concurrently with publish, the order of repository loaded
* being undeterministic and long, it could end up in having an inconsistent in memory state.
* </p>
* <p>
* For better performance, we strongly suggest using this engine with cache in useOrigin mode.
* </p>
*/
public class RepositoryManagementEngine {
private static final double THOUSAND = 1000.0;
private static final int KILO = 1024;
///////////////////////////////////////////
// state loaded on #load()
///////////////////////////////////////////
/**
* True if the repository has already been loaded, false otherwise.
*/
private boolean loaded;
/**
* ModuleDescriptors stored by ModuleRevisionId
*/
private Map/*<ModuleRevisionId,ModuleDescriptor>*/ revisions = new HashMap();
/**
* ModuleRevisionId for which loading was not possible, with corresponding error message.
*/
private Map/*<ModuleRevisionId,String>*/ errors = new HashMap();
/**
* List of ModuleRevisionId per ModuleId.
*/
private Map/*<ModuleId,Collection<ModuleRevisionId>>*/ modules = new HashMap();
///////////////////////////////////////////
// state loaded on #analyze()
///////////////////////////////////////////
/**
* True when the repository has been analyzed, false otherwise
*/
private boolean analyzed;
/**
* Cache from requested module revision id to actual module revision id.
*/
private Map/*<ModuleRevisionId,ModuleRevisionId>*/ cache = new HashMap();
/**
* list of dependers per ModuleRevisionId.
*/
private Map/*<ModuleRevisionId,List<ModuleRevisionId>>*/ dependers = new HashMap();
///////////////////////////////////////////
// dependencies
///////////////////////////////////////////
private SearchEngine searchEngine;
private ResolveEngine resolveEngine;
private RepositoryManagementEngineSettings settings;
public RepositoryManagementEngine(RepositoryManagementEngineSettings settings,
SearchEngine searchEngine, ResolveEngine resolveEngine) {
this.settings = settings;
this.searchEngine = searchEngine;
this.resolveEngine = resolveEngine;
}
/**
* Loads data from the repository.
* <p>
* This method usually takes a long time to proceed. It should never be called from event
* dispatch thread in a GUI.
* </p>
*/
public void load() {
long startingMemoryUse = 0;
if (settings.dumpMemoryUsage()) {
startingMemoryUse = MemoryUtil.getUsedMemory();
}
long startTime = System.currentTimeMillis();
Message.rawinfo("searching modules... ");
ModuleRevisionId[] mrids = searchModules();
Message.info("loading repository metadata...");
for (int i = 0; i < mrids.length; i++) {
try {
loadModuleRevision(mrids[i]);
} catch (Exception e) {
errors.put(mrids[i], e.getMessage());
}
}
long endTime = System.currentTimeMillis();
Message.info("\nrepository loaded: " + modules.size() + " modules; "
+ revisions.size() + " revisions; "
+ (settings.dumpMemoryUsage()
? (MemoryUtil.getUsedMemory() - startingMemoryUse) / KILO + "kB; "
: "")
+ (endTime - startTime) / THOUSAND + "s");
loaded = true;
}
/**
* Analyze data in the repository.
* <p>
* This method may take a long time to proceed. It should never be called from event
* dispatch thread in a GUI.
* </p>
* @throws IllegalStateException
* if the repository has not been loaded yet
* @see #load()
*/
public void analyze() {
ensureLoaded();
Message.info("\nanalyzing dependencies...");
for (Iterator iterator = revisions.values().iterator(); iterator.hasNext();) {
ModuleDescriptor md = (ModuleDescriptor) iterator.next();
DependencyDescriptor[] dds = md.getDependencies();
for (int i = 0; i < dds.length; i++) {
ModuleRevisionId dep = getDependency(dds[i]);
if (dep == null) {
Message.warn(
"inconsistent repository: declared dependency not found: " + dds[i]);
} else {
getDependers(dep).add(md.getModuleRevisionId());
}
}
Message.progress();
}
analyzed = true;
}
/**
* Returns the number of Module Revision in the repository.
*
* @return the number of module revisions in the repository.
* @throws IllegalStateException
* if the repository has not been loaded yet
* @see #load()
*/
public int getRevisionsNumber() {
ensureLoaded();
return revisions.size();
}
/**
* Returns the number of ModuleId in the repository.
*
* @return the number of ModuleId in the repository.
* @throws IllegalStateException
* if the repository has not been loaded yet
* @see #load()
*/
public int getModuleIdsNumber() {
ensureLoaded();
return modules.size();
}
/**
* Returns Module Revisions which have no dependers.
*
* @return a Collection of the {@link ModuleRevisionId} of module revisions which have no
* dependers in the repository.
* @throws IllegalStateException
* if the repository has not been analyzed yet
* @see #analyze()
*/
public Collection getOrphans() {
ensureAnalyzed();
Collection orphans = new HashSet(revisions.keySet());
orphans.removeAll(dependers.keySet());
return orphans;
}
private ModuleRevisionId[] searchModules() {
ModuleRevisionId[] mrids = searchEngine.listModules(
ModuleRevisionId.newInstance(
PatternMatcher.ANY_EXPRESSION,
PatternMatcher.ANY_EXPRESSION,
PatternMatcher.ANY_EXPRESSION,
PatternMatcher.ANY_EXPRESSION),
RegexpPatternMatcher.INSTANCE);
return mrids;
}
private ModuleRevisionId getDependency(DependencyDescriptor dd) {
ModuleRevisionId askedMrid = dd.getDependencyRevisionId();
VersionMatcher vmatcher = settings.getVersionMatcher();
if (vmatcher.isDynamic(askedMrid)) {
ModuleRevisionId mrid = (ModuleRevisionId) cache.get(askedMrid);
if (mrid == null) {
Collection revs = getAllRevisions(askedMrid);
for (Iterator iterator = revs.iterator(); iterator.hasNext();) {
ModuleDescriptor md = (ModuleDescriptor) iterator.next();
if (vmatcher.needModuleDescriptor(
askedMrid, md.getResolvedModuleRevisionId())) {
if (vmatcher.accept(askedMrid, md)) {
mrid = md.getResolvedModuleRevisionId();
break;
}
} else {
if (vmatcher.accept(askedMrid, md.getResolvedModuleRevisionId())) {
mrid = md.getResolvedModuleRevisionId();
break;
}
}
}
if (mrid == null) {
return null;
} else {
cache.put(askedMrid, mrid);
}
}
return mrid;
} else {
return askedMrid;
}
}
private Collection getDependers(ModuleRevisionId id) {
Collection depders = (Collection) dependers.get(id);
if (depders == null) {
depders = new ArrayList();
dependers.put(id, depders);
}
return depders;
}
private void loadModuleRevision(ModuleRevisionId mrid) throws Exception {
ResolvedModuleRevision module = settings.getResolver(mrid)
.getDependency(new DefaultDependencyDescriptor(mrid, false),
newResolveData());
if (module == null) {
Message.warn("module not found while listed: " + mrid);
} else {
revisions.put(module.getId(), module.getDescriptor());
getAllRevisions(module.getId()).add(module.getDescriptor());
}
Message.progress();
}
private Collection getAllRevisions(ModuleRevisionId id) {
Collection revisions = (Collection) modules.get(id.getModuleId());
if (revisions == null) {
revisions = new TreeSet(new Comparator() {
public int compare(Object o1, Object o2) {
ModuleDescriptor md1 = (ModuleDescriptor) o1;
ModuleDescriptor md2 = (ModuleDescriptor) o2;
// we use reverse order compared to latest revision, to have latest revision
// first
return settings.getDefaultLatestStrategy()
.sort(new ArtifactInfo[] {md1, md2}).get(0).equals(md1) ? 1 : -1;
}
});
modules.put(id.getModuleId(), revisions);
}
return revisions;
}
private ResolveData newResolveData() {
return new ResolveData(resolveEngine, new ResolveOptions());
}
private void ensureAnalyzed() {
if (!analyzed) {
throw new IllegalStateException(
"repository must have been analyzed to perform this method");
}
}
private void ensureLoaded() {
if (!loaded) {
throw new IllegalStateException(
"repository must have be loaded to perform this method");
}
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.repository;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeSet;
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.resolve.ResolveData;
import org.apache.ivy.core.resolve.ResolveEngine;
import org.apache.ivy.core.resolve.ResolveOptions;
import org.apache.ivy.core.resolve.ResolvedModuleRevision;
import org.apache.ivy.core.search.SearchEngine;
import org.apache.ivy.plugins.latest.ArtifactInfo;
import org.apache.ivy.plugins.matcher.PatternMatcher;
import org.apache.ivy.plugins.matcher.RegexpPatternMatcher;
import org.apache.ivy.plugins.version.VersionMatcher;
import org.apache.ivy.util.MemoryUtil;
import org.apache.ivy.util.Message;
/**
* The repository management can be used to load all metadata from a repository, analyze them, and
* provide a bunch of information about the whole repository state.
* <p>
* Since loading all metadata from a repository is not a light task, this engine should only be used
* on a machine having good access to the repository (on the same filesystem being usually the best
* suited).
* </p>
* <p>
* To access information, you usually have before to call a method to init the data: {@link #load()}
* is used to load repository metadata, {@link #analyze()} is used to analyze them. These methods
* being very time consuming, they must always be called explicitly.
* </p>
* <p>
* On a large repository, this engine can be very memory consuming to use, it is not suited to be
* used in a long running process, but rather in short process loading data and taking action about
* the current state of the repository.
* </p>
* <p>
* This engine is not intended to be used concurrently with publish, the order of repository loaded
* being undeterministic and long, it could end up in having an inconsistent in memory state.
* </p>
* <p>
* For better performance, we strongly suggest using this engine with cache in useOrigin mode.
* </p>
*/
public class RepositoryManagementEngine {
private static final double THOUSAND = 1000.0;
private static final int KILO = 1024;
///////////////////////////////////////////
// state loaded on #load()
///////////////////////////////////////////
/**
* True if the repository has already been loaded, false otherwise.
*/
private boolean loaded;
/**
* ModuleDescriptors stored by ModuleRevisionId
*/
private Map/*<ModuleRevisionId,ModuleDescriptor>*/ revisions = new HashMap();
/**
* ModuleRevisionId for which loading was not possible, with corresponding error message.
*/
private Map/*<ModuleRevisionId,String>*/ errors = new HashMap();
/**
* List of ModuleRevisionId per ModuleId.
*/
private Map/*<ModuleId,Collection<ModuleRevisionId>>*/ modules = new HashMap();
///////////////////////////////////////////
// state loaded on #analyze()
///////////////////////////////////////////
/**
* True when the repository has been analyzed, false otherwise
*/
private boolean analyzed;
/**
* Cache from requested module revision id to actual module revision id.
*/
private Map/*<ModuleRevisionId,ModuleRevisionId>*/ cache = new HashMap();
/**
* list of dependers per ModuleRevisionId.
*/
private Map/*<ModuleRevisionId,List<ModuleRevisionId>>*/ dependers = new HashMap();
///////////////////////////////////////////
// dependencies
///////////////////////////////////////////
private SearchEngine searchEngine;
private ResolveEngine resolveEngine;
private RepositoryManagementEngineSettings settings;
public RepositoryManagementEngine(RepositoryManagementEngineSettings settings,
SearchEngine searchEngine, ResolveEngine resolveEngine) {
this.settings = settings;
this.searchEngine = searchEngine;
this.resolveEngine = resolveEngine;
}
/**
* Loads data from the repository.
* <p>
* This method usually takes a long time to proceed. It should never be called from event
* dispatch thread in a GUI.
* </p>
*/
public void load() {
long startingMemoryUse = 0;
if (settings.dumpMemoryUsage()) {
startingMemoryUse = MemoryUtil.getUsedMemory();
}
long startTime = System.currentTimeMillis();
Message.rawinfo("searching modules... ");
ModuleRevisionId[] mrids = searchModules();
Message.info("loading repository metadata...");
for (int i = 0; i < mrids.length; i++) {
try {
loadModuleRevision(mrids[i]);
} catch (Exception e) {
errors.put(mrids[i], e.getMessage());
}
}
long endTime = System.currentTimeMillis();
Message.info("\nrepository loaded: " + modules.size() + " modules; "
+ revisions.size() + " revisions; "
+ (settings.dumpMemoryUsage()
? (MemoryUtil.getUsedMemory() - startingMemoryUse) / KILO + "kB; "
: "")
+ (endTime - startTime) / THOUSAND + "s");
loaded = true;
}
/**
* Analyze data in the repository.
* <p>
* This method may take a long time to proceed. It should never be called from event
* dispatch thread in a GUI.
* </p>
* @throws IllegalStateException
* if the repository has not been loaded yet
* @see #load()
*/
public void analyze() {
ensureLoaded();
Message.info("\nanalyzing dependencies...");
for (Iterator iterator = revisions.values().iterator(); iterator.hasNext();) {
ModuleDescriptor md = (ModuleDescriptor) iterator.next();
DependencyDescriptor[] dds = md.getDependencies();
for (int i = 0; i < dds.length; i++) {
ModuleRevisionId dep = getDependency(dds[i]);
if (dep == null) {
Message.warn(
"inconsistent repository: declared dependency not found: " + dds[i]);
} else {
getDependers(dep).add(md.getModuleRevisionId());
}
}
Message.progress();
}
analyzed = true;
}
/**
* Returns the number of Module Revision in the repository.
*
* @return the number of module revisions in the repository.
* @throws IllegalStateException
* if the repository has not been loaded yet
* @see #load()
*/
public int getRevisionsNumber() {
ensureLoaded();
return revisions.size();
}
/**
* Returns the number of ModuleId in the repository.
*
* @return the number of ModuleId in the repository.
* @throws IllegalStateException
* if the repository has not been loaded yet
* @see #load()
*/
public int getModuleIdsNumber() {
ensureLoaded();
return modules.size();
}
/**
* Returns Module Revisions which have no dependers.
*
* @return a Collection of the {@link ModuleRevisionId} of module revisions which have no
* dependers in the repository.
* @throws IllegalStateException
* if the repository has not been analyzed yet
* @see #analyze()
*/
public Collection getOrphans() {
ensureAnalyzed();
Collection orphans = new HashSet(revisions.keySet());
orphans.removeAll(dependers.keySet());
return orphans;
}
private ModuleRevisionId[] searchModules() {
ModuleRevisionId[] mrids = searchEngine.listModules(
ModuleRevisionId.newInstance(
PatternMatcher.ANY_EXPRESSION,
PatternMatcher.ANY_EXPRESSION,
PatternMatcher.ANY_EXPRESSION,
PatternMatcher.ANY_EXPRESSION),
RegexpPatternMatcher.INSTANCE);
return mrids;
}
private ModuleRevisionId getDependency(DependencyDescriptor dd) {
ModuleRevisionId askedMrid = dd.getDependencyRevisionId();
VersionMatcher vmatcher = settings.getVersionMatcher();
if (vmatcher.isDynamic(askedMrid)) {
ModuleRevisionId mrid = (ModuleRevisionId) cache.get(askedMrid);
if (mrid == null) {
Collection revs = getAllRevisions(askedMrid);
for (Iterator iterator = revs.iterator(); iterator.hasNext();) {
ModuleDescriptor md = (ModuleDescriptor) iterator.next();
if (vmatcher.needModuleDescriptor(
askedMrid, md.getResolvedModuleRevisionId())) {
if (vmatcher.accept(askedMrid, md)) {
mrid = md.getResolvedModuleRevisionId();
break;
}
} else {
if (vmatcher.accept(askedMrid, md.getResolvedModuleRevisionId())) {
mrid = md.getResolvedModuleRevisionId();
break;
}
}
}
if (mrid == null) {
return null;
} else {
cache.put(askedMrid, mrid);
}
}
return mrid;
} else {
return askedMrid;
}
}
private Collection getDependers(ModuleRevisionId id) {
Collection depders = (Collection) dependers.get(id);
if (depders == null) {
depders = new ArrayList();
dependers.put(id, depders);
}
return depders;
}
private void loadModuleRevision(ModuleRevisionId mrid) throws Exception {
ResolvedModuleRevision module = settings.getResolver(mrid)
.getDependency(new DefaultDependencyDescriptor(mrid, false),
newResolveData());
if (module == null) {
Message.warn("module not found while listed: " + mrid);
} else {
revisions.put(module.getId(), module.getDescriptor());
getAllRevisions(module.getId()).add(module.getDescriptor());
}
Message.progress();
}
private Collection getAllRevisions(ModuleRevisionId id) {
Collection revisions = (Collection) modules.get(id.getModuleId());
if (revisions == null) {
revisions = new TreeSet(new Comparator() {
public int compare(Object o1, Object o2) {
ModuleDescriptor md1 = (ModuleDescriptor) o1;
ModuleDescriptor md2 = (ModuleDescriptor) o2;
// we use reverse order compared to latest revision, to have latest revision
// first
return settings.getDefaultLatestStrategy()
.sort(new ArtifactInfo[] {md1, md2}).get(0).equals(md1) ? 1 : -1;
}
});
modules.put(id.getModuleId(), revisions);
}
return revisions;
}
private ResolveData newResolveData() {
return new ResolveData(resolveEngine, new ResolveOptions());
}
private void ensureAnalyzed() {
if (!analyzed) {
throw new IllegalStateException(
"repository must have been analyzed to perform this method");
}
}
private void ensureLoaded() {
if (!loaded) {
throw new IllegalStateException(
"repository must have be loaded to perform this method");
}
}
}

View File

@ -1,24 +1,24 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.repository;
import org.apache.ivy.core.resolve.ResolveEngineSettings;
public interface RepositoryManagementEngineSettings extends ResolveEngineSettings {
public boolean dumpMemoryUsage();
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.repository;
import org.apache.ivy.core.resolve.ResolveEngineSettings;
public interface RepositoryManagementEngineSettings extends ResolveEngineSettings {
public boolean dumpMemoryUsage();
}

View File

@ -1,69 +1,69 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.resolve;
/**
* Information about a blacklisted module, providing context information in which it has been
* blacklisted
*/
public class IvyNodeBlacklist {
private IvyNode conflictParent;
private IvyNode selectedNode;
private IvyNode evictedNode;
private IvyNode blacklistedNode;
private String rootModuleConf;
public IvyNodeBlacklist(IvyNode conflictParent, IvyNode selectedNode, IvyNode evictedNode,
IvyNode blacklistedNode, String rootModuleConf) {
this.conflictParent = conflictParent;
this.selectedNode = selectedNode;
this.evictedNode = evictedNode;
this.blacklistedNode = blacklistedNode;
this.rootModuleConf = rootModuleConf;
}
public IvyNode getConflictParent() {
return conflictParent;
}
public IvyNode getSelectedNode() {
return selectedNode;
}
public IvyNode getEvictedNode() {
return evictedNode;
}
public IvyNode getBlacklistedNode() {
return blacklistedNode;
}
public String getRootModuleConf() {
return rootModuleConf;
}
public String toString() {
return "[" + blacklistedNode + " blacklisted to evict " + evictedNode + " in favor of "
+ selectedNode + " in " + conflictParent + " for " + rootModuleConf + "]";
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.resolve;
/**
* Information about a blacklisted module, providing context information in which it has been
* blacklisted
*/
public class IvyNodeBlacklist {
private IvyNode conflictParent;
private IvyNode selectedNode;
private IvyNode evictedNode;
private IvyNode blacklistedNode;
private String rootModuleConf;
public IvyNodeBlacklist(IvyNode conflictParent, IvyNode selectedNode, IvyNode evictedNode,
IvyNode blacklistedNode, String rootModuleConf) {
this.conflictParent = conflictParent;
this.selectedNode = selectedNode;
this.evictedNode = evictedNode;
this.blacklistedNode = blacklistedNode;
this.rootModuleConf = rootModuleConf;
}
public IvyNode getConflictParent() {
return conflictParent;
}
public IvyNode getSelectedNode() {
return selectedNode;
}
public IvyNode getEvictedNode() {
return evictedNode;
}
public IvyNode getBlacklistedNode() {
return blacklistedNode;
}
public String getRootModuleConf() {
return rootModuleConf;
}
public String toString() {
return "[" + blacklistedNode + " blacklisted to evict " + evictedNode + " in favor of "
+ selectedNode + " in " + conflictParent + " for " + rootModuleConf + "]";
}
}

View File

@ -1,46 +1,46 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.resolve;
/**
* ResolveProcessException is an exception which is used to control the resolve process.
* <p>
* All {@link ResolveProcessException} subclasses have the ability to interrupt the resolve process
* when thrown while resolving dependencies, instead of only marking the module with a problem and
* continuing the resolve process as part of the best effort strategy during resolve process.
* </p>
* Some subclasses have even a stronger power over the resolve process, like
* {@link RestartResolveProcess} which orders to restart the resolve process at the start.
*/
public class ResolveProcessException extends RuntimeException {
public ResolveProcessException() {
}
public ResolveProcessException(String message, Throwable cause) {
super(message, cause);
}
public ResolveProcessException(String message) {
super(message);
}
public ResolveProcessException(Throwable cause) {
super(cause);
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.resolve;
/**
* ResolveProcessException is an exception which is used to control the resolve process.
* <p>
* All {@link ResolveProcessException} subclasses have the ability to interrupt the resolve process
* when thrown while resolving dependencies, instead of only marking the module with a problem and
* continuing the resolve process as part of the best effort strategy during resolve process.
* </p>
* Some subclasses have even a stronger power over the resolve process, like
* {@link RestartResolveProcess} which orders to restart the resolve process at the start.
*/
public class ResolveProcessException extends RuntimeException {
public ResolveProcessException() {
}
public ResolveProcessException(String message, Throwable cause) {
super(message, cause);
}
public ResolveProcessException(String message) {
super(message);
}
public ResolveProcessException(Throwable cause) {
super(cause);
}
}

View File

@ -1,34 +1,34 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.resolve;
/**
* This RuntimeException is used during the resolve process to ask the engine to restart the resolve
* process.
* <p>
* Users of this feature should be very careful to make sure they handle a termination condition,
* since the resolve engine itself won't check the same exception is not thrown ad libitum
* </p>
*/
public class RestartResolveProcess extends ResolveProcessException {
public RestartResolveProcess(String message) {
super(message);
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.resolve;
/**
* This RuntimeException is used during the resolve process to ask the engine to restart the resolve
* process.
* <p>
* Users of this feature should be very careful to make sure they handle a termination condition,
* since the resolve engine itself won't check the same exception is not thrown ad libitum
* </p>
*/
public class RestartResolveProcess extends ResolveProcessException {
public RestartResolveProcess(String message) {
super(message);
}
}

View File

@ -1,56 +1,56 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.circular;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import org.apache.ivy.core.IvyContext;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.resolve.ResolveData;
public abstract class AbstractLogCircularDependencyStrategy
extends AbstractCircularDependencyStrategy {
protected AbstractLogCircularDependencyStrategy(String name) {
super(name);
}
private Collection/*<String>*/ circularDependencies = new HashSet();
public void handleCircularDependency(ModuleRevisionId[] mrids) {
String circularDependencyId = getCircularDependencyId(mrids);
if (!circularDependencies.contains(circularDependencyId)) {
circularDependencies.add(circularDependencyId);
logCircularDependency(mrids);
}
}
protected abstract void logCircularDependency(ModuleRevisionId[] mrids);
protected String getCircularDependencyId(ModuleRevisionId[] mrids) {
String contextPrefix = "";
ResolveData data = IvyContext.getContext().getResolveData();
if (data != null) {
contextPrefix = data.getOptions().getResolveId() + " ";
}
return contextPrefix + Arrays.asList(mrids);
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.circular;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import org.apache.ivy.core.IvyContext;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.resolve.ResolveData;
public abstract class AbstractLogCircularDependencyStrategy
extends AbstractCircularDependencyStrategy {
protected AbstractLogCircularDependencyStrategy(String name) {
super(name);
}
private Collection/*<String>*/ circularDependencies = new HashSet();
public void handleCircularDependency(ModuleRevisionId[] mrids) {
String circularDependencyId = getCircularDependencyId(mrids);
if (!circularDependencies.contains(circularDependencyId)) {
circularDependencies.add(circularDependencyId);
logCircularDependency(mrids);
}
}
protected abstract void logCircularDependency(ModuleRevisionId[] mrids);
protected String getCircularDependencyId(ModuleRevisionId[] mrids) {
String contextPrefix = "";
ResolveData data = IvyContext.getContext().getResolveData();
if (data != null) {
contextPrefix = data.getOptions().getResolveId() + " ";
}
return contextPrefix + Arrays.asList(mrids);
}
}

View File

@ -1,311 +1,311 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.conflict;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Stack;
import org.apache.ivy.core.IvyContext;
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.resolve.IvyNode;
import org.apache.ivy.core.resolve.IvyNodeBlacklist;
import org.apache.ivy.core.resolve.ResolveData;
import org.apache.ivy.core.resolve.RestartResolveProcess;
import org.apache.ivy.core.resolve.IvyNodeCallers.Caller;
import org.apache.ivy.core.resolve.IvyNodeEviction.EvictionData;
import org.apache.ivy.core.settings.IvySettings;
import org.apache.ivy.plugins.latest.LatestStrategy;
import org.apache.ivy.plugins.version.VersionMatcher;
import org.apache.ivy.util.Message;
/**
* This conflict manager can be used to allow only compatible dependencies to be used together (like
* the strict conflict manager), but it has the advantage of using a best effort algorithm to find a
* set of compatible dependencies, even if it requires stepping back to older revisions (as long as
* they are in the set of compatibility).
* <p>
* Here is an example of what this conflict manager is able to do:<br/>
* <b>Available Modules</b>:
* <pre>
* #A;2-&gt;{ #B;[1.0,1.5] #C;[2.0,2.5] }
* #B;1.4-&gt;#D;1.5
* #B;1.5-&gt;#D;2.0
* #C;2.5-&gt;#D;[1.0,1.6]
* </pre>
*
* <b>Result</b>: #B;1.4, #C;2.5, #D;1.5<br/>
* <b>Details</b>The conflict manager finds that the latest matching version
* of #B (1.5) depends on a version of #D incompatible with what is expected by the latest matching
* version of #C. Hence the conflict manager blacklists #B;1.5, and the version range [1.0,1.5] is
* resolved again to end up with #B;1.4 which depends on #D;1.5, which is fine to work with #C;2.5.
* </p>
*/
public class LatestCompatibleConflictManager extends LatestConflictManager {
public LatestCompatibleConflictManager() {
}
public LatestCompatibleConflictManager(String name, LatestStrategy strategy) {
super(name, strategy);
}
public Collection resolveConflicts(IvyNode parent, Collection conflicts) {
if (conflicts.size() < 2) {
return conflicts;
}
VersionMatcher versionMatcher = getSettings().getVersionMatcher();
Iterator iter = conflicts.iterator();
IvyNode node = (IvyNode) iter.next();
ModuleRevisionId mrid = node.getResolvedId();
if (versionMatcher.isDynamic(mrid)) {
while (iter.hasNext()) {
IvyNode other = (IvyNode) iter.next();
if (versionMatcher.isDynamic(other.getResolvedId())) {
// two dynamic versions in conflict, not enough information yet
return null;
} else if (!versionMatcher.accept(mrid, other.getResolvedId())) {
// incompatibility found
if (!handleIncompatibleConflict(parent, conflicts, node, other)) {
return null;
}
}
}
// no incompatibility nor dynamic version found, let's return the latest static version
if (conflicts.size() == 2) {
// very common special case of only two modules in conflict,
// let's return the second one (static)
Iterator it = conflicts.iterator();
it.next();
return Collections.singleton(it.next());
}
Collection newConflicts = new LinkedHashSet(conflicts);
newConflicts.remove(node);
return super.resolveConflicts(parent, newConflicts);
} else {
// the first node is a static revision, let's see if all other versions match
while (iter.hasNext()) {
IvyNode other = (IvyNode) iter.next();
if (!versionMatcher.accept(other.getResolvedId(), mrid)) {
// incompatibility found
if (!handleIncompatibleConflict(parent, conflicts, node, other)) {
return null;
}
}
}
// no incompatibility found, let's return this static version
return Collections.singleton(node);
}
}
/**
* Handles an incompatible conflict
* <p>
* An incompatible conflicts is handled with this pseudo algorithm:
*
* <pre>
* take latest among two nodes in conflict
* for all callers
* if dependency is a version constraint (dynamic)
* blacklist the mapped version
* else
* recurse for all callers
* if a version constraint has been found
* restart resolve
* else
* throw strict conflict exception
* </pre>
*
* </p>
*
* @param parent
* the parent node of nodes in conflict
* @param conflicts
* all the nodes in conflict
* @param node
* one of the two incompatible nodes
* @param other
* the other incompatible node
* @return true if the incompatible conflict has been handled, false otherwise (in which case
* resolveConflicts should return null)
*/
private boolean handleIncompatibleConflict(
IvyNode parent, Collection conflicts, IvyNode node, IvyNode other) {
// we never actually return anything else than false or throw an exception,
// but returning a boolean make the calling code cleaner
try {
IvyNodeArtifactInfo latest = (IvyNodeArtifactInfo)
getStrategy().findLatest(
toArtifactInfo(Arrays.asList(new IvyNode[] {node, other})), null);
if (latest != null) {
IvyNode latestNode = latest.getNode();
IvyNode oldestNode = latestNode == node ? other : node;
blackListIncompatibleCallerAndRestartResolveIfPossible(
getSettings(), parent, oldestNode, latestNode);
// if we arrive here, we haven' managed to blacklist all paths to the latest
// node, we try with the oldest
blackListIncompatibleCallerAndRestartResolveIfPossible(
getSettings(), parent, latestNode, oldestNode);
// still not possible, we aren't able to find a solution to the incompatibility
handleUnsolvableConflict(parent, conflicts, node, other);
return true; // never actually reached
} else {
return false;
}
} catch (NoConflictResolvedYetException ex) {
// we have not enough informations in the nodes to resolve conflict
// according to the resolveConflicts contract, resolveConflicts must return null
return false;
}
}
private void blackListIncompatibleCallerAndRestartResolveIfPossible(IvySettings settings,
IvyNode parent, IvyNode selected, IvyNode evicted) {
Stack callerStack = new Stack();
callerStack.push(evicted);
final Collection toBlacklist = blackListIncompatibleCaller(
settings.getVersionMatcher(), parent, selected, evicted, callerStack);
if (toBlacklist != null) {
final StringBuffer blacklisted = new StringBuffer();
for (Iterator iterator = toBlacklist.iterator(); iterator.hasNext();) {
IvyNodeBlacklist blacklist = (IvyNodeBlacklist) iterator.next();
blacklist.getBlacklistedNode().blacklist(blacklist);
blacklisted.append(blacklist.getBlacklistedNode());
if (iterator.hasNext()) {
blacklisted.append(" ");
}
}
String rootModuleConf =
parent.getData().getReport().getConfiguration();
evicted.markEvicted(
new EvictionData(rootModuleConf, parent, this, Collections.singleton(selected),
"with blacklisting of " + blacklisted));
if (settings.debugConflictResolution()) {
Message.debug("evicting " + evicted + " by "
+ evicted.getEvictedData(rootModuleConf));
}
throw new RestartResolveProcess("trying to handle incompatibilities between "
+ selected + " and " + evicted);
}
}
/**
* Tries to blacklist exactly one version for all callers paths.
*
* @param versionMatcher
* the version matcher to use to interpret versions
* @param conflictParent
* the node in which the conflict is occurring
* @param selectedNode
* the node in favor of which the conflict is resolved
* @param evictedNode
* the node which will be evicted if we are able to blacklist all paths
* @param node
* the node for which callers should be considered
* @return the collection of blacklisting to do, null if a blacklist is not possible in at least
* one caller path
*/
private Collection/*<IvyNodeBlacklist>*/ blackListIncompatibleCaller(
VersionMatcher versionMatcher,
IvyNode conflictParent, IvyNode selectedNode, IvyNode evictedNode,
Stack/*<IvyNode>*/ callerStack) {
Collection/*<IvyNodeBlacklist>*/ blacklisted = new ArrayList/*<IvyNodeBlacklist>*/();
IvyNode node = (IvyNode) callerStack.peek();
String rootModuleConf = conflictParent.getData().getReport().getConfiguration();
Caller[] callers = node.getCallers(rootModuleConf);
for (int i = 0; i < callers.length; i++) {
IvyNode callerNode = node.findNode(callers[i].getModuleRevisionId());
if (callerNode.isBlacklisted(rootModuleConf)) {
continue;
}
if (versionMatcher.isDynamic(callers[i].getAskedDependencyId(node.getData()))) {
blacklisted.add(new IvyNodeBlacklist(
conflictParent, selectedNode, evictedNode, node, rootModuleConf));
} else {
if (callerStack.subList(0, callerStack.size() - 1).contains(node)) {
// circular dependency found and handled: the current top of the stack (node)
// was already contained in the rest of the stack, the circle is closed, nothing
// else to do
} else {
if (callerNode == null) {
// we have reached the root without finding a way to change the blacklist a
// caller in a particular path, this is a strict conflict
return null;
}
callerStack.push(callerNode);
Collection sub = blackListIncompatibleCaller(
versionMatcher, conflictParent, selectedNode, evictedNode, callerStack);
callerStack.pop();
if (sub == null) {
// propagate the fact that a path with unblacklistable caller has been found
return null;
} else {
blacklisted.addAll(sub);
}
}
}
}
if (blacklisted.isEmpty()
&& !callerStack.subList(0, callerStack.size() - 1).contains(node)) {
return null;
}
return blacklisted;
}
protected void handleUnsolvableConflict(
IvyNode parent, Collection conflicts, IvyNode node1, IvyNode node2) {
throw new StrictConflictException(node1, node2);
}
public void handleAllBlacklistedRevisions(
DependencyDescriptor dd, Collection/*<ModuleRevisionId>*/ foundBlacklisted) {
ResolveData resolveData = IvyContext.getContext().getResolveData();
Collection/*<IvyNode>*/ blacklisted = new HashSet();
for (Iterator iterator = foundBlacklisted.iterator(); iterator.hasNext();) {
ModuleRevisionId mrid = (ModuleRevisionId) iterator.next();
blacklisted.add(resolveData.getNode(mrid));
}
for (Iterator iterator = blacklisted.iterator(); iterator.hasNext();) {
IvyNode node = (IvyNode) iterator.next();
IvyNodeBlacklist bdata = node.getBlacklistData(
resolveData.getReport().getConfiguration());
handleUnsolvableConflict(
bdata.getConflictParent(),
Arrays.asList(new Object[] {
bdata.getEvictedNode(), bdata.getSelectedNode()}),
bdata.getEvictedNode(),
bdata.getSelectedNode());
}
}
public String toString() {
return getName();
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.conflict;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Stack;
import org.apache.ivy.core.IvyContext;
import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.resolve.IvyNode;
import org.apache.ivy.core.resolve.IvyNodeBlacklist;
import org.apache.ivy.core.resolve.ResolveData;
import org.apache.ivy.core.resolve.RestartResolveProcess;
import org.apache.ivy.core.resolve.IvyNodeCallers.Caller;
import org.apache.ivy.core.resolve.IvyNodeEviction.EvictionData;
import org.apache.ivy.core.settings.IvySettings;
import org.apache.ivy.plugins.latest.LatestStrategy;
import org.apache.ivy.plugins.version.VersionMatcher;
import org.apache.ivy.util.Message;
/**
* This conflict manager can be used to allow only compatible dependencies to be used together (like
* the strict conflict manager), but it has the advantage of using a best effort algorithm to find a
* set of compatible dependencies, even if it requires stepping back to older revisions (as long as
* they are in the set of compatibility).
* <p>
* Here is an example of what this conflict manager is able to do:<br/>
* <b>Available Modules</b>:
* <pre>
* #A;2-&gt;{ #B;[1.0,1.5] #C;[2.0,2.5] }
* #B;1.4-&gt;#D;1.5
* #B;1.5-&gt;#D;2.0
* #C;2.5-&gt;#D;[1.0,1.6]
* </pre>
*
* <b>Result</b>: #B;1.4, #C;2.5, #D;1.5<br/>
* <b>Details</b>The conflict manager finds that the latest matching version
* of #B (1.5) depends on a version of #D incompatible with what is expected by the latest matching
* version of #C. Hence the conflict manager blacklists #B;1.5, and the version range [1.0,1.5] is
* resolved again to end up with #B;1.4 which depends on #D;1.5, which is fine to work with #C;2.5.
* </p>
*/
public class LatestCompatibleConflictManager extends LatestConflictManager {
public LatestCompatibleConflictManager() {
}
public LatestCompatibleConflictManager(String name, LatestStrategy strategy) {
super(name, strategy);
}
public Collection resolveConflicts(IvyNode parent, Collection conflicts) {
if (conflicts.size() < 2) {
return conflicts;
}
VersionMatcher versionMatcher = getSettings().getVersionMatcher();
Iterator iter = conflicts.iterator();
IvyNode node = (IvyNode) iter.next();
ModuleRevisionId mrid = node.getResolvedId();
if (versionMatcher.isDynamic(mrid)) {
while (iter.hasNext()) {
IvyNode other = (IvyNode) iter.next();
if (versionMatcher.isDynamic(other.getResolvedId())) {
// two dynamic versions in conflict, not enough information yet
return null;
} else if (!versionMatcher.accept(mrid, other.getResolvedId())) {
// incompatibility found
if (!handleIncompatibleConflict(parent, conflicts, node, other)) {
return null;
}
}
}
// no incompatibility nor dynamic version found, let's return the latest static version
if (conflicts.size() == 2) {
// very common special case of only two modules in conflict,
// let's return the second one (static)
Iterator it = conflicts.iterator();
it.next();
return Collections.singleton(it.next());
}
Collection newConflicts = new LinkedHashSet(conflicts);
newConflicts.remove(node);
return super.resolveConflicts(parent, newConflicts);
} else {
// the first node is a static revision, let's see if all other versions match
while (iter.hasNext()) {
IvyNode other = (IvyNode) iter.next();
if (!versionMatcher.accept(other.getResolvedId(), mrid)) {
// incompatibility found
if (!handleIncompatibleConflict(parent, conflicts, node, other)) {
return null;
}
}
}
// no incompatibility found, let's return this static version
return Collections.singleton(node);
}
}
/**
* Handles an incompatible conflict
* <p>
* An incompatible conflicts is handled with this pseudo algorithm:
*
* <pre>
* take latest among two nodes in conflict
* for all callers
* if dependency is a version constraint (dynamic)
* blacklist the mapped version
* else
* recurse for all callers
* if a version constraint has been found
* restart resolve
* else
* throw strict conflict exception
* </pre>
*
* </p>
*
* @param parent
* the parent node of nodes in conflict
* @param conflicts
* all the nodes in conflict
* @param node
* one of the two incompatible nodes
* @param other
* the other incompatible node
* @return true if the incompatible conflict has been handled, false otherwise (in which case
* resolveConflicts should return null)
*/
private boolean handleIncompatibleConflict(
IvyNode parent, Collection conflicts, IvyNode node, IvyNode other) {
// we never actually return anything else than false or throw an exception,
// but returning a boolean make the calling code cleaner
try {
IvyNodeArtifactInfo latest = (IvyNodeArtifactInfo)
getStrategy().findLatest(
toArtifactInfo(Arrays.asList(new IvyNode[] {node, other})), null);
if (latest != null) {
IvyNode latestNode = latest.getNode();
IvyNode oldestNode = latestNode == node ? other : node;
blackListIncompatibleCallerAndRestartResolveIfPossible(
getSettings(), parent, oldestNode, latestNode);
// if we arrive here, we haven' managed to blacklist all paths to the latest
// node, we try with the oldest
blackListIncompatibleCallerAndRestartResolveIfPossible(
getSettings(), parent, latestNode, oldestNode);
// still not possible, we aren't able to find a solution to the incompatibility
handleUnsolvableConflict(parent, conflicts, node, other);
return true; // never actually reached
} else {
return false;
}
} catch (NoConflictResolvedYetException ex) {
// we have not enough informations in the nodes to resolve conflict
// according to the resolveConflicts contract, resolveConflicts must return null
return false;
}
}
private void blackListIncompatibleCallerAndRestartResolveIfPossible(IvySettings settings,
IvyNode parent, IvyNode selected, IvyNode evicted) {
Stack callerStack = new Stack();
callerStack.push(evicted);
final Collection toBlacklist = blackListIncompatibleCaller(
settings.getVersionMatcher(), parent, selected, evicted, callerStack);
if (toBlacklist != null) {
final StringBuffer blacklisted = new StringBuffer();
for (Iterator iterator = toBlacklist.iterator(); iterator.hasNext();) {
IvyNodeBlacklist blacklist = (IvyNodeBlacklist) iterator.next();
blacklist.getBlacklistedNode().blacklist(blacklist);
blacklisted.append(blacklist.getBlacklistedNode());
if (iterator.hasNext()) {
blacklisted.append(" ");
}
}
String rootModuleConf =
parent.getData().getReport().getConfiguration();
evicted.markEvicted(
new EvictionData(rootModuleConf, parent, this, Collections.singleton(selected),
"with blacklisting of " + blacklisted));
if (settings.debugConflictResolution()) {
Message.debug("evicting " + evicted + " by "
+ evicted.getEvictedData(rootModuleConf));
}
throw new RestartResolveProcess("trying to handle incompatibilities between "
+ selected + " and " + evicted);
}
}
/**
* Tries to blacklist exactly one version for all callers paths.
*
* @param versionMatcher
* the version matcher to use to interpret versions
* @param conflictParent
* the node in which the conflict is occurring
* @param selectedNode
* the node in favor of which the conflict is resolved
* @param evictedNode
* the node which will be evicted if we are able to blacklist all paths
* @param node
* the node for which callers should be considered
* @return the collection of blacklisting to do, null if a blacklist is not possible in at least
* one caller path
*/
private Collection/*<IvyNodeBlacklist>*/ blackListIncompatibleCaller(
VersionMatcher versionMatcher,
IvyNode conflictParent, IvyNode selectedNode, IvyNode evictedNode,
Stack/*<IvyNode>*/ callerStack) {
Collection/*<IvyNodeBlacklist>*/ blacklisted = new ArrayList/*<IvyNodeBlacklist>*/();
IvyNode node = (IvyNode) callerStack.peek();
String rootModuleConf = conflictParent.getData().getReport().getConfiguration();
Caller[] callers = node.getCallers(rootModuleConf);
for (int i = 0; i < callers.length; i++) {
IvyNode callerNode = node.findNode(callers[i].getModuleRevisionId());
if (callerNode.isBlacklisted(rootModuleConf)) {
continue;
}
if (versionMatcher.isDynamic(callers[i].getAskedDependencyId(node.getData()))) {
blacklisted.add(new IvyNodeBlacklist(
conflictParent, selectedNode, evictedNode, node, rootModuleConf));
} else {
if (callerStack.subList(0, callerStack.size() - 1).contains(node)) {
// circular dependency found and handled: the current top of the stack (node)
// was already contained in the rest of the stack, the circle is closed, nothing
// else to do
} else {
if (callerNode == null) {
// we have reached the root without finding a way to change the blacklist a
// caller in a particular path, this is a strict conflict
return null;
}
callerStack.push(callerNode);
Collection sub = blackListIncompatibleCaller(
versionMatcher, conflictParent, selectedNode, evictedNode, callerStack);
callerStack.pop();
if (sub == null) {
// propagate the fact that a path with unblacklistable caller has been found
return null;
} else {
blacklisted.addAll(sub);
}
}
}
}
if (blacklisted.isEmpty()
&& !callerStack.subList(0, callerStack.size() - 1).contains(node)) {
return null;
}
return blacklisted;
}
protected void handleUnsolvableConflict(
IvyNode parent, Collection conflicts, IvyNode node1, IvyNode node2) {
throw new StrictConflictException(node1, node2);
}
public void handleAllBlacklistedRevisions(
DependencyDescriptor dd, Collection/*<ModuleRevisionId>*/ foundBlacklisted) {
ResolveData resolveData = IvyContext.getContext().getResolveData();
Collection/*<IvyNode>*/ blacklisted = new HashSet();
for (Iterator iterator = foundBlacklisted.iterator(); iterator.hasNext();) {
ModuleRevisionId mrid = (ModuleRevisionId) iterator.next();
blacklisted.add(resolveData.getNode(mrid));
}
for (Iterator iterator = blacklisted.iterator(); iterator.hasNext();) {
IvyNode node = (IvyNode) iterator.next();
IvyNodeBlacklist bdata = node.getBlacklistData(
resolveData.getReport().getConfiguration());
handleUnsolvableConflict(
bdata.getConflictParent(),
Arrays.asList(new Object[] {
bdata.getEvictedNode(), bdata.getSelectedNode()}),
bdata.getEvictedNode(),
bdata.getSelectedNode());
}
}
public String toString() {
return getName();
}
}

View File

@ -1,44 +1,44 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.lock;
public abstract class AbstractLockStrategy implements LockStrategy {
private String name;
private boolean debugLocking = false;
protected AbstractLockStrategy() {
}
protected AbstractLockStrategy(boolean debugLocking) {
this.debugLocking = debugLocking;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String toString() {
return name;
}
public boolean isDebugLocking() {
return debugLocking;
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.lock;
public abstract class AbstractLockStrategy implements LockStrategy {
private String name;
private boolean debugLocking = false;
protected AbstractLockStrategy() {
}
protected AbstractLockStrategy(boolean debugLocking) {
this.debugLocking = debugLocking;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String toString() {
return name;
}
public boolean isDebugLocking() {
return debugLocking;
}
}

View File

@ -1,46 +1,46 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.lock;
import java.io.File;
import org.apache.ivy.core.module.descriptor.Artifact;
public class ArtifactLockStrategy extends FileBasedLockStrategy {
public ArtifactLockStrategy() {
init();
}
public ArtifactLockStrategy(boolean debugLocking) {
super(debugLocking);
init();
}
private void init() {
setName("artifact-lock");
}
public boolean lockArtifact(Artifact artifact, File artifactFileToDownload)
throws InterruptedException {
return acquireLock(new File(artifactFileToDownload.getAbsolutePath() + ".lck"));
}
public void unlockArtifact(Artifact artifact, File artifactFileToDownload) {
releaseLock(new File(artifactFileToDownload.getAbsolutePath() + ".lck"));
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.lock;
import java.io.File;
import org.apache.ivy.core.module.descriptor.Artifact;
public class ArtifactLockStrategy extends FileBasedLockStrategy {
public ArtifactLockStrategy() {
init();
}
public ArtifactLockStrategy(boolean debugLocking) {
super(debugLocking);
init();
}
private void init() {
setName("artifact-lock");
}
public boolean lockArtifact(Artifact artifact, File artifactFileToDownload)
throws InterruptedException {
return acquireLock(new File(artifactFileToDownload.getAbsolutePath() + ".lck"));
}
public void unlockArtifact(Artifact artifact, File artifactFileToDownload) {
releaseLock(new File(artifactFileToDownload.getAbsolutePath() + ".lck"));
}
}

View File

@ -1,230 +1,230 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.lock;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.util.HashMap;
import java.util.Map;
import org.apache.ivy.util.Message;
public abstract class FileBasedLockStrategy extends AbstractLockStrategy {
private static final int SLEEP_TIME = 100;
private static final long DEFAULT_TIMEOUT = 2 * 60 * 1000;
/**
* The locker to use to make file lock attempts.
* <p>
* Two implementations of FileLocker are provided below, according to our tests the
* CreateFileLocker is both performing better and much more reliable than NIOFileLocker.
* </p>
*/
private FileLocker locker;
private long timeout = DEFAULT_TIMEOUT;
private Map/*<File, Integer>*/ currentLockCounters = new HashMap();
protected FileBasedLockStrategy() {
this(new CreateFileLocker(false), false);
}
protected FileBasedLockStrategy(boolean debugLocking) {
this(new CreateFileLocker(debugLocking), debugLocking);
}
protected FileBasedLockStrategy(FileLocker locker, boolean debugLocking) {
super(debugLocking);
this.locker = locker;
}
protected boolean acquireLock(File file) throws InterruptedException {
if (isDebugLocking()) {
debugLocking("acquiring lock on " + file);
}
long start = System.currentTimeMillis();
do {
synchronized (this) {
if (hasLock(file)) {
int holdLocks = incrementLock(file);
if (isDebugLocking()) {
debugLocking("reentrant lock acquired on " + file
+ " in " + (System.currentTimeMillis() - start) + "ms"
+ " - hold locks = " + holdLocks);
}
return true;
}
if (locker.tryLock(file)) {
if (isDebugLocking()) {
debugLocking("lock acquired on " + file
+ " in " + (System.currentTimeMillis() - start) + "ms");
}
incrementLock(file);
return true;
}
}
Thread.sleep(SLEEP_TIME);
} while (System.currentTimeMillis() - start < timeout);
return false;
}
protected void releaseLock(File file) {
synchronized (this) {
int holdLocks = decrementLock(file);
if (holdLocks == 0) {
locker.unlock(file);
if (isDebugLocking()) {
debugLocking("lock released on " + file);
}
} else {
if (isDebugLocking()) {
debugLocking("reentrant lock released on " + file
+ " - hold locks = " + holdLocks);
}
}
}
}
private static void debugLocking(String msg) {
Message.info(Thread.currentThread() + " " + System.currentTimeMillis() + " " + msg);
}
private boolean hasLock(File file) {
Integer c = (Integer) currentLockCounters.get(file);
return c != null && c.intValue() > 0;
}
private int incrementLock(File file) {
Integer c = (Integer) currentLockCounters.get(file);
int holdLocks = c == null ? 1 : c.intValue() + 1;
currentLockCounters.put(file, new Integer(holdLocks));
return holdLocks;
}
private int decrementLock(File file) {
Integer c = (Integer) currentLockCounters.get(file);
int dc = c == null ? 0 : c.intValue() - 1;
currentLockCounters.put(file, new Integer(dc));
return dc;
}
public static interface FileLocker {
boolean tryLock(File f);
void unlock(File f);
}
/**
* "locks" a file by creating it if it doesn't exist, relying on the
* {@link File#createNewFile()} atomicity.
*/
public static class CreateFileLocker implements FileLocker {
private boolean debugLocking;
public CreateFileLocker(boolean debugLocking) {
this.debugLocking = debugLocking;
}
public boolean tryLock(File file) {
try {
if (file.getParentFile().exists() || file.getParentFile().mkdirs()) {
if (file.createNewFile()) {
return true;
} else {
if (debugLocking) {
debugLocking("file creation failed " + file);
}
}
}
} catch (IOException e) {
// ignored
Message.verbose("file creation failed due to an exception: "
+ e.getMessage() + " (" + file + ")");
}
return false;
}
public void unlock(File file) {
file.delete();
}
}
/**
* Locks a file using the {@link FileLock} mechanism.
*/
public static class NIOFileLocker implements FileLocker {
private Map locks = new HashMap();
private boolean debugLocking;
public NIOFileLocker(boolean debugLocking) {
this.debugLocking = debugLocking;
}
public boolean tryLock(File file) {
try {
if (file.getParentFile().exists() || file.getParentFile().mkdirs()) {
RandomAccessFile raf =
new RandomAccessFile(file, "rw");
FileChannel channel = raf.getChannel();
try {
FileLock l = channel.tryLock();
if (l != null) {
synchronized (this) {
locks.put(file, l);
}
return true;
} else {
if (debugLocking) {
debugLocking("failed to acquire lock on " + file);
}
}
} finally {
raf.close();
}
}
} catch (IOException e) {
// ignored
Message.verbose("file lock failed due to an exception: "
+ e.getMessage() + " (" + file + ")");
}
return false;
}
public void unlock(File file) {
synchronized (this) {
FileLock l = (FileLock) locks.get(file);
if (l == null) {
throw new IllegalArgumentException("file not previously locked: " + file);
}
try {
l.release();
} catch (IOException e) {
Message.error(
"problem while releasing lock on " + file + ": " + e.getMessage());
}
}
}
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.lock;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
import java.util.HashMap;
import java.util.Map;
import org.apache.ivy.util.Message;
public abstract class FileBasedLockStrategy extends AbstractLockStrategy {
private static final int SLEEP_TIME = 100;
private static final long DEFAULT_TIMEOUT = 2 * 60 * 1000;
/**
* The locker to use to make file lock attempts.
* <p>
* Two implementations of FileLocker are provided below, according to our tests the
* CreateFileLocker is both performing better and much more reliable than NIOFileLocker.
* </p>
*/
private FileLocker locker;
private long timeout = DEFAULT_TIMEOUT;
private Map/*<File, Integer>*/ currentLockCounters = new HashMap();
protected FileBasedLockStrategy() {
this(new CreateFileLocker(false), false);
}
protected FileBasedLockStrategy(boolean debugLocking) {
this(new CreateFileLocker(debugLocking), debugLocking);
}
protected FileBasedLockStrategy(FileLocker locker, boolean debugLocking) {
super(debugLocking);
this.locker = locker;
}
protected boolean acquireLock(File file) throws InterruptedException {
if (isDebugLocking()) {
debugLocking("acquiring lock on " + file);
}
long start = System.currentTimeMillis();
do {
synchronized (this) {
if (hasLock(file)) {
int holdLocks = incrementLock(file);
if (isDebugLocking()) {
debugLocking("reentrant lock acquired on " + file
+ " in " + (System.currentTimeMillis() - start) + "ms"
+ " - hold locks = " + holdLocks);
}
return true;
}
if (locker.tryLock(file)) {
if (isDebugLocking()) {
debugLocking("lock acquired on " + file
+ " in " + (System.currentTimeMillis() - start) + "ms");
}
incrementLock(file);
return true;
}
}
Thread.sleep(SLEEP_TIME);
} while (System.currentTimeMillis() - start < timeout);
return false;
}
protected void releaseLock(File file) {
synchronized (this) {
int holdLocks = decrementLock(file);
if (holdLocks == 0) {
locker.unlock(file);
if (isDebugLocking()) {
debugLocking("lock released on " + file);
}
} else {
if (isDebugLocking()) {
debugLocking("reentrant lock released on " + file
+ " - hold locks = " + holdLocks);
}
}
}
}
private static void debugLocking(String msg) {
Message.info(Thread.currentThread() + " " + System.currentTimeMillis() + " " + msg);
}
private boolean hasLock(File file) {
Integer c = (Integer) currentLockCounters.get(file);
return c != null && c.intValue() > 0;
}
private int incrementLock(File file) {
Integer c = (Integer) currentLockCounters.get(file);
int holdLocks = c == null ? 1 : c.intValue() + 1;
currentLockCounters.put(file, new Integer(holdLocks));
return holdLocks;
}
private int decrementLock(File file) {
Integer c = (Integer) currentLockCounters.get(file);
int dc = c == null ? 0 : c.intValue() - 1;
currentLockCounters.put(file, new Integer(dc));
return dc;
}
public static interface FileLocker {
boolean tryLock(File f);
void unlock(File f);
}
/**
* "locks" a file by creating it if it doesn't exist, relying on the
* {@link File#createNewFile()} atomicity.
*/
public static class CreateFileLocker implements FileLocker {
private boolean debugLocking;
public CreateFileLocker(boolean debugLocking) {
this.debugLocking = debugLocking;
}
public boolean tryLock(File file) {
try {
if (file.getParentFile().exists() || file.getParentFile().mkdirs()) {
if (file.createNewFile()) {
return true;
} else {
if (debugLocking) {
debugLocking("file creation failed " + file);
}
}
}
} catch (IOException e) {
// ignored
Message.verbose("file creation failed due to an exception: "
+ e.getMessage() + " (" + file + ")");
}
return false;
}
public void unlock(File file) {
file.delete();
}
}
/**
* Locks a file using the {@link FileLock} mechanism.
*/
public static class NIOFileLocker implements FileLocker {
private Map locks = new HashMap();
private boolean debugLocking;
public NIOFileLocker(boolean debugLocking) {
this.debugLocking = debugLocking;
}
public boolean tryLock(File file) {
try {
if (file.getParentFile().exists() || file.getParentFile().mkdirs()) {
RandomAccessFile raf =
new RandomAccessFile(file, "rw");
FileChannel channel = raf.getChannel();
try {
FileLock l = channel.tryLock();
if (l != null) {
synchronized (this) {
locks.put(file, l);
}
return true;
} else {
if (debugLocking) {
debugLocking("failed to acquire lock on " + file);
}
}
} finally {
raf.close();
}
}
} catch (IOException e) {
// ignored
Message.verbose("file lock failed due to an exception: "
+ e.getMessage() + " (" + file + ")");
}
return false;
}
public void unlock(File file) {
synchronized (this) {
FileLock l = (FileLock) locks.get(file);
if (l == null) {
throw new IllegalArgumentException("file not previously locked: " + file);
}
try {
l.release();
} catch (IOException e) {
Message.error(
"problem while releasing lock on " + file + ": " + e.getMessage());
}
}
}
}
}

View File

@ -1,73 +1,73 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.lock;
import java.io.File;
import org.apache.ivy.core.module.descriptor.Artifact;
/**
* A lock strategy determines when and how lock should be performed when downloading data to a
* cache.
* <p>
* Note that some implementations may actually choose to NOT perform locking, when no lock is
* necessary (cache not shared). Some other implementations may choose to lock the cache for the
* download of a whole module (not possible yet), or at the artifact level.
* <p>
* </p>
* The lock methods should return true when the lock is either actually acquired or not performed by
* the strategy.
* </p>
* <p>
* Locking used in the locking strategy must support reentrant lock. Reentrant locking should be
* performed for the whole strategy.
* </p>
*/
public interface LockStrategy {
/**
* Returns the name of the strategy
* @return the name of the strategy
*/
String getName();
/**
* Performs a lock before downloading the given {@link Artifact} to the given file.
*
* @param artifact
* the artifact about to be downloaded
* @param artifactFileToDownload
* the file where the artifact will be downloaded
* @return true if the artifact is locked, false otherwise
* @throws InterruptedException
* if the thread is interrupted while waiting to acquire the lock
*/
boolean lockArtifact(Artifact artifact, File artifactFileToDownload)
throws InterruptedException;
/**
* Release the lock acquired for an artifact download.
*
* @param artifact
* the artifact for which the lock was acquired
* @param artifactFileToDownload
* the file where the artifact is supposed to have been downloaded
*/
void unlockArtifact(Artifact artifact, File artifactFileToDownload);
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.lock;
import java.io.File;
import org.apache.ivy.core.module.descriptor.Artifact;
/**
* A lock strategy determines when and how lock should be performed when downloading data to a
* cache.
* <p>
* Note that some implementations may actually choose to NOT perform locking, when no lock is
* necessary (cache not shared). Some other implementations may choose to lock the cache for the
* download of a whole module (not possible yet), or at the artifact level.
* <p>
* </p>
* The lock methods should return true when the lock is either actually acquired or not performed by
* the strategy.
* </p>
* <p>
* Locking used in the locking strategy must support reentrant lock. Reentrant locking should be
* performed for the whole strategy.
* </p>
*/
public interface LockStrategy {
/**
* Returns the name of the strategy
* @return the name of the strategy
*/
String getName();
/**
* Performs a lock before downloading the given {@link Artifact} to the given file.
*
* @param artifact
* the artifact about to be downloaded
* @param artifactFileToDownload
* the file where the artifact will be downloaded
* @return true if the artifact is locked, false otherwise
* @throws InterruptedException
* if the thread is interrupted while waiting to acquire the lock
*/
boolean lockArtifact(Artifact artifact, File artifactFileToDownload)
throws InterruptedException;
/**
* Release the lock acquired for an artifact download.
*
* @param artifact
* the artifact for which the lock was acquired
* @param artifactFileToDownload
* the file where the artifact is supposed to have been downloaded
*/
void unlockArtifact(Artifact artifact, File artifactFileToDownload);
}

View File

@ -1,35 +1,35 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.lock;
import java.io.File;
import org.apache.ivy.core.module.descriptor.Artifact;
public class NoLockStrategy extends AbstractLockStrategy {
public NoLockStrategy() {
setName("no-lock");
}
public final boolean lockArtifact(Artifact artifact, File artifactFileToDownload) {
return true;
}
public final void unlockArtifact(Artifact artifact, File artifactFileToDownload) {
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.lock;
import java.io.File;
import org.apache.ivy.core.module.descriptor.Artifact;
public class NoLockStrategy extends AbstractLockStrategy {
public NoLockStrategy() {
setName("no-lock");
}
public final boolean lockArtifact(Artifact artifact, File artifactFileToDownload) {
return true;
}
public final void unlockArtifact(Artifact artifact, File artifactFileToDownload) {
}
}

View File

@ -1,191 +1,191 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.parser.m2;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class PomWriterOptions {
private String[] confs;
private String licenseHeader;
private ConfigurationScopeMapping mapping;
private boolean printIvyInfo = true;
private String artifactName;
private String artifactPackaging;
private List/*<ExtraDependency>*/ extraDependencies = new ArrayList();
private String description;
private File template;
public File getTemplate() {
return template;
}
public PomWriterOptions setTemplate(File template) {
this.template = template;
return this;
}
public String[] getConfs() {
return confs;
}
public PomWriterOptions setConfs(String[] confs) {
this.confs = confs;
return this;
}
public String getLicenseHeader() {
return licenseHeader;
}
public PomWriterOptions setLicenseHeader(String licenseHeader) {
this.licenseHeader = licenseHeader;
if (this.licenseHeader != null) {
this.licenseHeader = this.licenseHeader.trim();
}
return this;
}
public ConfigurationScopeMapping getMapping() {
return mapping;
}
public PomWriterOptions setMapping(ConfigurationScopeMapping mapping) {
this.mapping = mapping;
return this;
}
public boolean isPrintIvyInfo() {
return printIvyInfo;
}
public PomWriterOptions setPrintIvyInfo(boolean printIvyInfo) {
this.printIvyInfo = printIvyInfo;
return this;
}
public List/*<ExtraDependency>*/ getExtraDependencies() {
return extraDependencies;
}
public PomWriterOptions setExtraDependencies(List/*<ExtraDependency>*/ extraDependencies) {
this.extraDependencies = extraDependencies;
return this;
}
public String getArtifactName() {
return artifactName;
}
public PomWriterOptions setArtifactName(String artifactName) {
this.artifactName = artifactName;
return this;
}
public String getArtifactPackaging() {
return artifactPackaging;
}
public PomWriterOptions setArtifactPackaging(String artifactPackaging) {
this.artifactPackaging = artifactPackaging;
return this;
}
public String getDescription() {
return description;
}
public PomWriterOptions setDescription(String description) {
this.description = description;
return this;
}
public static class ConfigurationScopeMapping {
private Map/*<String,String>*/ scopes;
public ConfigurationScopeMapping(Map/*<String,String>*/ scopesMapping) {
this.scopes = new HashMap(scopesMapping);
}
/**
* Returns the scope mapped to the given configuration array.
*
* @param confs the configurations for which the scope should be returned
* @return the scope to which the conf is mapped
*/
public String getScope(String[] confs) {
for (int i = 0; i < confs.length; i++) {
if (scopes.containsKey(confs[i])) {
return (String) scopes.get(confs[i]);
}
}
return null;
}
public boolean isOptional(String[] confs) {
return getScope(confs) == null;
}
}
public static class ExtraDependency {
private String group;
private String artifact;
private String version;
private String scope;
private boolean optional;
public ExtraDependency(String group, String artifact, String version, String scope, boolean optional) {
this.group = group;
this.artifact = artifact;
this.version = version;
this.scope = scope;
this.optional = optional;
}
public String getGroup() {
return group;
}
public String getArtifact() {
return artifact;
}
public String getVersion() {
return version;
}
public String getScope() {
return scope;
}
public boolean isOptional() {
return optional;
}
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.parser.m2;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class PomWriterOptions {
private String[] confs;
private String licenseHeader;
private ConfigurationScopeMapping mapping;
private boolean printIvyInfo = true;
private String artifactName;
private String artifactPackaging;
private List/*<ExtraDependency>*/ extraDependencies = new ArrayList();
private String description;
private File template;
public File getTemplate() {
return template;
}
public PomWriterOptions setTemplate(File template) {
this.template = template;
return this;
}
public String[] getConfs() {
return confs;
}
public PomWriterOptions setConfs(String[] confs) {
this.confs = confs;
return this;
}
public String getLicenseHeader() {
return licenseHeader;
}
public PomWriterOptions setLicenseHeader(String licenseHeader) {
this.licenseHeader = licenseHeader;
if (this.licenseHeader != null) {
this.licenseHeader = this.licenseHeader.trim();
}
return this;
}
public ConfigurationScopeMapping getMapping() {
return mapping;
}
public PomWriterOptions setMapping(ConfigurationScopeMapping mapping) {
this.mapping = mapping;
return this;
}
public boolean isPrintIvyInfo() {
return printIvyInfo;
}
public PomWriterOptions setPrintIvyInfo(boolean printIvyInfo) {
this.printIvyInfo = printIvyInfo;
return this;
}
public List/*<ExtraDependency>*/ getExtraDependencies() {
return extraDependencies;
}
public PomWriterOptions setExtraDependencies(List/*<ExtraDependency>*/ extraDependencies) {
this.extraDependencies = extraDependencies;
return this;
}
public String getArtifactName() {
return artifactName;
}
public PomWriterOptions setArtifactName(String artifactName) {
this.artifactName = artifactName;
return this;
}
public String getArtifactPackaging() {
return artifactPackaging;
}
public PomWriterOptions setArtifactPackaging(String artifactPackaging) {
this.artifactPackaging = artifactPackaging;
return this;
}
public String getDescription() {
return description;
}
public PomWriterOptions setDescription(String description) {
this.description = description;
return this;
}
public static class ConfigurationScopeMapping {
private Map/*<String,String>*/ scopes;
public ConfigurationScopeMapping(Map/*<String,String>*/ scopesMapping) {
this.scopes = new HashMap(scopesMapping);
}
/**
* Returns the scope mapped to the given configuration array.
*
* @param confs the configurations for which the scope should be returned
* @return the scope to which the conf is mapped
*/
public String getScope(String[] confs) {
for (int i = 0; i < confs.length; i++) {
if (scopes.containsKey(confs[i])) {
return (String) scopes.get(confs[i]);
}
}
return null;
}
public boolean isOptional(String[] confs) {
return getScope(confs) == null;
}
}
public static class ExtraDependency {
private String group;
private String artifact;
private String version;
private String scope;
private boolean optional;
public ExtraDependency(String group, String artifact, String version, String scope, boolean optional) {
this.group = group;
this.artifact = artifact;
this.version = version;
this.scope = scope;
this.optional = optional;
}
public String getGroup() {
return group;
}
public String getArtifact() {
return artifact;
}
public String getVersion() {
return version;
}
public String getScope() {
return scope;
}
public boolean isOptional() {
return optional;
}
}
}

View File

@ -1,29 +1,29 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.repository;
import org.apache.ivy.core.module.descriptor.Artifact;
import org.apache.ivy.plugins.resolver.util.ResolvedResource;
/**
* An {@link ArtifactResourceResolver} is responsible for the resolution of an artifact into a
* {@link ResolvedResource}.
*/
public interface ArtifactResourceResolver {
public ResolvedResource resolve(Artifact artifact);
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.repository;
import org.apache.ivy.core.module.descriptor.Artifact;
import org.apache.ivy.plugins.resolver.util.ResolvedResource;
/**
* An {@link ArtifactResourceResolver} is responsible for the resolution of an artifact into a
* {@link ResolvedResource}.
*/
public interface ArtifactResourceResolver {
public ResolvedResource resolve(Artifact artifact);
}

View File

@ -1,38 +1,38 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.repository;
import java.io.File;
import java.io.IOException;
import org.apache.ivy.core.module.descriptor.Artifact;
/**
* A {@link ResourceDownloader} is able to download a Resource to a File.
* <p>
* Depending on the implementation, the downloader may also choose to download checksums
* automatically and check the consistency of the downloaded resource.
* </p>
* <p>
* The implementation is also responsible for using a .part file during download, to ensure the
* destination file will exist only if the download is completed successfully.
* </p>
*/
public interface ResourceDownloader {
public void download(Artifact artifact, Resource resource, File dest) throws IOException;
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.repository;
import java.io.File;
import java.io.IOException;
import org.apache.ivy.core.module.descriptor.Artifact;
/**
* A {@link ResourceDownloader} is able to download a Resource to a File.
* <p>
* Depending on the implementation, the downloader may also choose to download checksums
* automatically and check the consistency of the downloaded resource.
* </p>
* <p>
* The implementation is also responsible for using a .part file during download, to ensure the
* destination file will exist only if the download is completed successfully.
* </p>
*/
public interface ResourceDownloader {
public void download(Artifact artifact, Resource resource, File dest) throws IOException;
}

View File

@ -1,31 +1,31 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.signer;
import java.io.File;
import java.io.IOException;
public interface SignatureGenerator {
String getName();
void sign(File src, File dest) throws IOException;
String getExtension();
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.signer;
import java.io.File;
import java.io.IOException;
public interface SignatureGenerator {
String getName();
void sign(File src, File dest) throws IOException;
String getExtension();
}

View File

@ -1,176 +1,176 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.signer.bouncycastle;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.Security;
import java.security.SignatureException;
import java.util.Iterator;
import org.apache.ivy.plugins.signer.SignatureGenerator;
import org.bouncycastle.bcpg.ArmoredOutputStream;
import org.bouncycastle.bcpg.BCPGOutputStream;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPPrivateKey;
import org.bouncycastle.openpgp.PGPSecretKey;
import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
import org.bouncycastle.openpgp.PGPSignature;
import org.bouncycastle.openpgp.PGPSignatureGenerator;
import org.bouncycastle.openpgp.PGPUtil;
public class OpenPGPSignatureGenerator implements SignatureGenerator {
private static final long MASK = 0xFFFFFFFFL;
static {
Security.addProvider(new BouncyCastleProvider());
}
private String name;
private String secring;
private String password;
private String keyId;
private PGPSecretKey pgpSec;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getExtension() {
return "asc";
}
public void setPassword(String password) {
this.password = password;
}
public void setSecring(String secring) {
this.secring = secring;
}
public void setKeyId(String keyId) {
if (!"auto".equals(keyId)) {
this.keyId = keyId;
}
}
public void sign(File src, File dest) throws IOException {
OutputStream out = null;
InputStream in = null;
InputStream keyIn = null;
try {
if (secring == null) {
secring = System.getProperty("user.home") + "/.gnupg/secring.gpg";
}
if (pgpSec == null) {
keyIn = new FileInputStream(secring);
pgpSec = readSecretKey(keyIn);
}
PGPPrivateKey pgpPrivKey = pgpSec.extractPrivateKey(password.toCharArray(), BouncyCastleProvider.PROVIDER_NAME);
PGPSignatureGenerator sGen = new PGPSignatureGenerator(pgpSec.getPublicKey().getAlgorithm(), PGPUtil.SHA1, BouncyCastleProvider.PROVIDER_NAME);
sGen.initSign(PGPSignature.BINARY_DOCUMENT, pgpPrivKey);
in = new FileInputStream(src);
out = new BCPGOutputStream(new ArmoredOutputStream(new FileOutputStream(dest)));
int ch = 0;
while ((ch = in.read()) >= 0) {
sGen.update((byte) ch);
}
sGen.generate().encode(out);
} catch (SignatureException e) {
IOException ioexc = new IOException();
ioexc.initCause(e);
throw ioexc;
} catch (PGPException e) {
IOException ioexc = new IOException();
ioexc.initCause(e);
throw ioexc;
} catch (NoSuchAlgorithmException e) {
IOException ioexc = new IOException();
ioexc.initCause(e);
throw ioexc;
} catch (NoSuchProviderException e) {
IOException ioexc = new IOException();
ioexc.initCause(e);
throw ioexc;
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {}
}
if (in != null) {
try {
in.close();
} catch (IOException e) {}
}
if (keyIn != null) {
try {
keyIn.close();
} catch (IOException e) {}
}
}
}
private PGPSecretKey readSecretKey(InputStream in) throws IOException, PGPException {
in = PGPUtil.getDecoderStream(in);
PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(in);
PGPSecretKey key = null;
for (Iterator it = pgpSec.getKeyRings(); key == null && it.hasNext(); ) {
PGPSecretKeyRing kRing = (PGPSecretKeyRing) it.next();
for (Iterator it2 = kRing.getSecretKeys(); key == null && it2.hasNext(); ) {
PGPSecretKey k = (PGPSecretKey) it2.next();
if ((keyId == null) && k.isSigningKey()) {
key = k;
}
if ((keyId != null) && (Long.valueOf(keyId, 16).longValue() == (k.getKeyID() & MASK))) {
key = k;
}
}
}
if (key == null) {
throw new IllegalArgumentException("Can't find encryption key" +
(keyId != null ? " '" + keyId + "' " : " ") + "in key ring.");
}
return key;
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.signer.bouncycastle;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.Security;
import java.security.SignatureException;
import java.util.Iterator;
import org.apache.ivy.plugins.signer.SignatureGenerator;
import org.bouncycastle.bcpg.ArmoredOutputStream;
import org.bouncycastle.bcpg.BCPGOutputStream;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPPrivateKey;
import org.bouncycastle.openpgp.PGPSecretKey;
import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
import org.bouncycastle.openpgp.PGPSignature;
import org.bouncycastle.openpgp.PGPSignatureGenerator;
import org.bouncycastle.openpgp.PGPUtil;
public class OpenPGPSignatureGenerator implements SignatureGenerator {
private static final long MASK = 0xFFFFFFFFL;
static {
Security.addProvider(new BouncyCastleProvider());
}
private String name;
private String secring;
private String password;
private String keyId;
private PGPSecretKey pgpSec;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getExtension() {
return "asc";
}
public void setPassword(String password) {
this.password = password;
}
public void setSecring(String secring) {
this.secring = secring;
}
public void setKeyId(String keyId) {
if (!"auto".equals(keyId)) {
this.keyId = keyId;
}
}
public void sign(File src, File dest) throws IOException {
OutputStream out = null;
InputStream in = null;
InputStream keyIn = null;
try {
if (secring == null) {
secring = System.getProperty("user.home") + "/.gnupg/secring.gpg";
}
if (pgpSec == null) {
keyIn = new FileInputStream(secring);
pgpSec = readSecretKey(keyIn);
}
PGPPrivateKey pgpPrivKey = pgpSec.extractPrivateKey(password.toCharArray(), BouncyCastleProvider.PROVIDER_NAME);
PGPSignatureGenerator sGen = new PGPSignatureGenerator(pgpSec.getPublicKey().getAlgorithm(), PGPUtil.SHA1, BouncyCastleProvider.PROVIDER_NAME);
sGen.initSign(PGPSignature.BINARY_DOCUMENT, pgpPrivKey);
in = new FileInputStream(src);
out = new BCPGOutputStream(new ArmoredOutputStream(new FileOutputStream(dest)));
int ch = 0;
while ((ch = in.read()) >= 0) {
sGen.update((byte) ch);
}
sGen.generate().encode(out);
} catch (SignatureException e) {
IOException ioexc = new IOException();
ioexc.initCause(e);
throw ioexc;
} catch (PGPException e) {
IOException ioexc = new IOException();
ioexc.initCause(e);
throw ioexc;
} catch (NoSuchAlgorithmException e) {
IOException ioexc = new IOException();
ioexc.initCause(e);
throw ioexc;
} catch (NoSuchProviderException e) {
IOException ioexc = new IOException();
ioexc.initCause(e);
throw ioexc;
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {}
}
if (in != null) {
try {
in.close();
} catch (IOException e) {}
}
if (keyIn != null) {
try {
keyIn.close();
} catch (IOException e) {}
}
}
}
private PGPSecretKey readSecretKey(InputStream in) throws IOException, PGPException {
in = PGPUtil.getDecoderStream(in);
PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(in);
PGPSecretKey key = null;
for (Iterator it = pgpSec.getKeyRings(); key == null && it.hasNext(); ) {
PGPSecretKeyRing kRing = (PGPSecretKeyRing) it.next();
for (Iterator it2 = kRing.getSecretKeys(); key == null && it2.hasNext(); ) {
PGPSecretKey k = (PGPSecretKey) it2.next();
if ((keyId == null) && k.isSigningKey()) {
key = k;
}
if ((keyId != null) && (Long.valueOf(keyId, 16).longValue() == (k.getKeyID() & MASK))) {
key = k;
}
}
}
if (key == null) {
throw new IllegalArgumentException("Can't find encryption key" +
(keyId != null ? " '" + keyId + "' " : " ") + "in key ring.");
}
return key;
}
}

View File

@ -1,125 +1,125 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.trigger;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import org.apache.ivy.core.IvyPatternHelper;
import org.apache.ivy.core.event.IvyEvent;
import org.apache.ivy.core.resolve.ResolveProcessException;
import org.apache.ivy.util.Message;
/**
* A trigger performing logging.
* <p>
* The implementation is widely inspired by Ant Echo task.
* </p>
*/
public class LogTrigger extends AbstractTrigger {
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
private String message = "";
private File file = null;
private boolean append = true;
/** encoding; set to null or empty means 'default' */
private String encoding = "";
public void progress(IvyEvent event) {
log(IvyPatternHelper.substituteVariables(message, event.getAttributes()));
}
/**
* Logs the given message.
*
* @param message the message to log
*/
protected void log(String message) {
if (file == null) {
Message.info(message);
} else {
Writer out = null;
try {
// we add a line separator here for consistency with Message.info which creates a
// new line each time.
// we use the system dependent line separator to ease reading the log file
message += LINE_SEPARATOR;
String filename = file.getAbsolutePath();
if (encoding == null || encoding.length() == 0) {
out = new FileWriter(filename, append);
} else {
out = new BufferedWriter(
new OutputStreamWriter(
new FileOutputStream(filename, append), encoding));
}
out.write(message, 0, message.length());
} catch (IOException e) {
throw new ResolveProcessException(e);
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
throw new ResolveProcessException(e);
}
}
}
}
}
/**
* Message to write.
*
* @param msg Sets the value for the message variable.
*/
public void setMessage(String msg) {
this.message = msg;
}
/**
* File to write to.
* @param file the file to write to, if not set, echo to standard Ivy logging
*/
public void setFile(File file) {
this.file = file;
}
/**
* If true, append to existing file.
* @param append if true, append to existing file, default is false.
*/
public void setAppend(boolean append) {
this.append = append;
}
/**
* Declare the encoding to use when outputting to a file;
* Use "" for the platform's default encoding.
* @param encoding the character encoding to use.
*/
public void setEncoding(String encoding) {
this.encoding = encoding;
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.trigger;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import org.apache.ivy.core.IvyPatternHelper;
import org.apache.ivy.core.event.IvyEvent;
import org.apache.ivy.core.resolve.ResolveProcessException;
import org.apache.ivy.util.Message;
/**
* A trigger performing logging.
* <p>
* The implementation is widely inspired by Ant Echo task.
* </p>
*/
public class LogTrigger extends AbstractTrigger {
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
private String message = "";
private File file = null;
private boolean append = true;
/** encoding; set to null or empty means 'default' */
private String encoding = "";
public void progress(IvyEvent event) {
log(IvyPatternHelper.substituteVariables(message, event.getAttributes()));
}
/**
* Logs the given message.
*
* @param message the message to log
*/
protected void log(String message) {
if (file == null) {
Message.info(message);
} else {
Writer out = null;
try {
// we add a line separator here for consistency with Message.info which creates a
// new line each time.
// we use the system dependent line separator to ease reading the log file
message += LINE_SEPARATOR;
String filename = file.getAbsolutePath();
if (encoding == null || encoding.length() == 0) {
out = new FileWriter(filename, append);
} else {
out = new BufferedWriter(
new OutputStreamWriter(
new FileOutputStream(filename, append), encoding));
}
out.write(message, 0, message.length());
} catch (IOException e) {
throw new ResolveProcessException(e);
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
throw new ResolveProcessException(e);
}
}
}
}
}
/**
* Message to write.
*
* @param msg Sets the value for the message variable.
*/
public void setMessage(String msg) {
this.message = msg;
}
/**
* File to write to.
* @param file the file to write to, if not set, echo to standard Ivy logging
*/
public void setFile(File file) {
this.file = file;
}
/**
* If true, append to existing file.
* @param append if true, append to existing file, default is false.
*/
public void setAppend(boolean append) {
this.append = append;
}
/**
* Declare the encoding to use when outputting to a file;
* Use "" for the platform's default encoding.
* @param encoding the character encoding to use.
*/
public void setEncoding(String encoding) {
this.encoding = encoding;
}
}

View File

@ -1,90 +1,90 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.util;
/**
* Memory related utilities.
*/
public final class MemoryUtil {
private static final int SAMPLING_SIZE = 100;
private static final int SLEEP_TIME = 100;
private MemoryUtil() {
}
/**
* Returns the approximate size of a default instance of the given class.
*
* @param clazz
* the class to evaluate.
* @return the estimated size of instance, in bytes.
*/
public static long sizeOf(Class clazz) {
long size = 0;
Object[] objects = new Object[SAMPLING_SIZE];
try {
clazz.newInstance();
long startingMemoryUse = getUsedMemory();
for (int i = 0; i < objects.length; i++) {
objects[i] = clazz.newInstance();
}
long endingMemoryUse = getUsedMemory();
float approxSize = (endingMemoryUse - startingMemoryUse) / (float) objects.length;
size = Math.round(approxSize);
} catch (Exception e) {
System.out.println("WARNING:couldn't instantiate" + clazz);
e.printStackTrace();
}
return size;
}
/**
* Returns the currently used memory, after calling garbage collector and waiting enough to get
* maximal chance it is actually called. But since {@link Runtime#gc()} is only advisory,
* results returned by this method should be treated as rough approximation only.
*
* @return the currently used memory, in bytes.
*/
public static long getUsedMemory() {
gc();
long totalMemory = Runtime.getRuntime().totalMemory();
gc();
long freeMemory = Runtime.getRuntime().freeMemory();
long usedMemory = totalMemory - freeMemory;
return usedMemory;
}
private static void gc() {
try {
System.gc();
Thread.sleep(SLEEP_TIME);
System.runFinalization();
Thread.sleep(SLEEP_TIME);
System.gc();
Thread.sleep(SLEEP_TIME);
System.runFinalization();
Thread.sleep(SLEEP_TIME);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) throws ClassNotFoundException {
System.out.println(sizeOf(Class.forName(args[0])));
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.util;
/**
* Memory related utilities.
*/
public final class MemoryUtil {
private static final int SAMPLING_SIZE = 100;
private static final int SLEEP_TIME = 100;
private MemoryUtil() {
}
/**
* Returns the approximate size of a default instance of the given class.
*
* @param clazz
* the class to evaluate.
* @return the estimated size of instance, in bytes.
*/
public static long sizeOf(Class clazz) {
long size = 0;
Object[] objects = new Object[SAMPLING_SIZE];
try {
clazz.newInstance();
long startingMemoryUse = getUsedMemory();
for (int i = 0; i < objects.length; i++) {
objects[i] = clazz.newInstance();
}
long endingMemoryUse = getUsedMemory();
float approxSize = (endingMemoryUse - startingMemoryUse) / (float) objects.length;
size = Math.round(approxSize);
} catch (Exception e) {
System.out.println("WARNING:couldn't instantiate" + clazz);
e.printStackTrace();
}
return size;
}
/**
* Returns the currently used memory, after calling garbage collector and waiting enough to get
* maximal chance it is actually called. But since {@link Runtime#gc()} is only advisory,
* results returned by this method should be treated as rough approximation only.
*
* @return the currently used memory, in bytes.
*/
public static long getUsedMemory() {
gc();
long totalMemory = Runtime.getRuntime().totalMemory();
gc();
long freeMemory = Runtime.getRuntime().freeMemory();
long usedMemory = totalMemory - freeMemory;
return usedMemory;
}
private static void gc() {
try {
System.gc();
Thread.sleep(SLEEP_TIME);
System.runFinalization();
Thread.sleep(SLEEP_TIME);
System.gc();
Thread.sleep(SLEEP_TIME);
System.runFinalization();
Thread.sleep(SLEEP_TIME);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) throws ClassNotFoundException {
System.out.println(sizeOf(Class.forName(args[0])));
}
}

View File

@ -1,18 +1,18 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

View File

@ -1,21 +1,21 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.2">
<info organisation="apache2" module="E"/>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.2">
<info organisation="apache2" module="E"/>
</ivy-module>

View File

@ -1,18 +1,18 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

View File

@ -1,48 +1,48 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns:ivy="antlib:org.apache.ivy.ant" basedir="../../../../../..">
<target name="setUp">
<property name="ivy.cache.repository" value="build/cache" />
</target>
<target name="tearDown">
<delete dir="build/cache" />
</target>
<target name="testOverrideNotSpecified">
<ivy:configure settingsId="test1" file="test/repositories/ivysettings.xml" />
<ivy:resolve settingsRef="test1" file="test/java/org/apache/ivy/ant/ivy-simple.xml" />
</target>
<target name="testOverrideSetToFalse">
<ivy:configure settingsId="test2" file="test/repositories/ivysettings.xml" override="false" />
<ivy:resolve settingsRef="test2" file="test/java/org/apache/ivy/ant/ivy-simple.xml" />
</target>
<target name="testUnnecessaryDefaultIvyInstance">
<ivy:configure settingsId="testUnnecessaryDefaultIvyInstance" file="test/repositories/ivysettings.xml" override="true" />
<ivy:cachepath settingsRef="testUnnecessaryDefaultIvyInstance" file="test/java/org/apache/ivy/ant/ivy-simple.xml" pathid="ptest" />
</target>
<target name="testSettingsWithPropertyAsId">
<property name="my.property" value="whatever" />
<ivy:settings id="${my.property}" file="test/repositories/ivysettings.xml" />
<ivy:resolve settingsRef="${my.property}" file="test/java/org/apache/ivy/ant/ivy-simple.xml" />
</target>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns:ivy="antlib:org.apache.ivy.ant" basedir="../../../../../..">
<target name="setUp">
<property name="ivy.cache.repository" value="build/cache" />
</target>
<target name="tearDown">
<delete dir="build/cache" />
</target>
<target name="testOverrideNotSpecified">
<ivy:configure settingsId="test1" file="test/repositories/ivysettings.xml" />
<ivy:resolve settingsRef="test1" file="test/java/org/apache/ivy/ant/ivy-simple.xml" />
</target>
<target name="testOverrideSetToFalse">
<ivy:configure settingsId="test2" file="test/repositories/ivysettings.xml" override="false" />
<ivy:resolve settingsRef="test2" file="test/java/org/apache/ivy/ant/ivy-simple.xml" />
</target>
<target name="testUnnecessaryDefaultIvyInstance">
<ivy:configure settingsId="testUnnecessaryDefaultIvyInstance" file="test/repositories/ivysettings.xml" override="true" />
<ivy:cachepath settingsRef="testUnnecessaryDefaultIvyInstance" file="test/java/org/apache/ivy/ant/ivy-simple.xml" pathid="ptest" />
</target>
<target name="testSettingsWithPropertyAsId">
<property name="my.property" value="whatever" />
<ivy:settings id="${my.property}" file="test/repositories/ivysettings.xml" />
<ivy:resolve settingsRef="${my.property}" file="test/java/org/apache/ivy/ant/ivy-simple.xml" />
</target>
</project>

View File

@ -1,33 +1,33 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns:ivy="antlib:org.apache.ivy.ant" basedir="../../../../../..">
<target name="setUp">
<property name="ivy.cache.repository" value="build/cache" />
</target>
<target name="tearDown">
<delete dir="build/cache" />
</target>
<target name="testStackOverflow">
<ivy:settings id="ivy.instance" file="test/repositories/ivysettings.xml" />
<ivy:resolve settingsRef="ivy.instance" file="test/java/org/apache/ivy/ant/ivy-simple.xml" />
</target>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns:ivy="antlib:org.apache.ivy.ant" basedir="../../../../../..">
<target name="setUp">
<property name="ivy.cache.repository" value="build/cache" />
</target>
<target name="tearDown">
<delete dir="build/cache" />
</target>
<target name="testStackOverflow">
<ivy:settings id="ivy.instance" file="test/repositories/ivysettings.xml" />
<ivy:resolve settingsRef="ivy.instance" file="test/java/org/apache/ivy/ant/ivy-simple.xml" />
</target>
</project>

View File

@ -1,69 +1,69 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.ant;
import org.apache.ivy.core.report.ResolveReport;
import org.apache.tools.ant.BuildFileTest;
public class IvyAntSettingsBuildFileTest extends BuildFileTest {
protected void setUp() throws Exception {
configureProject("test/java/org/apache/ivy/ant/IvyAntSettingsBuildFile.xml");
}
public void testOverrideNotSpecified() {
executeTarget("testOverrideNotSpecified");
ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
assertNotNull(report);
assertFalse(report.hasError());
assertEquals(1, report.getDependencies().size());
}
public void testOverrideSetToFalse() {
executeTarget("testOverrideSetToFalse");
ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
assertNotNull(report);
assertFalse(report.hasError());
assertEquals(1, report.getDependencies().size());
}
public void testUnnecessaryDefaultIvyInstance() {
executeTarget("testUnnecessaryDefaultIvyInstance");
assertNull("Default ivy.instance settings shouldn't have been loaded",
getProject().getReference("ivy.instance"));
}
public void testSettingsWithIdIvyInstance() {
// IVY-925
executeTarget("testSettingsWithPropertyAsId");
ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
assertNotNull(report);
assertFalse(report.hasError());
assertEquals(1, report.getDependencies().size());
}
public void testStackOverflow() {
// IVY-924
configureProject("test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileStackOverflow.xml");
executeTarget("testStackOverflow");
ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
assertNotNull(report);
assertFalse(report.hasError());
assertEquals(1, report.getDependencies().size());
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.ant;
import org.apache.ivy.core.report.ResolveReport;
import org.apache.tools.ant.BuildFileTest;
public class IvyAntSettingsBuildFileTest extends BuildFileTest {
protected void setUp() throws Exception {
configureProject("test/java/org/apache/ivy/ant/IvyAntSettingsBuildFile.xml");
}
public void testOverrideNotSpecified() {
executeTarget("testOverrideNotSpecified");
ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
assertNotNull(report);
assertFalse(report.hasError());
assertEquals(1, report.getDependencies().size());
}
public void testOverrideSetToFalse() {
executeTarget("testOverrideSetToFalse");
ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
assertNotNull(report);
assertFalse(report.hasError());
assertEquals(1, report.getDependencies().size());
}
public void testUnnecessaryDefaultIvyInstance() {
executeTarget("testUnnecessaryDefaultIvyInstance");
assertNull("Default ivy.instance settings shouldn't have been loaded",
getProject().getReference("ivy.instance"));
}
public void testSettingsWithIdIvyInstance() {
// IVY-925
executeTarget("testSettingsWithPropertyAsId");
ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
assertNotNull(report);
assertFalse(report.hasError());
assertEquals(1, report.getDependencies().size());
}
public void testStackOverflow() {
// IVY-924
configureProject("test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileStackOverflow.xml");
executeTarget("testStackOverflow");
ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
assertNotNull(report);
assertFalse(report.hasError());
assertEquals(1, report.getDependencies().size());
}
}

View File

@ -1,35 +1,35 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns:ivy="antlib:org.apache.ivy.ant" basedir="../../../../../..">
<target name="setUp">
<property name="ivy.cache.repository" value="build/cache" />
</target>
<target name="tearDown">
<delete dir="build/cache" />
</target>
<target name="testMultipleInlineRetrievesWithCacheCleaning">
<ivy:settings file="test/repositories/ivysettings.xml" />
<ivy:retrieve organisation="org1" module="mod1.2" revision="2.0" inline="true" keep="true" />
<ivy:cleancache />
<ivy:retrieve organisation="org1" module="mod1.2" revision="2.0" inline="true" keep="true" />
</target>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns:ivy="antlib:org.apache.ivy.ant" basedir="../../../../../..">
<target name="setUp">
<property name="ivy.cache.repository" value="build/cache" />
</target>
<target name="tearDown">
<delete dir="build/cache" />
</target>
<target name="testMultipleInlineRetrievesWithCacheCleaning">
<ivy:settings file="test/repositories/ivysettings.xml" />
<ivy:retrieve organisation="org1" module="mod1.2" revision="2.0" inline="true" keep="true" />
<ivy:cleancache />
<ivy:retrieve organisation="org1" module="mod1.2" revision="2.0" inline="true" keep="true" />
</target>
</project>

View File

@ -1,36 +1,36 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.ant;
import org.apache.ivy.core.report.ResolveReport;
import org.apache.tools.ant.BuildFileTest;
public class IvyRetrieveBuildFileTest extends BuildFileTest {
protected void setUp() throws Exception {
configureProject("test/java/org/apache/ivy/ant/IvyRetrieveBuildFile.xml");
}
public void testMultipleInlineRetrievesWithCacheCleaning() {
executeTarget("testMultipleInlineRetrievesWithCacheCleaning");
ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
assertNotNull(report);
assertFalse(report.hasError());
assertEquals(1, report.getDependencies().size());
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.ant;
import org.apache.ivy.core.report.ResolveReport;
import org.apache.tools.ant.BuildFileTest;
public class IvyRetrieveBuildFileTest extends BuildFileTest {
protected void setUp() throws Exception {
configureProject("test/java/org/apache/ivy/ant/IvyRetrieveBuildFile.xml");
}
public void testMultipleInlineRetrievesWithCacheCleaning() {
executeTarget("testMultipleInlineRetrievesWithCacheCleaning");
ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
assertNotNull(report);
assertFalse(report.hasError());
assertEquals(1, report.getDependencies().size());
}
}

View File

@ -1,24 +1,24 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.2">
<info organisation="apache" module="630"/>
<dependencies>
<dependency org="junit" name="junit" rev="latest.integration" conf="default" transitive="false" />
</dependencies>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.2">
<info organisation="apache" module="630"/>
<dependencies>
<dependency org="junit" name="junit" rev="latest.integration" conf="default" transitive="false" />
</dependencies>
</ivy-module>

View File

@ -1,24 +1,24 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.2">
<info organisation="apache" module="613"/>
<dependencies>
<dependency org="org1" name="mod1.2" rev="latest.integration" conf="default" transitive="false" />
</dependencies>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.2">
<info organisation="apache" module="613"/>
<dependencies>
<dependency org="org1" name="mod1.2" rev="latest.integration" conf="default" transitive="false" />
</dependencies>
</ivy-module>

View File

@ -1,36 +1,36 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0" xmlns:e="http://ant.apache.org/ivy/extra">
<info organisation="org.apache"
module="test"
revision="1.0"
status="integration"
publication="20060119075801"
/>
<configurations>
<conf name="master" description="Master dependencies" />
<conf name="alt" description="Alternate dependencies" />
<conf name="doc" description="Documentation dependencies" />
</configurations>
<publications>
<artifact name="test" type="jar" ext="jar" conf="master,alt" e:data="main"/>
<artifact name="test-a" type="jar" ext="jar" conf="alt" e:data="client"/>
<artifact name="stuff" type="javadoc" ext="zip" conf="doc"/>
</publications>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0" xmlns:e="http://ant.apache.org/ivy/extra">
<info organisation="org.apache"
module="test"
revision="1.0"
status="integration"
publication="20060119075801"
/>
<configurations>
<conf name="master" description="Master dependencies" />
<conf name="alt" description="Alternate dependencies" />
<conf name="doc" description="Documentation dependencies" />
</configurations>
<publications>
<artifact name="test" type="jar" ext="jar" conf="master,alt" e:data="main"/>
<artifact name="test-a" type="jar" ext="jar" conf="alt" e:data="client"/>
<artifact name="stuff" type="javadoc" ext="zip" conf="doc"/>
</publications>
</ivy-module>

View File

@ -1,51 +1,51 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="2.0">
<info organisation="apache" module="resolve-extends" revision="1.2" status="release">
<!-- <extends organisation="apache" module="resolve-simple" revision="1.0" location="./ivy-multiconf.xml"/> -->
<!-- description inherited from parent -->
<description>Demonstrates configuration-specific dependencies</description>
</info>
<configurations>
<!-- conf not in parent -->
<conf name="extra"/>
<!-- overrides conf in parent -->
<conf name="default" extends="compile" description="overrides the conf definition in parent descriptor"/>
<!-- configurations inherited from apache#resolve-simple;1.0 -->
<conf name="compile" visibility="public"/>
</configurations>
<publications/>
<dependencies>
<!-- not in parent -->
<dependency org="org2" name="mod2.1" rev="0.3" conf="default"/>
<!-- overrides parent -->
<dependency org="org1" name="mod1.1" rev="1.1" conf="default,compile->default" transitive="false"/>
<!-- dependencies inherited from apache#resolve-simple;1.0 -->
<dependency org="org1" name="mod1.2" rev="2.0" conf="default->default"/>
<dependency org="org1" name="mod1.1" rev="2.0" transitive="false" conf="compile->default"/>
</dependencies>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="2.0">
<info organisation="apache" module="resolve-extends" revision="1.2" status="release">
<!-- <extends organisation="apache" module="resolve-simple" revision="1.0" location="./ivy-multiconf.xml"/> -->
<!-- description inherited from parent -->
<description>Demonstrates configuration-specific dependencies</description>
</info>
<configurations>
<!-- conf not in parent -->
<conf name="extra"/>
<!-- overrides conf in parent -->
<conf name="default" extends="compile" description="overrides the conf definition in parent descriptor"/>
<!-- configurations inherited from apache#resolve-simple;1.0 -->
<conf name="compile" visibility="public"/>
</configurations>
<publications/>
<dependencies>
<!-- not in parent -->
<dependency org="org2" name="mod2.1" rev="0.3" conf="default"/>
<!-- overrides parent -->
<dependency org="org1" name="mod1.1" rev="1.1" conf="default,compile->default" transitive="false"/>
<!-- dependencies inherited from apache#resolve-simple;1.0 -->
<dependency org="org1" name="mod1.2" rev="2.0" conf="default->default"/>
<dependency org="org1" name="mod1.1" rev="2.0" transitive="false" conf="compile->default"/>
</dependencies>
</ivy-module>

View File

@ -1,42 +1,42 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="2.0">
<info organisation="apache" module="resolve-minimal" revision="1.2" status="release">
<!-- <extends organisation="apache" module="resolve-simple" revision="1.0" location="./ivy-multiconf.xml"/> -->
<!-- description inherited from parent -->
<description>Demonstrates configuration-specific dependencies</description>
</info>
<configurations>
<!-- configurations inherited from apache#resolve-simple;1.0 -->
<conf name="default" visibility="public"/>
<conf name="compile" visibility="public"/>
</configurations>
<publications/>
<dependencies>
<!-- dependencies inherited from apache#resolve-simple;1.0 -->
<dependency org="org1" name="mod1.2" rev="2.0" conf="default->default"/>
<dependency org="org1" name="mod1.1" rev="2.0" transitive="false" conf="compile->default"/>
</dependencies>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="2.0">
<info organisation="apache" module="resolve-minimal" revision="1.2" status="release">
<!-- <extends organisation="apache" module="resolve-simple" revision="1.0" location="./ivy-multiconf.xml"/> -->
<!-- description inherited from parent -->
<description>Demonstrates configuration-specific dependencies</description>
</info>
<configurations>
<!-- configurations inherited from apache#resolve-simple;1.0 -->
<conf name="default" visibility="public"/>
<conf name="compile" visibility="public"/>
</configurations>
<publications/>
<dependencies>
<!-- dependencies inherited from apache#resolve-simple;1.0 -->
<dependency org="org1" name="mod1.2" rev="2.0" conf="default->default"/>
<dependency org="org1" name="mod1.1" rev="2.0" transitive="false" conf="compile->default"/>
</dependencies>
</ivy-module>

View File

@ -1,27 +1,27 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="2.0">
<info module="resolve-minimal">
<extends organisation="apache" module="resolve-simple" revision="latest.integration" location="./ivy-multiconf.xml"/>
</info>
<publications/>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="2.0">
<info module="resolve-minimal">
<extends organisation="apache" module="resolve-simple" revision="latest.integration" location="./ivy-multiconf.xml"/>
</info>
<publications/>
</ivy-module>

View File

@ -1,41 +1,41 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="2.0">
<info module="resolve-extends">
<extends organisation="apache" module="resolve-simple" revision="latest.integration" location="./ivy-multiconf.xml"/>
</info>
<configurations>
<!-- conf not in parent -->
<conf name="extra" />
<!-- overrides conf in parent -->
<conf name="default" extends="compile" description="overrides the conf definition in parent descriptor"/>
</configurations>
<publications/>
<dependencies>
<!-- not in parent -->
<dependency org="org2" name="mod2.1" rev="0.3" conf="default" />
<!-- overrides parent -->
<dependency org="org1" name="mod1.1" rev="1.1" conf="default,compile->default" transitive="false" />
</dependencies>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="2.0">
<info module="resolve-extends">
<extends organisation="apache" module="resolve-simple" revision="latest.integration" location="./ivy-multiconf.xml"/>
</info>
<configurations>
<!-- conf not in parent -->
<conf name="extra" />
<!-- overrides conf in parent -->
<conf name="default" extends="compile" description="overrides the conf definition in parent descriptor"/>
</configurations>
<publications/>
<dependencies>
<!-- not in parent -->
<dependency org="org2" name="mod2.1" rev="0.3" conf="default" />
<!-- overrides parent -->
<dependency org="org1" name="mod1.1" rev="1.1" conf="default,compile->default" transitive="false" />
</dependencies>
</ivy-module>

View File

@ -1,21 +1,21 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivysettings>
<caches defaultCacheDir="${ivy.basedir}/mycache" />
</ivysettings>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivysettings>
<caches defaultCacheDir="${ivy.basedir}/mycache" />
</ivysettings>

View File

@ -1,22 +1,22 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivysettings>
<include url="file:${ivy.settings.dir}/ivysettings-props.xml"/>
<include url="file:${ivy.settings.dir}/ivysettings-test.xml"/>
</ivysettings>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivysettings>
<include url="file:${ivy.settings.dir}/ivysettings-props.xml"/>
<include url="file:${ivy.settings.dir}/ivysettings-test.xml"/>
</ivysettings>

View File

@ -1,21 +1,21 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivysettings>
<caches />
</ivysettings>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivysettings>
<caches />
</ivysettings>

View File

@ -1,100 +1,100 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.deliver;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import junit.framework.TestCase;
import org.apache.ivy.ant.IvyDeliver;
import org.apache.ivy.ant.IvyResolve;
import org.apache.ivy.util.FileUtil;
import org.apache.tools.ant.Project;
public class DeliverTest extends TestCase {
private File cache;
private File deliverDir;
private IvyDeliver ivyDeliver;
protected void setUp() throws Exception {
cache = new File("build/cache");
System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
createCache();
deliverDir = new File("build/test/deliver");
deliverDir.mkdirs();
Project project = new Project();
project.init();
ivyDeliver = new IvyDeliver();
ivyDeliver.setProject(project);
ivyDeliver.setDeliverpattern(deliverDir.getAbsolutePath() + "/[type]s/[artifact]-[revision](-[classifier]).[ext]");
}
protected void tearDown() throws Exception {
FileUtil.forceDelete(cache);
FileUtil.forceDelete(deliverDir);
}
private void createCache() {
cache.mkdirs();
}
public void testIVY1111() throws Exception {
Project project = ivyDeliver.getProject();
project.setProperty("ivy.settings.file", "test/repositories/IVY-1111/ivysettings.xml");
String ivyFileName = DeliverTest.class.getResource("ivy-1111.xml").getFile();
File ivyFile = new File(ivyFileName);
resolve(ivyFile);
ivyDeliver.setReplacedynamicrev(true);
ivyDeliver.doExecute();
String deliverContent = readFile(deliverDir.getAbsolutePath() + "/ivys/ivy-1.0.xml");
assertTrue(deliverContent.indexOf("rev=\"latest.integration\"") == -1);
assertTrue(deliverContent.indexOf("name=\"b\" rev=\"1.5\"") >= 0);
}
private void resolve(File ivyFile) {
IvyResolve ivyResolve = new IvyResolve();
ivyResolve.setProject(ivyDeliver.getProject());
ivyResolve.setFile(ivyFile);
ivyResolve.doExecute();
}
private String readFile(String fileName) throws IOException {
StringBuffer retval = new StringBuffer();
File ivyFile = new File(fileName);
BufferedReader reader = new BufferedReader(new FileReader(ivyFile));
String line = null;
while ((line = reader.readLine()) != null) {
retval.append(line + "\n");
}
reader.close();
return retval.toString();
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.deliver;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import junit.framework.TestCase;
import org.apache.ivy.ant.IvyDeliver;
import org.apache.ivy.ant.IvyResolve;
import org.apache.ivy.util.FileUtil;
import org.apache.tools.ant.Project;
public class DeliverTest extends TestCase {
private File cache;
private File deliverDir;
private IvyDeliver ivyDeliver;
protected void setUp() throws Exception {
cache = new File("build/cache");
System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
createCache();
deliverDir = new File("build/test/deliver");
deliverDir.mkdirs();
Project project = new Project();
project.init();
ivyDeliver = new IvyDeliver();
ivyDeliver.setProject(project);
ivyDeliver.setDeliverpattern(deliverDir.getAbsolutePath() + "/[type]s/[artifact]-[revision](-[classifier]).[ext]");
}
protected void tearDown() throws Exception {
FileUtil.forceDelete(cache);
FileUtil.forceDelete(deliverDir);
}
private void createCache() {
cache.mkdirs();
}
public void testIVY1111() throws Exception {
Project project = ivyDeliver.getProject();
project.setProperty("ivy.settings.file", "test/repositories/IVY-1111/ivysettings.xml");
String ivyFileName = DeliverTest.class.getResource("ivy-1111.xml").getFile();
File ivyFile = new File(ivyFileName);
resolve(ivyFile);
ivyDeliver.setReplacedynamicrev(true);
ivyDeliver.doExecute();
String deliverContent = readFile(deliverDir.getAbsolutePath() + "/ivys/ivy-1.0.xml");
assertTrue(deliverContent.indexOf("rev=\"latest.integration\"") == -1);
assertTrue(deliverContent.indexOf("name=\"b\" rev=\"1.5\"") >= 0);
}
private void resolve(File ivyFile) {
IvyResolve ivyResolve = new IvyResolve();
ivyResolve.setProject(ivyDeliver.getProject());
ivyResolve.setFile(ivyFile);
ivyResolve.doExecute();
}
private String readFile(String fileName) throws IOException {
StringBuffer retval = new StringBuffer();
File ivyFile = new File(fileName);
BufferedReader reader = new BufferedReader(new FileReader(ivyFile));
String line = null;
while ((line = reader.readLine()) != null) {
retval.append(line + "\n");
}
reader.close();
return retval.toString();
}
}

View File

@ -1,26 +1,26 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0" xmlns:e="http://ant.apache.org/ivy/extra">
<info organisation="apache" module="IVY-1111" revision="1.0" e:att="att"/>
<dependencies>
<dependency org="test" name="a" rev="latest.integration"/>
<dependency org="test" name="b" rev="latest.integration" e:att="att"/>
<dependency org="junit" name="junit" rev="latest.integration"/>
</dependencies>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0" xmlns:e="http://ant.apache.org/ivy/extra">
<info organisation="apache" module="IVY-1111" revision="1.0" e:att="att"/>
<dependencies>
<dependency org="test" name="a" rev="latest.integration"/>
<dependency org="test" name="b" rev="latest.integration" e:att="att"/>
<dependency org="junit" name="junit" rev="latest.integration"/>
</dependencies>
</ivy-module>

View File

@ -1,143 +1,143 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.publish;
import java.io.File;
import java.io.IOException;
import java.text.ParseException;
import java.util.Arrays;
import junit.framework.TestCase;
import org.apache.ivy.core.event.EventManager;
import org.apache.ivy.core.module.descriptor.Artifact;
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.resolve.ResolveData;
import org.apache.ivy.core.resolve.ResolveEngine;
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.core.sort.SortEngine;
import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorWriter;
import org.apache.ivy.plugins.resolver.FileSystemResolver;
import org.apache.ivy.util.FileUtil;
public class PublishEngineTest extends TestCase {
protected void setUp() throws Exception {
System.setProperty("ivy.cache.dir", new File("build/test/publish/cache").getAbsolutePath());
FileUtil.forceDelete(new File("build/test/publish"));
}
protected void tearDown() throws Exception {
FileUtil.forceDelete(new File("build/test/publish"));
}
public void testAtomicity() throws Exception {
IvySettings settings = new IvySettings();
final PublishEngine engine = new PublishEngine(settings, new EventManager());
final int[] counter = new int[] {0};
final DefaultModuleDescriptor md = DefaultModuleDescriptor
.newDefaultInstance(ModuleRevisionId.parse("#A;1.0"));
final FileSystemResolver resolver = new FileSystemResolver() {
public void publish(Artifact artifact, File src, boolean overwrite) throws IOException {
super.publish(artifact, src, overwrite);
synchronized (PublishEngineTest.this) {
counter[0] ++;
}
sleepSilently(50);
synchronized (PublishEngineTest.this) {
counter[0] ++;
}
}
};
resolver.setName("test");
resolver.setSettings(settings);
String publishRepoDir = new File("build/test/publish/repo").getAbsolutePath();
resolver.addIvyPattern(publishRepoDir + "/[module]/[revision]/[artifact].[ext]");
resolver.addArtifactPattern(publishRepoDir + "/[module]/[revision]/[artifact].[ext]");
FileUtil.copy(
new File("test/repositories/1/org1/mod1.1/jars/mod1.1-1.0.jar"),
new File("build/test/publish/module/A.jar"), null);
XmlModuleDescriptorWriter.write(md, new File("build/test/publish/module/ivy.xml"));
resolveAndAssertNotFound(settings, resolver, "#A;latest.integration", "before publishing");
// run publish asynchronously
new Thread() {
public void run() {
try {
engine.publish(
md,
Arrays.asList(new String[] {"build/test/publish/module/[artifact].[ext]"}),
resolver,
new PublishOptions().setSrcIvyPattern("build/test/publish/module/[artifact].[ext]"));
synchronized (PublishEngineTest.this) {
counter[0] ++;
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}.start();
while(true) {
sleepSilently(5);
synchronized (this) {
if (counter[0] == 5) {
break;
} else if (counter[0] < 4) {
resolveAndAssertNotFound(settings, resolver,
"#A;latest.integration", "after "+(counter[0] / 2)+" artifacts published");
}
}
}
resolveAndAssertFound(settings, resolver, "#A;1.0");
}
private void resolveAndAssertNotFound(
IvySettings settings, FileSystemResolver resolver, String module, String context)
throws ParseException {
ResolvedModuleRevision rmr = resolveModule(settings, resolver, module);
assertNull("module found " + context + ". module="+rmr, rmr);
}
private void resolveAndAssertFound(
IvySettings settings, FileSystemResolver resolver, String module)
throws ParseException {
ResolvedModuleRevision rmr = resolveModule(settings, resolver, module);
assertNotNull(rmr);
assertEquals(module, rmr.getId().toString());
}
private ResolvedModuleRevision resolveModule(
IvySettings settings, FileSystemResolver resolver, String module)
throws ParseException {
return resolver.getDependency(
new DefaultDependencyDescriptor(ModuleRevisionId.parse(module), false),
new ResolveData(
new ResolveEngine(settings, new EventManager(), new SortEngine(settings)),
new ResolveOptions()));
}
private void sleepSilently(int timeout) {
try {
Thread.sleep(timeout);
} catch (InterruptedException e) {
}
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.publish;
import java.io.File;
import java.io.IOException;
import java.text.ParseException;
import java.util.Arrays;
import junit.framework.TestCase;
import org.apache.ivy.core.event.EventManager;
import org.apache.ivy.core.module.descriptor.Artifact;
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.resolve.ResolveData;
import org.apache.ivy.core.resolve.ResolveEngine;
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.core.sort.SortEngine;
import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorWriter;
import org.apache.ivy.plugins.resolver.FileSystemResolver;
import org.apache.ivy.util.FileUtil;
public class PublishEngineTest extends TestCase {
protected void setUp() throws Exception {
System.setProperty("ivy.cache.dir", new File("build/test/publish/cache").getAbsolutePath());
FileUtil.forceDelete(new File("build/test/publish"));
}
protected void tearDown() throws Exception {
FileUtil.forceDelete(new File("build/test/publish"));
}
public void testAtomicity() throws Exception {
IvySettings settings = new IvySettings();
final PublishEngine engine = new PublishEngine(settings, new EventManager());
final int[] counter = new int[] {0};
final DefaultModuleDescriptor md = DefaultModuleDescriptor
.newDefaultInstance(ModuleRevisionId.parse("#A;1.0"));
final FileSystemResolver resolver = new FileSystemResolver() {
public void publish(Artifact artifact, File src, boolean overwrite) throws IOException {
super.publish(artifact, src, overwrite);
synchronized (PublishEngineTest.this) {
counter[0] ++;
}
sleepSilently(50);
synchronized (PublishEngineTest.this) {
counter[0] ++;
}
}
};
resolver.setName("test");
resolver.setSettings(settings);
String publishRepoDir = new File("build/test/publish/repo").getAbsolutePath();
resolver.addIvyPattern(publishRepoDir + "/[module]/[revision]/[artifact].[ext]");
resolver.addArtifactPattern(publishRepoDir + "/[module]/[revision]/[artifact].[ext]");
FileUtil.copy(
new File("test/repositories/1/org1/mod1.1/jars/mod1.1-1.0.jar"),
new File("build/test/publish/module/A.jar"), null);
XmlModuleDescriptorWriter.write(md, new File("build/test/publish/module/ivy.xml"));
resolveAndAssertNotFound(settings, resolver, "#A;latest.integration", "before publishing");
// run publish asynchronously
new Thread() {
public void run() {
try {
engine.publish(
md,
Arrays.asList(new String[] {"build/test/publish/module/[artifact].[ext]"}),
resolver,
new PublishOptions().setSrcIvyPattern("build/test/publish/module/[artifact].[ext]"));
synchronized (PublishEngineTest.this) {
counter[0] ++;
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}.start();
while(true) {
sleepSilently(5);
synchronized (this) {
if (counter[0] == 5) {
break;
} else if (counter[0] < 4) {
resolveAndAssertNotFound(settings, resolver,
"#A;latest.integration", "after "+(counter[0] / 2)+" artifacts published");
}
}
}
resolveAndAssertFound(settings, resolver, "#A;1.0");
}
private void resolveAndAssertNotFound(
IvySettings settings, FileSystemResolver resolver, String module, String context)
throws ParseException {
ResolvedModuleRevision rmr = resolveModule(settings, resolver, module);
assertNull("module found " + context + ". module="+rmr, rmr);
}
private void resolveAndAssertFound(
IvySettings settings, FileSystemResolver resolver, String module)
throws ParseException {
ResolvedModuleRevision rmr = resolveModule(settings, resolver, module);
assertNotNull(rmr);
assertEquals(module, rmr.getId().toString());
}
private ResolvedModuleRevision resolveModule(
IvySettings settings, FileSystemResolver resolver, String module)
throws ParseException {
return resolver.getDependency(
new DefaultDependencyDescriptor(ModuleRevisionId.parse(module), false),
new ResolveData(
new ResolveEngine(settings, new EventManager(), new SortEngine(settings)),
new ResolveOptions()));
}
private void sleepSilently(int timeout) {
try {
Thread.sleep(timeout);
} catch (InterruptedException e) {
}
}
}

View File

@ -1,68 +1,68 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.repository;
import junit.framework.TestCase;
import org.apache.ivy.TestFixture;
import org.apache.ivy.TestHelper;
import org.apache.ivy.core.event.EventManager;
import org.apache.ivy.core.resolve.ResolveEngine;
import org.apache.ivy.core.search.SearchEngine;
import org.apache.ivy.core.settings.IvySettings;
import org.apache.ivy.core.sort.SortEngine;
public class RepositoryManagementEngineTest extends TestCase {
private RepositoryManagementEngine repository;
private TestFixture fixture;
protected void setUp() throws Exception {
fixture = new TestFixture();
IvySettings settings = fixture.getSettings();
repository = new RepositoryManagementEngine(settings, new SearchEngine(settings),
new ResolveEngine(settings, new EventManager(), new SortEngine(settings)));
}
protected void tearDown() throws Exception {
fixture.clean();
}
public void testLoad() throws Exception {
fixture
.addMD("o1#A;1").addMD("o1#A;2").addMD("o1#A;3")
.addMD("o1#B;1").addMD("o1#B;2->o1#A;2")
.addMD("o2#C;1->{o1#B;1 o1#A;1}")
.init();
repository.load();
assertEquals(3, repository.getModuleIdsNumber());
assertEquals(6, repository.getRevisionsNumber());
}
public void testOrphans() throws Exception {
fixture
.addMD("o1#A;1").addMD("o1#A;2").addMD("o1#A;3")
.addMD("o1#B;1").addMD("o1#B;2->o1#A;2")
.addMD("o2#C;1->{o1#B;1 o1#A;1}")
.init();
repository.load();
repository.analyze();
TestHelper.assertModuleRevisionIds("o1#A;3 o1#B;2 o2#C;1", repository.getOrphans());
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.repository;
import junit.framework.TestCase;
import org.apache.ivy.TestFixture;
import org.apache.ivy.TestHelper;
import org.apache.ivy.core.event.EventManager;
import org.apache.ivy.core.resolve.ResolveEngine;
import org.apache.ivy.core.search.SearchEngine;
import org.apache.ivy.core.settings.IvySettings;
import org.apache.ivy.core.sort.SortEngine;
public class RepositoryManagementEngineTest extends TestCase {
private RepositoryManagementEngine repository;
private TestFixture fixture;
protected void setUp() throws Exception {
fixture = new TestFixture();
IvySettings settings = fixture.getSettings();
repository = new RepositoryManagementEngine(settings, new SearchEngine(settings),
new ResolveEngine(settings, new EventManager(), new SortEngine(settings)));
}
protected void tearDown() throws Exception {
fixture.clean();
}
public void testLoad() throws Exception {
fixture
.addMD("o1#A;1").addMD("o1#A;2").addMD("o1#A;3")
.addMD("o1#B;1").addMD("o1#B;2->o1#A;2")
.addMD("o2#C;1->{o1#B;1 o1#A;1}")
.init();
repository.load();
assertEquals(3, repository.getModuleIdsNumber());
assertEquals(6, repository.getRevisionsNumber());
}
public void testOrphans() throws Exception {
fixture
.addMD("o1#A;1").addMD("o1#A;2").addMD("o1#A;3")
.addMD("o1#B;1").addMD("o1#B;2->o1#A;2")
.addMD("o2#C;1->{o1#B;1 o1#A;1}")
.init();
repository.load();
repository.analyze();
TestHelper.assertModuleRevisionIds("o1#A;3 o1#B;2 o2#C;1", repository.getOrphans());
}
}

View File

@ -1,100 +1,100 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.resolve;
import java.io.File;
import java.util.Date;
import junit.framework.TestCase;
import org.apache.ivy.Ivy;
import org.apache.ivy.core.cache.ArtifactOrigin;
import org.apache.ivy.core.module.descriptor.Artifact;
import org.apache.ivy.core.module.descriptor.DefaultArtifact;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.report.ArtifactDownloadReport;
import org.apache.ivy.core.report.DownloadStatus;
import org.apache.ivy.core.report.ResolveReport;
import org.apache.ivy.util.CacheCleaner;
public class ResolveEngineTest extends TestCase {
private Ivy ivy;
private File cache;
protected void setUp() throws Exception {
cache = new File("build/cache");
System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
createCache();
ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/ivysettings.xml"));
}
protected void tearDown() throws Exception {
CacheCleaner.deleteDir(cache);
}
public void testInlineResolveWithNonExistingModule() throws Exception {
ResolveEngine engine = new ResolveEngine(ivy.getSettings(),
ivy.getEventManager(), ivy.getSortEngine());
ResolveOptions options = new ResolveOptions();
options.setConfs(new String[] {"*"});
ModuleRevisionId mRevId = ModuleRevisionId.newInstance("org1XX", "mod1.0XX", "1.0XX");
ResolveReport report = engine.resolve(mRevId, options, true);
assertNotNull("The ResolveReport may never be null", report);
assertTrue(report.hasError());
}
public void testLocateThenDownload() throws Exception {
ResolveEngine engine = new ResolveEngine(ivy.getSettings(),
ivy.getEventManager(), ivy.getSortEngine());
testLocateThenDownload(
engine,
DefaultArtifact.newIvyArtifact(ModuleRevisionId.parse("org1#mod1.1;1.0"), new Date()),
new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"));
testLocateThenDownload(
engine,
new DefaultArtifact(ModuleRevisionId.parse("org1#mod1.1;1.0"), new Date(), "mod1.1", "jar", "jar"),
new File("test/repositories/1/org1/mod1.1/jars/mod1.1-1.0.jar"));
}
private void testLocateThenDownload(ResolveEngine engine, Artifact artifact, File artifactFile) {
ArtifactOrigin origin = engine.locate(artifact);
assertNotNull(origin);
assertTrue(origin.isLocal());
assertEquals(
artifactFile.getAbsolutePath(),
new File(origin.getLocation()).getAbsolutePath());
ArtifactDownloadReport r = engine.download(origin, new DownloadOptions());
assertNotNull(r);
assertEquals(DownloadStatus.SUCCESSFUL, r.getDownloadStatus());
assertNotNull(r.getLocalFile());
assertTrue(r.getLocalFile().exists());
}
private void createCache() {
cache.mkdirs();
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.resolve;
import java.io.File;
import java.util.Date;
import junit.framework.TestCase;
import org.apache.ivy.Ivy;
import org.apache.ivy.core.cache.ArtifactOrigin;
import org.apache.ivy.core.module.descriptor.Artifact;
import org.apache.ivy.core.module.descriptor.DefaultArtifact;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.report.ArtifactDownloadReport;
import org.apache.ivy.core.report.DownloadStatus;
import org.apache.ivy.core.report.ResolveReport;
import org.apache.ivy.util.CacheCleaner;
public class ResolveEngineTest extends TestCase {
private Ivy ivy;
private File cache;
protected void setUp() throws Exception {
cache = new File("build/cache");
System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
createCache();
ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/ivysettings.xml"));
}
protected void tearDown() throws Exception {
CacheCleaner.deleteDir(cache);
}
public void testInlineResolveWithNonExistingModule() throws Exception {
ResolveEngine engine = new ResolveEngine(ivy.getSettings(),
ivy.getEventManager(), ivy.getSortEngine());
ResolveOptions options = new ResolveOptions();
options.setConfs(new String[] {"*"});
ModuleRevisionId mRevId = ModuleRevisionId.newInstance("org1XX", "mod1.0XX", "1.0XX");
ResolveReport report = engine.resolve(mRevId, options, true);
assertNotNull("The ResolveReport may never be null", report);
assertTrue(report.hasError());
}
public void testLocateThenDownload() throws Exception {
ResolveEngine engine = new ResolveEngine(ivy.getSettings(),
ivy.getEventManager(), ivy.getSortEngine());
testLocateThenDownload(
engine,
DefaultArtifact.newIvyArtifact(ModuleRevisionId.parse("org1#mod1.1;1.0"), new Date()),
new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"));
testLocateThenDownload(
engine,
new DefaultArtifact(ModuleRevisionId.parse("org1#mod1.1;1.0"), new Date(), "mod1.1", "jar", "jar"),
new File("test/repositories/1/org1/mod1.1/jars/mod1.1-1.0.jar"));
}
private void testLocateThenDownload(ResolveEngine engine, Artifact artifact, File artifactFile) {
ArtifactOrigin origin = engine.locate(artifact);
assertNotNull(origin);
assertTrue(origin.isLocal());
assertEquals(
artifactFile.getAbsolutePath(),
new File(origin.getLocation()).getAbsolutePath());
ArtifactDownloadReport r = engine.download(origin, new DownloadOptions());
assertNotNull(r);
assertEquals(DownloadStatus.SUCCESSFUL, r.getDownloadStatus());
assertNotNull(r.getLocalFile());
assertTrue(r.getLocalFile().exists());
}
private void createCache() {
cache.mkdirs();
}
}

View File

@ -1,28 +1,28 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="org.apache" module="ivy-test" />
<configurations>
<conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf"/>
</configurations>
<dependencies>
<dependency org="myorg" name="modC" rev="1.0" />
<dependency org="myorg" name="modA" rev="1.0" />
</dependencies>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="org.apache" module="ivy-test" />
<configurations>
<conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf"/>
</configurations>
<dependencies>
<dependency org="myorg" name="modC" rev="1.0" />
<dependency org="myorg" name="modA" rev="1.0" />
</dependencies>
</ivy-module>

View File

@ -1,29 +1,29 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="apache" module="IVY-590" revision="1.0"/>
<configurations>
<conf name="default" transitive="true"/>
<conf name="compile" extends="default" />
</configurations>
<dependencies>
<dependency org="org1" name="mod1.1" rev="1.0" conf="default->default"/>
<dependency org="org16" name="mod16.1" rev="1.0" conf="compile->default"/>
</dependencies>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="apache" module="IVY-590" revision="1.0"/>
<configurations>
<conf name="default" transitive="true"/>
<conf name="compile" extends="default" />
</configurations>
<dependencies>
<dependency org="org1" name="mod1.1" rev="1.0" conf="default->default"/>
<dependency org="org16" name="mod16.1" rev="1.0" conf="compile->default"/>
</dependencies>
</ivy-module>

View File

@ -1,36 +1,36 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="apache" module="IVY-874" revision="1.0"/>
<configurations>
<conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime,master"/>
<conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"/>
<conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths."/>
<conf name="provided" visibility="public" description="this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive."/>
<conf name="runtime" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath." extends="compile"/>
<conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases."/>
<conf name="system" visibility="public" description="this scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository."/>
<conf name="optional" visibility="public" description="contains all optional dependencies" />
</configurations>
<dependencies>
<dependency org="org.apache" name="test" rev="1.2" conf="default" />
<dependency org="org.apache" name="test3" rev="1.1" conf="runtime->runtime,master" />
</dependencies>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="apache" module="IVY-874" revision="1.0"/>
<configurations>
<conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime,master"/>
<conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"/>
<conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths."/>
<conf name="provided" visibility="public" description="this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive."/>
<conf name="runtime" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath." extends="compile"/>
<conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases."/>
<conf name="system" visibility="public" description="this scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository."/>
<conf name="optional" visibility="public" description="contains all optional dependencies" />
</configurations>
<dependencies>
<dependency org="org.apache" name="test" rev="1.2" conf="default" />
<dependency org="org.apache" name="test3" rev="1.1" conf="runtime->runtime,master" />
</dependencies>
</ivy-module>

View File

@ -1,25 +1,25 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="apache" module="ivy-956" />
<dependencies>
<dependency org="org1" name="mod1.4" rev="1.0.2" />
<dependency org="org1" name="mod1.2" rev="[0.9,1.0[" extra="yes"/>
</dependencies>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="apache" module="ivy-956" />
<dependencies>
<dependency org="org1" name="mod1.4" rev="1.0.2" />
<dependency org="org1" name="mod1.2" rev="[0.9,1.0[" extra="yes"/>
</dependencies>
</ivy-module>

View File

@ -1,26 +1,26 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="apache" module="IVY-999" revision="1.0"/>
<dependencies>
<dependency org="test" name="a" rev="latest.integration"/>
<dependency org="test" name="b" rev="latest.integration"/>
<dependency org="junit" name="junit" rev="latest.integration"/>
</dependencies>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="apache" module="IVY-999" revision="1.0"/>
<dependencies>
<dependency org="test" name="a" rev="latest.integration"/>
<dependency org="test" name="b" rev="latest.integration"/>
<dependency org="junit" name="junit" rev="latest.integration"/>
</dependencies>
</ivy-module>

View File

@ -1,40 +1,40 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="2.0">
<info organisation="CAE" module="TESTA" publication="20041101110000" status="Integration">
<license name="CAE Proprietary"/>
<ivyauthor name="TESTA - TESTA" url="http://www.cae.com"/>
<repository name="packagerep-ivy" url="http://coretech.caecorp.cae.com/packagerep" pattern="[organisation]/[module]/[revision]/ivy-[revision].xml" ivys="true" artifacts="false"/>
<repository name="packagerep-artifacts" url="http://coretech.caecorp.cae.com/packagerep" pattern="[organisation]/[module]/[revision]/[artifact]-[revision].[type]" ivys="false" artifacts="true" homepage="http://www.cae.com"/>
<description>TESTA -- Hello World Library - &lt;a href='http://coretech.caecorp.cae.com/clearspace/tags/testa_releasenotes'&gt;Release Notes&lt;/a&gt;</description>
</info>
<publications/>
<configurations>
<conf name="BuildTimeDependencies"/>
<conf name="RunTimeDependencies"/>
<conf name="TestingDependencies"/>
</configurations>
<dependencies>
<dependency org="CAE-VSK" name="VSK-FC" rev="0.53.0.1" transitive="false" force="true" conf="BuildTimeDependencies-&gt;*" policydependency="true">
</dependency>
<dependency org="CAE-VSK" name="VSK-FC" rev="[0.50.0.0,0.55.0.0]" transitive="false" force="true" conf="BuildTimeDependencies-&gt;*">
</dependency>
</dependencies>
</ivy-module>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="2.0">
<info organisation="CAE" module="TESTA" publication="20041101110000" status="Integration">
<license name="CAE Proprietary"/>
<ivyauthor name="TESTA - TESTA" url="http://www.cae.com"/>
<repository name="packagerep-ivy" url="http://coretech.caecorp.cae.com/packagerep" pattern="[organisation]/[module]/[revision]/ivy-[revision].xml" ivys="true" artifacts="false"/>
<repository name="packagerep-artifacts" url="http://coretech.caecorp.cae.com/packagerep" pattern="[organisation]/[module]/[revision]/[artifact]-[revision].[type]" ivys="false" artifacts="true" homepage="http://www.cae.com"/>
<description>TESTA -- Hello World Library - &lt;a href='http://coretech.caecorp.cae.com/clearspace/tags/testa_releasenotes'&gt;Release Notes&lt;/a&gt;</description>
</info>
<publications/>
<configurations>
<conf name="BuildTimeDependencies"/>
<conf name="RunTimeDependencies"/>
<conf name="TestingDependencies"/>
</configurations>
<dependencies>
<dependency org="CAE-VSK" name="VSK-FC" rev="0.53.0.1" transitive="false" force="true" conf="BuildTimeDependencies-&gt;*" policydependency="true">
</dependency>
<dependency org="CAE-VSK" name="VSK-FC" rev="[0.50.0.0,0.55.0.0]" transitive="false" force="true" conf="BuildTimeDependencies-&gt;*">
</dependency>
</dependencies>
</ivy-module>

View File

@ -1,40 +1,40 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="2.0">
<info organisation="CAE" module="TESTA" publication="20041101110000" status="Integration">
<license name="CAE Proprietary"/>
<ivyauthor name="TESTA - TESTA" url="http://www.cae.com"/>
<repository name="packagerep-ivy" url="http://coretech.caecorp.cae.com/packagerep" pattern="[organisation]/[module]/[revision]/ivy-[revision].xml" ivys="true" artifacts="false"/>
<repository name="packagerep-artifacts" url="http://coretech.caecorp.cae.com/packagerep" pattern="[organisation]/[module]/[revision]/[artifact]-[revision].[type]" ivys="false" artifacts="true" homepage="http://www.cae.com"/>
<description>TESTA -- Hello World Library - &lt;a href='http://coretech.caecorp.cae.com/clearspace/tags/testa_releasenotes'&gt;Release Notes&lt;/a&gt;</description>
</info>
<publications/>
<configurations>
<conf name="BuildTimeDependencies"/>
<conf name="RunTimeDependencies"/>
<conf name="TestingDependencies"/>
</configurations>
<dependencies>
<dependency org="CAE-VSK" name="VSK-FC" rev="[0.50.0.0,0.55.0.0]" transitive="false" force="true" conf="BuildTimeDependencies-&gt;*">
</dependency>
<dependency org="CAE-VSK" name="VSK-FC" rev="0.53.0.1" transitive="false" force="true" conf="BuildTimeDependencies-&gt;*" policydependency="true">
</dependency>
</dependencies>
</ivy-module>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="2.0">
<info organisation="CAE" module="TESTA" publication="20041101110000" status="Integration">
<license name="CAE Proprietary"/>
<ivyauthor name="TESTA - TESTA" url="http://www.cae.com"/>
<repository name="packagerep-ivy" url="http://coretech.caecorp.cae.com/packagerep" pattern="[organisation]/[module]/[revision]/ivy-[revision].xml" ivys="true" artifacts="false"/>
<repository name="packagerep-artifacts" url="http://coretech.caecorp.cae.com/packagerep" pattern="[organisation]/[module]/[revision]/[artifact]-[revision].[type]" ivys="false" artifacts="true" homepage="http://www.cae.com"/>
<description>TESTA -- Hello World Library - &lt;a href='http://coretech.caecorp.cae.com/clearspace/tags/testa_releasenotes'&gt;Release Notes&lt;/a&gt;</description>
</info>
<publications/>
<configurations>
<conf name="BuildTimeDependencies"/>
<conf name="RunTimeDependencies"/>
<conf name="TestingDependencies"/>
</configurations>
<dependencies>
<dependency org="CAE-VSK" name="VSK-FC" rev="[0.50.0.0,0.55.0.0]" transitive="false" force="true" conf="BuildTimeDependencies-&gt;*">
</dependency>
<dependency org="CAE-VSK" name="VSK-FC" rev="0.53.0.1" transitive="false" force="true" conf="BuildTimeDependencies-&gt;*" policydependency="true">
</dependency>
</dependencies>
</ivy-module>

View File

@ -1,40 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="2.0">
<info organisation="CAE-Visualization-Products" module="IG-6_2" revision="6.2.1.4" status="Development" publication="20090429165200">
<license name="CAE Proprietary"/>
<ivyauthor name="CAE Image Generator - CAE Visualization Products" url="http://www.cae.com"/>
<repository name="packagerep-ivy" url="http://coretech.caecorp.cae.com/packagerep" pattern="[organisation]/[module]/[revision]/ivy-[revision].xml" ivys="true" artifacts="false"/>
<repository name="packagerep-artifacts" url="http://coretech.caecorp.cae.com/packagerep" pattern="[organisation]/[module]/[revision]/[artifact]-[revision].[type]" ivys="false" artifacts="true"/>
<description homepage="http://www.cae.com"/>
</info>
<publications/>
<configurations>
<conf name="BuildTimeDependencies"/>
<conf name="RunTimeDependencies"/>
<conf name="TestingDependencies"/>
</configurations>
<dependencies>
<dependency org="CAE-Visualization-Components" name="RTS" rev="6.2.1.20" conf="BuildTimeDependencies->*" force="true" branch="MAIN">
</dependency>
<dependency org="CAE-Visualization-Components" name="SGL" rev="[6.2.0,6.2.999]" conf="BuildTimeDependencies->*" force="true" branch="MAIN">
</dependency>
</dependencies>
</ivy-module>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="2.0">
<info organisation="CAE-Visualization-Products" module="IG-6_2" revision="6.2.1.4" status="Development" publication="20090429165200">
<license name="CAE Proprietary"/>
<ivyauthor name="CAE Image Generator - CAE Visualization Products" url="http://www.cae.com"/>
<repository name="packagerep-ivy" url="http://coretech.caecorp.cae.com/packagerep" pattern="[organisation]/[module]/[revision]/ivy-[revision].xml" ivys="true" artifacts="false"/>
<repository name="packagerep-artifacts" url="http://coretech.caecorp.cae.com/packagerep" pattern="[organisation]/[module]/[revision]/[artifact]-[revision].[type]" ivys="false" artifacts="true"/>
<description homepage="http://www.cae.com"/>
</info>
<publications/>
<configurations>
<conf name="BuildTimeDependencies"/>
<conf name="RunTimeDependencies"/>
<conf name="TestingDependencies"/>
</configurations>
<dependencies>
<dependency org="CAE-Visualization-Components" name="RTS" rev="6.2.1.20" conf="BuildTimeDependencies->*" force="true" branch="MAIN">
</dependency>
<dependency org="CAE-Visualization-Components" name="SGL" rev="[6.2.0,6.2.999]" conf="BuildTimeDependencies->*" force="true" branch="MAIN">
</dependency>
</dependencies>
</ivy-module>

View File

@ -1,24 +1,24 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
<info organisation="apache" module="test-m2-with-src" revision="1.0" />
<dependencies>
<dependency org="org.apache" name="test-src" rev="1.0" />
</dependencies>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
<info organisation="apache" module="test-m2-with-src" revision="1.0" />
<dependencies>
<dependency org="org.apache" name="test-src" rev="1.0" />
</dependencies>
</ivy-module>

View File

@ -1,26 +1,26 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="org1"
module="mod1.2"
revision="1.5"
status="integration"
publication="20041101110000"
/>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="org1"
module="mod1.2"
revision="1.5"
status="integration"
publication="20041101110000"
/>
</ivy-module>

View File

@ -1,48 +1,48 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.settings;
import java.io.IOException;
import java.text.ParseException;
import junit.framework.TestCase;
import org.apache.ivy.Ivy;
import org.apache.ivy.plugins.resolver.DependencyResolver;
public class IvySettingsTest extends TestCase {
public void testChangeDefaultResolver() throws ParseException, IOException {
Ivy ivy = new Ivy();
ivy.configureDefault();
IvySettings settings = ivy.getSettings();
DependencyResolver defaultResolver = settings.getDefaultResolver();
assertNotNull(defaultResolver);
assertEquals("default", defaultResolver.getName());
assertSame("default resolver cached", defaultResolver, settings.getDefaultResolver());
settings.setDefaultResolver("public");
DependencyResolver newDefault = settings.getDefaultResolver();
assertNotNull(newDefault);
assertNotSame("default resolver has changed", defaultResolver, newDefault);
assertEquals("resolver changed successfully", "public", newDefault.getName());
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.core.settings;
import java.io.IOException;
import java.text.ParseException;
import junit.framework.TestCase;
import org.apache.ivy.Ivy;
import org.apache.ivy.plugins.resolver.DependencyResolver;
public class IvySettingsTest extends TestCase {
public void testChangeDefaultResolver() throws ParseException, IOException {
Ivy ivy = new Ivy();
ivy.configureDefault();
IvySettings settings = ivy.getSettings();
DependencyResolver defaultResolver = settings.getDefaultResolver();
assertNotNull(defaultResolver);
assertEquals("default", defaultResolver.getName());
assertSame("default resolver cached", defaultResolver, settings.getDefaultResolver());
settings.setDefaultResolver("public");
DependencyResolver newDefault = settings.getDefaultResolver();
assertNotNull(newDefault);
assertNotSame("default resolver has changed", defaultResolver, newDefault);
assertEquals("resolver changed successfully", "public", newDefault.getName());
}
}

View File

@ -1,24 +1,24 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivysettings>
<modules>
<module organisation="apache" name="ivy" myattr="test.*" matcher="regexp" resolveMode="dynamic" />
<module organisation="apache" name=".*" />
</modules>
</ivysettings>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivysettings>
<modules>
<module organisation="apache" name="ivy" myattr="test.*" matcher="regexp" resolveMode="dynamic" />
<module organisation="apache" name=".*" />
</modules>
</ivysettings>

View File

@ -1,25 +1,25 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivysettings>
<include file="ivysettings-macro#2.xml"/>
<resolvers>
<mymacro name="includeworks" mymainrep="${ivy.basedir}/included/myrep"
mysecondrep="${ivy.basedir}/included/secondrep"/>
</resolvers>
</ivysettings>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivysettings>
<include file="ivysettings-macro#2.xml"/>
<resolvers>
<mymacro name="includeworks" mymainrep="${ivy.basedir}/included/myrep"
mysecondrep="${ivy.basedir}/included/secondrep"/>
</resolvers>
</ivysettings>

View File

@ -1,45 +1,45 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivysettings>
<property name="ivy.test.prop" value="myvalue" />
<macrodef name="mymacro">
<attribute name="mymainrep"/>
<attribute name="mysecondrep"/>
<attribute name="myseconddirlayout" default="[organisation]/[module]/[type]s"/>
<chain>
<filesystem name="fs1">
<ivy pattern="@{mymainrep}/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
<artifact pattern="@{mymainrep}/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
</filesystem>
<filesystem name="fs2" latest="latest-time">
<ivy pattern="@{mysecondrep}/@{myseconddirlayout}/ivy-[revision].xml"/>
<artifact pattern="@{mysecondrep}/@{myseconddirlayout}/[artifact]-[revision].[ext]"/>
</filesystem>
</chain>
</macrodef>
<resolvers>
<mymacro name="default" mymainrep="${ivy.basedir}/path/to/myrep"
mysecondrep="${ivy.basedir}/path/to/secondrep"/>
<mymacro name="other"
mymainrep="${ivy.basedir}/path/to/myrep"
mysecondrep="${ivy.basedir}/path/to/secondrep"
myseconddirlayout="[module]/[type]s"/>
</resolvers>
</ivysettings>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivysettings>
<property name="ivy.test.prop" value="myvalue" />
<macrodef name="mymacro">
<attribute name="mymainrep"/>
<attribute name="mysecondrep"/>
<attribute name="myseconddirlayout" default="[organisation]/[module]/[type]s"/>
<chain>
<filesystem name="fs1">
<ivy pattern="@{mymainrep}/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
<artifact pattern="@{mymainrep}/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]"/>
</filesystem>
<filesystem name="fs2" latest="latest-time">
<ivy pattern="@{mysecondrep}/@{myseconddirlayout}/ivy-[revision].xml"/>
<artifact pattern="@{mysecondrep}/@{myseconddirlayout}/[artifact]-[revision].[ext]"/>
</filesystem>
</chain>
</macrodef>
<resolvers>
<mymacro name="default" mymainrep="${ivy.basedir}/path/to/myrep"
mysecondrep="${ivy.basedir}/path/to/secondrep"/>
<mymacro name="other"
mymainrep="${ivy.basedir}/path/to/myrep"
mysecondrep="${ivy.basedir}/path/to/secondrep"
myseconddirlayout="[module]/[type]s"/>
</resolvers>
</ivysettings>

View File

@ -1,52 +1,52 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivysettings>
<properties file="missing-file.xml"/>
<property name="shared" value="${ivy.basedir}/sharedrep" override="false"/>
<properties file="ivysettings.properties" override="false" />
<settings defaultResolver="libraries" validate="false" />
<caches defaultCacheDir="${ivy.basedir}/mycache" checkUpToDate="false"
ivyPattern="[module]/ivys/ivy-[revision].xml"
artifactPattern="[module]/[type]s/[artifact]-[revision].[ext]" />
<latest-strategies>
<latest-revision name="mylatest-revision">
<specialMeaning name="PRE" value="-2"/>
<specialMeaning name="QA" value="4"/>
</latest-revision>
</latest-strategies>
<resolvers>
<chain name="internal">
<filesystem name="int1" latest="latest-time">
<ivy pattern="${shared}/[organisation]/[module]/ivys/ivy-[revision].xml"/>
<artifact pattern="${shared}/[organisation]/[module]/[type]s/[artifact]-[revision].[type]"/>
</filesystem>
<ibiblio name="int2"/>
</chain>
<filesystem name="libraries" latest="latest-revision">
<ivy pattern="${libraries.dir}/[organisation]/[module]/ivys/ivy-[revision].xml"/>
<artifact pattern="${libraries.dir}/[organisation]/[module]/[type]s/[artifact]-[revision].[type]"/>
</filesystem>
</resolvers>
<modules>
<module organisation="apache" name="ivy*" revision="2*" matcher="glob" resolver="int2"/>
<module organisation="apache" name="ivy*" matcher="glob" resolver="int1"/>
<module organisation="apache" name=".*" resolver="internal"/>
</modules>
</ivysettings>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivysettings>
<properties file="missing-file.xml"/>
<property name="shared" value="${ivy.basedir}/sharedrep" override="false"/>
<properties file="ivysettings.properties" override="false" />
<settings defaultResolver="libraries" validate="false" />
<caches defaultCacheDir="${ivy.basedir}/mycache" checkUpToDate="false"
ivyPattern="[module]/ivys/ivy-[revision].xml"
artifactPattern="[module]/[type]s/[artifact]-[revision].[ext]" />
<latest-strategies>
<latest-revision name="mylatest-revision">
<specialMeaning name="PRE" value="-2"/>
<specialMeaning name="QA" value="4"/>
</latest-revision>
</latest-strategies>
<resolvers>
<chain name="internal">
<filesystem name="int1" latest="latest-time">
<ivy pattern="${shared}/[organisation]/[module]/ivys/ivy-[revision].xml"/>
<artifact pattern="${shared}/[organisation]/[module]/[type]s/[artifact]-[revision].[type]"/>
</filesystem>
<ibiblio name="int2"/>
</chain>
<filesystem name="libraries" latest="latest-revision">
<ivy pattern="${libraries.dir}/[organisation]/[module]/ivys/ivy-[revision].xml"/>
<artifact pattern="${libraries.dir}/[organisation]/[module]/[type]s/[artifact]-[revision].[type]"/>
</filesystem>
</resolvers>
<modules>
<module organisation="apache" name="ivy*" revision="2*" matcher="glob" resolver="int2"/>
<module organisation="apache" name="ivy*" matcher="glob" resolver="int1"/>
<module organisation="apache" name=".*" resolver="internal"/>
</modules>
</ivysettings>

View File

@ -1,50 +1,50 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.circular;
import junit.framework.TestCase;
import org.apache.ivy.TestHelper;
import org.apache.ivy.util.Message;
import org.apache.ivy.util.MockMessageLogger;
public class IgnoreCircularDependencyStrategyTest extends TestCase {
private CircularDependencyStrategy strategy;
private MockMessageLogger mockMessageImpl;
protected void setUp() throws Exception {
strategy = IgnoreCircularDependencyStrategy.getInstance();
mockMessageImpl = new MockMessageLogger();
Message.setDefaultLogger(mockMessageImpl);
}
public void testLog() throws Exception {
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.0, #B;1.0"));
mockMessageImpl.assertLogVerboseContains("circular dependency found: #A;1.0->#B;1.0");
}
public void testRemoveDuplicates() throws Exception {
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
// should only log the circular dependency once
assertEquals(1, mockMessageImpl.getLogs().size());
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.circular;
import junit.framework.TestCase;
import org.apache.ivy.TestHelper;
import org.apache.ivy.util.Message;
import org.apache.ivy.util.MockMessageLogger;
public class IgnoreCircularDependencyStrategyTest extends TestCase {
private CircularDependencyStrategy strategy;
private MockMessageLogger mockMessageImpl;
protected void setUp() throws Exception {
strategy = IgnoreCircularDependencyStrategy.getInstance();
mockMessageImpl = new MockMessageLogger();
Message.setDefaultLogger(mockMessageImpl);
}
public void testLog() throws Exception {
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.0, #B;1.0"));
mockMessageImpl.assertLogVerboseContains("circular dependency found: #A;1.0->#B;1.0");
}
public void testRemoveDuplicates() throws Exception {
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
// should only log the circular dependency once
assertEquals(1, mockMessageImpl.getLogs().size());
}
}

View File

@ -1,90 +1,90 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.circular;
import junit.framework.TestCase;
import org.apache.ivy.TestHelper;
import org.apache.ivy.core.IvyContext;
import org.apache.ivy.core.event.EventManager;
import org.apache.ivy.core.resolve.ResolveData;
import org.apache.ivy.core.resolve.ResolveEngine;
import org.apache.ivy.core.resolve.ResolveOptions;
import org.apache.ivy.core.settings.IvySettings;
import org.apache.ivy.core.sort.SortEngine;
import org.apache.ivy.util.Message;
import org.apache.ivy.util.MockMessageLogger;
public class WarnCircularDependencyStrategyTest extends TestCase {
private CircularDependencyStrategy strategy;
private MockMessageLogger mockMessageImpl;
protected void setUp() throws Exception {
strategy = WarnCircularDependencyStrategy.getInstance();
resetLogger();
}
private void resetLogger() {
mockMessageImpl = new MockMessageLogger();
Message.setDefaultLogger(mockMessageImpl);
}
public void testLog() throws Exception {
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.0, #B;1.0"));
mockMessageImpl.assertLogWarningContains("circular dependency found: #A;1.0->#B;1.0");
}
public void testRemoveDuplicates() throws Exception {
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
// should only log the circular dependency once
assertEquals(1, mockMessageImpl.getLogs().size());
}
public void testRemoveDuplicates2() throws Exception {
setResolveContext("1");
resetLogger();
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
// should only log the circular dependency once
assertEquals(1, mockMessageImpl.getLogs().size());
setResolveContext("2");
resetLogger();
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
// should log the message
assertEquals(1, mockMessageImpl.getLogs().size());
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
// should not log the message again
assertEquals(1, mockMessageImpl.getLogs().size());
}
private void setResolveContext(String resolveId) {
IvySettings settings = new IvySettings();
IvyContext.getContext().setResolveData(
new ResolveData(
new ResolveEngine(settings, new EventManager(), new SortEngine(settings)),
new ResolveOptions().setResolveId(resolveId)));
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.circular;
import junit.framework.TestCase;
import org.apache.ivy.TestHelper;
import org.apache.ivy.core.IvyContext;
import org.apache.ivy.core.event.EventManager;
import org.apache.ivy.core.resolve.ResolveData;
import org.apache.ivy.core.resolve.ResolveEngine;
import org.apache.ivy.core.resolve.ResolveOptions;
import org.apache.ivy.core.settings.IvySettings;
import org.apache.ivy.core.sort.SortEngine;
import org.apache.ivy.util.Message;
import org.apache.ivy.util.MockMessageLogger;
public class WarnCircularDependencyStrategyTest extends TestCase {
private CircularDependencyStrategy strategy;
private MockMessageLogger mockMessageImpl;
protected void setUp() throws Exception {
strategy = WarnCircularDependencyStrategy.getInstance();
resetLogger();
}
private void resetLogger() {
mockMessageImpl = new MockMessageLogger();
Message.setDefaultLogger(mockMessageImpl);
}
public void testLog() throws Exception {
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.0, #B;1.0"));
mockMessageImpl.assertLogWarningContains("circular dependency found: #A;1.0->#B;1.0");
}
public void testRemoveDuplicates() throws Exception {
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
// should only log the circular dependency once
assertEquals(1, mockMessageImpl.getLogs().size());
}
public void testRemoveDuplicates2() throws Exception {
setResolveContext("1");
resetLogger();
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
// should only log the circular dependency once
assertEquals(1, mockMessageImpl.getLogs().size());
setResolveContext("2");
resetLogger();
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
// should log the message
assertEquals(1, mockMessageImpl.getLogs().size());
strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
// should not log the message again
assertEquals(1, mockMessageImpl.getLogs().size());
}
private void setResolveContext(String resolveId) {
IvySettings settings = new IvySettings();
IvyContext.getContext().setResolveData(
new ResolveData(
new ResolveEngine(settings, new EventManager(), new SortEngine(settings)),
new ResolveOptions().setResolveId(resolveId)));
}
}

View File

@ -1,188 +1,188 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.conflict;
import java.io.IOException;
import java.text.ParseException;
import junit.framework.TestCase;
import org.apache.ivy.Ivy;
import org.apache.ivy.TestFixture;
import org.apache.ivy.TestHelper;
import org.apache.ivy.core.report.ConfigurationResolveReport;
import org.apache.ivy.core.report.ResolveReport;
public class LatestCompatibleConflictManagerTest extends TestCase {
private TestFixture fixture;
protected void setUp() throws Exception {
fixture = new TestFixture();
LatestCompatibleConflictManager cm = new LatestCompatibleConflictManager();
fixture.getSettings().addConfigured(cm);
fixture.getSettings().setDefaultConflictManager(cm);
}
protected void tearDown() throws Exception {
fixture.clean();
}
public void testInitFromSettings() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(LatestCompatibleConflictManagerTest
.class.getResource("ivysettings-latest-compatible.xml"));
ConflictManager cm = ivy.getSettings().getDefaultConflictManager();
assertTrue(cm instanceof LatestCompatibleConflictManager);
}
public void testCompatibilityResolve1() throws Exception {
fixture
.addMD("#A;1-> { #B;1.4 #C;[2.0,2.5] }")
.addMD("#B;1.4->#D;1.5")
.addMD("#C;2.5->#D;[1.0,1.6]")
.addMD("#D;1.5").addMD("#D;1.6")
.init();
resolveAndAssert("#A;1", "#B;1.4, #C;2.5, #D;1.5");
}
public void testCompatibilityResolve2() throws Exception {
fixture
.addMD("#A;2-> { #B;[1.0,1.5] #C;[2.0,2.5] }")
.addMD("#B;1.4->#D;1.5")
.addMD("#B;1.5->#D;2.0")
.addMD("#C;2.5->#D;[1.0,1.6]")
.addMD("#D;1.5").addMD("#D;1.6").addMD("#D;2.0")
.init();
resolveAndAssert("#A;2", "#B;1.4, #C;2.5, #D;1.5");
}
public void testCompatibilityResolve3() throws Exception {
fixture
.addMD("#A;3-> { #B;[2.0,2.5] #C;[3.0,3.5] }")
.addMD("#B;2.3-> { #D;1.5 #E;1.0 }")
.addMD("#B;2.4-> { #D;1.5 #E;2.0 }")
.addMD("#B;2.5-> { #D;2.0 }")
.addMD("#C;3.4-> { #D;[1.0,1.6] #E;1.0 }")
.addMD("#C;3.5-> { #D;[1.0,1.6] #E;1.9 }")
.addMD("#D;1.5").addMD("#D;1.6").addMD("#D;2.0")
.addMD("#E;1.0").addMD("#E;1.9").addMD("#E;2.0")
.init();
resolveAndAssert("#A;3", "#B;2.3, #C;3.4, #D;1.5, #E;1.0");
}
public void testCompatibilityResolve4() throws Exception {
fixture
.addMD("#A;4-> { #B;[1.0,1.5] #C;[2.0,2.5] #F;[1.0,1.1] }")
.addMD("#B;1.4->#D;1.5")
.addMD("#B;1.5->#D;2.0")
.addMD("#C;2.5->#D;[1.0,1.6]")
.addMD("#F;1.0->#D;1.5")
.addMD("#F;1.1->#D;1.6")
.addMD("#D;1.5").addMD("#D;1.6").addMD("#D;2.0")
.init();
resolveAndAssert("#A;4", "#B;1.4, #C;2.5, #D;1.5, #F;1.0");
}
public void testCompatibilityResolve5() throws Exception {
fixture
.addMD("#A;5->{ #B;[1.0,1.5] #C;2.6 }")
.addMD("#B;1.3->{ }")
.addMD("#B;1.4->#D;1.5")
.addMD("#B;1.5->#D;2.0")
.addMD("#C;2.6->#D;1.6")
.addMD("#D;1.5").addMD("#D;1.6").addMD("#D;2.0")
.init();
resolveAndAssert("#A;5", "#B;1.3, #C;2.6, #D;1.6");
}
public void testCompatibilityResolve6() throws Exception {
fixture
.addMD("#A;1-> { #C;[2.0,2.5] #B;1.4 }")
.addMD("#B;1.4->#D;1.5")
.addMD("#C;2.5->#D;[1.0,1.6]")
.addMD("#D;1.5").addMD("#D;1.6")
.init();
resolveAndAssert("#A;1", "#B;1.4, #C;2.5, #D;1.5");
}
public void testCompatibilityResolveCircularDependency1() throws Exception {
fixture
.addMD("#A;6->{ #B;[3.0,3.5] #C;4.6 }")
.addMD("#B;3.4->#D;2.5")
.addMD("#B;3.5->#D;3.0")
.addMD("#C;4.6->#D;2.5")
.addMD("#D;3.0->#B;3.5") // circular dependency
.addMD("#D;2.5->#B;3.4") // circular dependency
.init();
resolveAndAssert("#A;6", "#B;3.4, #C;4.6, #D;2.5");
}
public void testCompatibilityResolveCircularDependency2() throws Exception {
fixture
.addMD("#A;1->#C;2")
.addMD("#C;1->#B;1")
.addMD("#C;2->#B;2")
.addMD("#C;3->#B;3")
.addMD("#B;1->#C;latest.integration") // circular dependency
.addMD("#B;2->#C;latest.integration") // circular dependency
.addMD("#B;3->#C;latest.integration") // circular dependency
.init();
resolveAndAssert("#A;1", "#B;2, #C;2");
}
public void testCompatibilityResolveCircularDependency3() throws Exception {
// same as 2, but A depends on B
fixture
.addMD("#A;1->#B;2")
.addMD("#C;1->#B;1")
.addMD("#C;2->#B;2")
.addMD("#C;3->#B;3")
.addMD("#B;1->#C;latest.integration") // circular dependency
.addMD("#B;2->#C;latest.integration") // circular dependency
.addMD("#B;3->#C;latest.integration") // circular dependency
.init();
resolveAndAssert("#A;1", "#B;2, #C;2");
}
public void testConflict() throws Exception {
try {
fixture
.addMD("#A;conflict-> { #B;[1.5,1.6] #C;2.5 }")
.addMD("#B;1.5->#D;2.0")
.addMD("#B;1.6->#D;2.0")
.addMD("#C;2.5->#D;[1.0,1.6]")
.addMD("#D;1.5").addMD("#D;1.6").addMD("#D;2.0")
.init();
fixture.resolve("#A;conflict");
fail("Resolve should have failed with a conflict");
} catch (StrictConflictException e) {
// this is expected
}
}
private void resolveAndAssert(String mrid, String expectedModuleSet)
throws ParseException, IOException {
ResolveReport report = fixture.resolve(mrid);
assertFalse(report.hasError());
ConfigurationResolveReport defaultReport = report.getConfigurationReport("default");
TestHelper.assertModuleRevisionIds(expectedModuleSet,
defaultReport.getModuleRevisionIds());
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.conflict;
import java.io.IOException;
import java.text.ParseException;
import junit.framework.TestCase;
import org.apache.ivy.Ivy;
import org.apache.ivy.TestFixture;
import org.apache.ivy.TestHelper;
import org.apache.ivy.core.report.ConfigurationResolveReport;
import org.apache.ivy.core.report.ResolveReport;
public class LatestCompatibleConflictManagerTest extends TestCase {
private TestFixture fixture;
protected void setUp() throws Exception {
fixture = new TestFixture();
LatestCompatibleConflictManager cm = new LatestCompatibleConflictManager();
fixture.getSettings().addConfigured(cm);
fixture.getSettings().setDefaultConflictManager(cm);
}
protected void tearDown() throws Exception {
fixture.clean();
}
public void testInitFromSettings() throws Exception {
Ivy ivy = new Ivy();
ivy.configure(LatestCompatibleConflictManagerTest
.class.getResource("ivysettings-latest-compatible.xml"));
ConflictManager cm = ivy.getSettings().getDefaultConflictManager();
assertTrue(cm instanceof LatestCompatibleConflictManager);
}
public void testCompatibilityResolve1() throws Exception {
fixture
.addMD("#A;1-> { #B;1.4 #C;[2.0,2.5] }")
.addMD("#B;1.4->#D;1.5")
.addMD("#C;2.5->#D;[1.0,1.6]")
.addMD("#D;1.5").addMD("#D;1.6")
.init();
resolveAndAssert("#A;1", "#B;1.4, #C;2.5, #D;1.5");
}
public void testCompatibilityResolve2() throws Exception {
fixture
.addMD("#A;2-> { #B;[1.0,1.5] #C;[2.0,2.5] }")
.addMD("#B;1.4->#D;1.5")
.addMD("#B;1.5->#D;2.0")
.addMD("#C;2.5->#D;[1.0,1.6]")
.addMD("#D;1.5").addMD("#D;1.6").addMD("#D;2.0")
.init();
resolveAndAssert("#A;2", "#B;1.4, #C;2.5, #D;1.5");
}
public void testCompatibilityResolve3() throws Exception {
fixture
.addMD("#A;3-> { #B;[2.0,2.5] #C;[3.0,3.5] }")
.addMD("#B;2.3-> { #D;1.5 #E;1.0 }")
.addMD("#B;2.4-> { #D;1.5 #E;2.0 }")
.addMD("#B;2.5-> { #D;2.0 }")
.addMD("#C;3.4-> { #D;[1.0,1.6] #E;1.0 }")
.addMD("#C;3.5-> { #D;[1.0,1.6] #E;1.9 }")
.addMD("#D;1.5").addMD("#D;1.6").addMD("#D;2.0")
.addMD("#E;1.0").addMD("#E;1.9").addMD("#E;2.0")
.init();
resolveAndAssert("#A;3", "#B;2.3, #C;3.4, #D;1.5, #E;1.0");
}
public void testCompatibilityResolve4() throws Exception {
fixture
.addMD("#A;4-> { #B;[1.0,1.5] #C;[2.0,2.5] #F;[1.0,1.1] }")
.addMD("#B;1.4->#D;1.5")
.addMD("#B;1.5->#D;2.0")
.addMD("#C;2.5->#D;[1.0,1.6]")
.addMD("#F;1.0->#D;1.5")
.addMD("#F;1.1->#D;1.6")
.addMD("#D;1.5").addMD("#D;1.6").addMD("#D;2.0")
.init();
resolveAndAssert("#A;4", "#B;1.4, #C;2.5, #D;1.5, #F;1.0");
}
public void testCompatibilityResolve5() throws Exception {
fixture
.addMD("#A;5->{ #B;[1.0,1.5] #C;2.6 }")
.addMD("#B;1.3->{ }")
.addMD("#B;1.4->#D;1.5")
.addMD("#B;1.5->#D;2.0")
.addMD("#C;2.6->#D;1.6")
.addMD("#D;1.5").addMD("#D;1.6").addMD("#D;2.0")
.init();
resolveAndAssert("#A;5", "#B;1.3, #C;2.6, #D;1.6");
}
public void testCompatibilityResolve6() throws Exception {
fixture
.addMD("#A;1-> { #C;[2.0,2.5] #B;1.4 }")
.addMD("#B;1.4->#D;1.5")
.addMD("#C;2.5->#D;[1.0,1.6]")
.addMD("#D;1.5").addMD("#D;1.6")
.init();
resolveAndAssert("#A;1", "#B;1.4, #C;2.5, #D;1.5");
}
public void testCompatibilityResolveCircularDependency1() throws Exception {
fixture
.addMD("#A;6->{ #B;[3.0,3.5] #C;4.6 }")
.addMD("#B;3.4->#D;2.5")
.addMD("#B;3.5->#D;3.0")
.addMD("#C;4.6->#D;2.5")
.addMD("#D;3.0->#B;3.5") // circular dependency
.addMD("#D;2.5->#B;3.4") // circular dependency
.init();
resolveAndAssert("#A;6", "#B;3.4, #C;4.6, #D;2.5");
}
public void testCompatibilityResolveCircularDependency2() throws Exception {
fixture
.addMD("#A;1->#C;2")
.addMD("#C;1->#B;1")
.addMD("#C;2->#B;2")
.addMD("#C;3->#B;3")
.addMD("#B;1->#C;latest.integration") // circular dependency
.addMD("#B;2->#C;latest.integration") // circular dependency
.addMD("#B;3->#C;latest.integration") // circular dependency
.init();
resolveAndAssert("#A;1", "#B;2, #C;2");
}
public void testCompatibilityResolveCircularDependency3() throws Exception {
// same as 2, but A depends on B
fixture
.addMD("#A;1->#B;2")
.addMD("#C;1->#B;1")
.addMD("#C;2->#B;2")
.addMD("#C;3->#B;3")
.addMD("#B;1->#C;latest.integration") // circular dependency
.addMD("#B;2->#C;latest.integration") // circular dependency
.addMD("#B;3->#C;latest.integration") // circular dependency
.init();
resolveAndAssert("#A;1", "#B;2, #C;2");
}
public void testConflict() throws Exception {
try {
fixture
.addMD("#A;conflict-> { #B;[1.5,1.6] #C;2.5 }")
.addMD("#B;1.5->#D;2.0")
.addMD("#B;1.6->#D;2.0")
.addMD("#C;2.5->#D;[1.0,1.6]")
.addMD("#D;1.5").addMD("#D;1.6").addMD("#D;2.0")
.init();
fixture.resolve("#A;conflict");
fail("Resolve should have failed with a conflict");
} catch (StrictConflictException e) {
// this is expected
}
}
private void resolveAndAssert(String mrid, String expectedModuleSet)
throws ParseException, IOException {
ResolveReport report = fixture.resolve(mrid);
assertFalse(report.hasError());
ConfigurationResolveReport defaultReport = report.getConfigurationReport("default");
TestHelper.assertModuleRevisionIds(expectedModuleSet,
defaultReport.getModuleRevisionIds());
}
}

View File

@ -1,25 +1,25 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="apache" module="resolve-noconflict" revision="1.0" status="release"/>
<dependencies>
<dependency org="org1" name="mod1.2" rev="2.+"/>
<dependency org="org2" name="mod2.1" rev="0.3"/>
</dependencies>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="apache" module="resolve-noconflict" revision="1.0" status="release"/>
<dependencies>
<dependency org="org1" name="mod1.2" rev="2.+"/>
<dependency org="org2" name="mod2.1" rev="0.3"/>
</dependencies>
</ivy-module>

View File

@ -1,25 +1,25 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="apache" module="resolve-noconflict" revision="1.0" status="release"/>
<dependencies>
<dependency org="org1" name="mod1.2" rev="[2.0,2.1["/>
<dependency org="org2" name="mod2.1" rev="0.3"/>
</dependencies>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="apache" module="resolve-noconflict" revision="1.0" status="release"/>
<dependencies>
<dependency org="org1" name="mod1.2" rev="[2.0,2.1["/>
<dependency org="org2" name="mod2.1" rev="0.3"/>
</dependencies>
</ivy-module>

View File

@ -1,30 +1,30 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivysettings>
<settings defaultCache="${ivy.basedir}/build/cache" defaultResolver="test" defaultConflictManager="latest-compatible" />
<resolvers>
<filesystem name="test">
<ivy pattern="${ivy.basedir}/test/repositories/latest-compatible/[module]/[revision]/[artifact].[ext]"/>
<artifact
pattern="${ivy.basedir}/test/repositories/latest-compatible/[module]/[revision]/[artifact].[ext]"/>
</filesystem>
</resolvers>
</ivysettings>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivysettings>
<settings defaultCache="${ivy.basedir}/build/cache" defaultResolver="test" defaultConflictManager="latest-compatible" />
<resolvers>
<filesystem name="test">
<ivy pattern="${ivy.basedir}/test/repositories/latest-compatible/[module]/[revision]/[artifact].[ext]"/>
<artifact
pattern="${ivy.basedir}/test/repositories/latest-compatible/[module]/[revision]/[artifact].[ext]"/>
</filesystem>
</resolvers>
</ivysettings>

View File

@ -1,193 +1,193 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.lock;
import java.io.File;
import java.text.ParseException;
import junit.framework.TestCase;
import org.apache.ivy.core.cache.DefaultRepositoryCacheManager;
import org.apache.ivy.core.cache.RepositoryCacheManager;
import org.apache.ivy.core.event.EventManager;
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.resolve.ResolveData;
import org.apache.ivy.core.resolve.ResolveEngine;
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.core.sort.SortEngine;
import org.apache.ivy.plugins.repository.RepositoryCopyProgressListener;
import org.apache.ivy.plugins.repository.file.FileRepository;
import org.apache.ivy.plugins.resolver.FileSystemResolver;
import org.apache.ivy.util.CopyProgressEvent;
import org.apache.ivy.util.FileUtil;
import org.apache.ivy.util.Message;
public class ArtifactLockStrategyTest extends TestCase {
protected void setUp() throws Exception {
FileUtil.forceDelete(new File("build/test/cache"));
}
protected void tearDown() throws Exception {
FileUtil.forceDelete(new File("build/test/cache"));
}
public void testConcurrentResolve() throws Exception {
// we use different settings because Ivy do not support multi thread resolve with the same
// settings yet and this is not what this test is about: the focus of this test is running
// concurrent resolves in separate vms but using the same cache. We don't span the test on
// multiple vms, but using separate settings we should only run into shared cache related
// issues, and not multi thread related issues.
IvySettings settings1 = new IvySettings();
IvySettings settings2 = new IvySettings();
IvySettings settings3 = new IvySettings();
// run 3 concurrent resolves, one taking 100ms to download files, one 20ms and one 5ms
// the first one do 10 resolves, the second one 20 and the third 50
// note that the download time is useful only at the very beginning, then the cached file is used
ResolveThread t1 = asyncResolve(
settings1, createSlowResolver(settings1, 100), "org6#mod6.4;3", 10);
ResolveThread t2 = asyncResolve(
settings2, createSlowResolver(settings2, 20), "org6#mod6.4;3", 20);
ResolveThread t3 = asyncResolve(
settings3, createSlowResolver(settings3, 5), "org6#mod6.4;3", 50);
t1.join(100000);
t2.join(20000);
t3.join(20000);
assertEquals(10, t1.getCount());
assertFound("org6#mod6.4;3", t1.getFinalResult());
assertEquals(20, t2.getCount());
assertFound("org6#mod6.4;3", t2.getFinalResult());
assertEquals(50, t3.getCount());
assertFound("org6#mod6.4;3", t3.getFinalResult());
}
private RepositoryCacheManager newCacheManager(IvySettings settings) {
DefaultRepositoryCacheManager cacheManager
= new DefaultRepositoryCacheManager("cache", settings, new File("build/test/cache"));
cacheManager.setLockStrategy(new ArtifactLockStrategy());
return cacheManager;
}
private FileSystemResolver createSlowResolver(IvySettings settings, final int sleep) {
FileSystemResolver resolver = new FileSystemResolver();
resolver.setRepositoryCacheManager(newCacheManager(settings));
resolver.setRepository(new FileRepository() {
private RepositoryCopyProgressListener progress = new RepositoryCopyProgressListener(this) {
public void progress(CopyProgressEvent evt) {
super.progress(evt);
sleepSilently(sleep); // makes the file copy longer to test concurrency issues
}
};
protected RepositoryCopyProgressListener getProgressListener() {
return progress ;
}
});
resolver.setName("test");
resolver.setSettings(settings);
resolver.addIvyPattern(
settings.getBaseDir() + "/test/repositories/1/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]");
resolver.addArtifactPattern(
settings.getBaseDir() + "/test/repositories/1/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]");
return resolver;
}
private ResolveThread asyncResolve(
IvySettings settings, FileSystemResolver resolver, String module, int loop) {
ResolveThread thread = new ResolveThread(settings, resolver, module, loop);
thread.start();
return thread;
}
private void assertFound(String module, ResolvedModuleRevision rmr) {
assertNotNull(rmr);
assertEquals(module, rmr.getId().toString());
}
private ResolvedModuleRevision resolveModule(
IvySettings settings, FileSystemResolver resolver, String module)
throws ParseException {
return resolver.getDependency(
new DefaultDependencyDescriptor(ModuleRevisionId.parse(module), false),
new ResolveData(
new ResolveEngine(settings, new EventManager(), new SortEngine(settings)),
new ResolveOptions()));
}
private void sleepSilently(int timeout) {
try {
Thread.sleep(timeout);
} catch (InterruptedException e) {
}
}
private class ResolveThread extends Thread {
private IvySettings settings;
private FileSystemResolver resolver;
private String module;
private final int loop;
private ResolvedModuleRevision finalResult;
private int count;
public ResolveThread(IvySettings settings, FileSystemResolver resolver, String module, int loop) {
this.settings = settings;
this.resolver = resolver;
this.module = module;
this.loop = loop;
}
public synchronized ResolvedModuleRevision getFinalResult() {
return finalResult;
}
public synchronized int getCount() {
return count;
}
public void run() {
ResolvedModuleRevision rmr = null;
for (int i =0; i<loop; i++) {
try {
rmr = resolveModule(settings, resolver, module);
if (rmr == null) {
throw new RuntimeException("module not found: " + module);
}
synchronized (this) {
//Message.info(this.toString() + " count = " + count);
count++;
}
} catch (ParseException e) {
Message.info("parse exception "+e);
} catch (RuntimeException e) {
Message.info("exception "+e);
e.printStackTrace();
throw e;
} catch (Error e) {
Message.info("exception "+e);
e.printStackTrace();
throw e;
}
}
synchronized (this) {
finalResult = rmr;
}
}
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.lock;
import java.io.File;
import java.text.ParseException;
import junit.framework.TestCase;
import org.apache.ivy.core.cache.DefaultRepositoryCacheManager;
import org.apache.ivy.core.cache.RepositoryCacheManager;
import org.apache.ivy.core.event.EventManager;
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.resolve.ResolveData;
import org.apache.ivy.core.resolve.ResolveEngine;
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.core.sort.SortEngine;
import org.apache.ivy.plugins.repository.RepositoryCopyProgressListener;
import org.apache.ivy.plugins.repository.file.FileRepository;
import org.apache.ivy.plugins.resolver.FileSystemResolver;
import org.apache.ivy.util.CopyProgressEvent;
import org.apache.ivy.util.FileUtil;
import org.apache.ivy.util.Message;
public class ArtifactLockStrategyTest extends TestCase {
protected void setUp() throws Exception {
FileUtil.forceDelete(new File("build/test/cache"));
}
protected void tearDown() throws Exception {
FileUtil.forceDelete(new File("build/test/cache"));
}
public void testConcurrentResolve() throws Exception {
// we use different settings because Ivy do not support multi thread resolve with the same
// settings yet and this is not what this test is about: the focus of this test is running
// concurrent resolves in separate vms but using the same cache. We don't span the test on
// multiple vms, but using separate settings we should only run into shared cache related
// issues, and not multi thread related issues.
IvySettings settings1 = new IvySettings();
IvySettings settings2 = new IvySettings();
IvySettings settings3 = new IvySettings();
// run 3 concurrent resolves, one taking 100ms to download files, one 20ms and one 5ms
// the first one do 10 resolves, the second one 20 and the third 50
// note that the download time is useful only at the very beginning, then the cached file is used
ResolveThread t1 = asyncResolve(
settings1, createSlowResolver(settings1, 100), "org6#mod6.4;3", 10);
ResolveThread t2 = asyncResolve(
settings2, createSlowResolver(settings2, 20), "org6#mod6.4;3", 20);
ResolveThread t3 = asyncResolve(
settings3, createSlowResolver(settings3, 5), "org6#mod6.4;3", 50);
t1.join(100000);
t2.join(20000);
t3.join(20000);
assertEquals(10, t1.getCount());
assertFound("org6#mod6.4;3", t1.getFinalResult());
assertEquals(20, t2.getCount());
assertFound("org6#mod6.4;3", t2.getFinalResult());
assertEquals(50, t3.getCount());
assertFound("org6#mod6.4;3", t3.getFinalResult());
}
private RepositoryCacheManager newCacheManager(IvySettings settings) {
DefaultRepositoryCacheManager cacheManager
= new DefaultRepositoryCacheManager("cache", settings, new File("build/test/cache"));
cacheManager.setLockStrategy(new ArtifactLockStrategy());
return cacheManager;
}
private FileSystemResolver createSlowResolver(IvySettings settings, final int sleep) {
FileSystemResolver resolver = new FileSystemResolver();
resolver.setRepositoryCacheManager(newCacheManager(settings));
resolver.setRepository(new FileRepository() {
private RepositoryCopyProgressListener progress = new RepositoryCopyProgressListener(this) {
public void progress(CopyProgressEvent evt) {
super.progress(evt);
sleepSilently(sleep); // makes the file copy longer to test concurrency issues
}
};
protected RepositoryCopyProgressListener getProgressListener() {
return progress ;
}
});
resolver.setName("test");
resolver.setSettings(settings);
resolver.addIvyPattern(
settings.getBaseDir() + "/test/repositories/1/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]");
resolver.addArtifactPattern(
settings.getBaseDir() + "/test/repositories/1/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]");
return resolver;
}
private ResolveThread asyncResolve(
IvySettings settings, FileSystemResolver resolver, String module, int loop) {
ResolveThread thread = new ResolveThread(settings, resolver, module, loop);
thread.start();
return thread;
}
private void assertFound(String module, ResolvedModuleRevision rmr) {
assertNotNull(rmr);
assertEquals(module, rmr.getId().toString());
}
private ResolvedModuleRevision resolveModule(
IvySettings settings, FileSystemResolver resolver, String module)
throws ParseException {
return resolver.getDependency(
new DefaultDependencyDescriptor(ModuleRevisionId.parse(module), false),
new ResolveData(
new ResolveEngine(settings, new EventManager(), new SortEngine(settings)),
new ResolveOptions()));
}
private void sleepSilently(int timeout) {
try {
Thread.sleep(timeout);
} catch (InterruptedException e) {
}
}
private class ResolveThread extends Thread {
private IvySettings settings;
private FileSystemResolver resolver;
private String module;
private final int loop;
private ResolvedModuleRevision finalResult;
private int count;
public ResolveThread(IvySettings settings, FileSystemResolver resolver, String module, int loop) {
this.settings = settings;
this.resolver = resolver;
this.module = module;
this.loop = loop;
}
public synchronized ResolvedModuleRevision getFinalResult() {
return finalResult;
}
public synchronized int getCount() {
return count;
}
public void run() {
ResolvedModuleRevision rmr = null;
for (int i =0; i<loop; i++) {
try {
rmr = resolveModule(settings, resolver, module);
if (rmr == null) {
throw new RuntimeException("module not found: " + module);
}
synchronized (this) {
//Message.info(this.toString() + " count = " + count);
count++;
}
} catch (ParseException e) {
Message.info("parse exception "+e);
} catch (RuntimeException e) {
Message.info("exception "+e);
e.printStackTrace();
throw e;
} catch (Error e) {
Message.info("exception "+e);
e.printStackTrace();
throw e;
}
}
synchronized (this) {
finalResult = rmr;
}
}
}
}

View File

@ -1,43 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache</groupId>
<artifactId>test</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<url>http://ant.apache.org/ivy</url>
<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.0.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache</groupId>
<artifactId>test</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<url>http://ant.apache.org/ivy</url>
<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.0.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -1,29 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache</groupId>
<artifactId>test</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<url>http://ivy.jayasoft.org/</url>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache</groupId>
<artifactId>test</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<url>http://ivy.jayasoft.org/</url>
</project>

View File

@ -1,35 +1,35 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="http://www.jayasoft.fr/org/ivyrep/ivy-doc.xsl"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg"
module="mymodule"
revision="myrev"
status="integration"
publication="20041101110000"/>
<configurations defaultconfmapping="test->default" defaultconf="default">
<conf name="default"/>
<conf name="test"/>
</configurations>
<dependencies>
<dependency name="mymodule1" rev="1.0"/>
<dependency name="mymodule2" rev="2.0" conf="test"/>
</dependencies>
</ivy-module>
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="http://www.jayasoft.fr/org/ivyrep/ivy-doc.xsl"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg"
module="mymodule"
revision="myrev"
status="integration"
publication="20041101110000"/>
<configurations defaultconfmapping="test->default" defaultconf="default">
<conf name="default"/>
<conf name="test"/>
</configurations>
<dependencies>
<dependency name="mymodule1" rev="1.0"/>
<dependency name="mymodule2" rev="2.0" conf="test"/>
</dependencies>
</ivy-module>

View File

@ -1,32 +1,32 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg"
module="mymodule"
status="integration"
publication="20091206000000">
<extends organisation="myorg" module="myparent" revision="latest.revision" location="test-extends-parent.xml"/>
</info>
<configurations>
<conf name="conf2" visibility="private"/>
</configurations>
<dependencies>
<dependency name="mymodule2" rev="2.0" conf="conf1,conf2"/>
</dependencies>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg"
module="mymodule"
status="integration"
publication="20091206000000">
<extends organisation="myorg" module="myparent" revision="latest.revision" location="test-extends-parent.xml"/>
</info>
<configurations>
<conf name="conf2" visibility="private"/>
</configurations>
<dependencies>
<dependency name="mymodule2" rev="2.0" conf="conf1,conf2"/>
</dependencies>
</ivy-module>

View File

@ -1,32 +1,32 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg"
module="mymodule"
status="integration"
publication="20091206000000">
<extends organisation="myorg" module="myparent" revision="latest.revision"/>
</info>
<configurations>
<conf name="conf2" visibility="private"/>
</configurations>
<dependencies>
<dependency name="mymodule2" rev="2.0" conf="conf1,conf2"/>
</dependencies>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg"
module="mymodule"
status="integration"
publication="20091206000000">
<extends organisation="myorg" module="myparent" revision="latest.revision"/>
</info>
<configurations>
<conf name="conf2" visibility="private"/>
</configurations>
<dependencies>
<dependency name="mymodule2" rev="2.0" conf="conf1,conf2"/>
</dependencies>
</ivy-module>

View File

@ -1,33 +1,33 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg"
module="mymodule"
status="integration"
publication="20091206000000">
<extends organisation="myorg" module="myparent" revision="latest.revision"
location="test-extends-parent.xml" extendType="configurations"/>
</info>
<configurations>
<conf name="conf2" visibility="private"/>
</configurations>
<dependencies>
<dependency name="mymodule2" rev="2.0" conf="conf1,conf2"/>
</dependencies>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg"
module="mymodule"
status="integration"
publication="20091206000000">
<extends organisation="myorg" module="myparent" revision="latest.revision"
location="test-extends-parent.xml" extendType="configurations"/>
</info>
<configurations>
<conf name="conf2" visibility="private"/>
</configurations>
<dependencies>
<dependency name="mymodule2" rev="2.0" conf="conf1,conf2"/>
</dependencies>
</ivy-module>

View File

@ -1,30 +1,30 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg"
module="mymodule"
status="integration"
publication="20091206000000">
<extends organisation="myorg" module="myparent" revision="latest.revision"
location="test-extends-parent.xml" extendType="dependencies"/>
</info>
<dependencies>
<dependency name="mymodule2" rev="2.0" conf="default"/>
</dependencies>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg"
module="mymodule"
status="integration"
publication="20091206000000">
<extends organisation="myorg" module="myparent" revision="latest.revision"
location="test-extends-parent.xml" extendType="dependencies"/>
</info>
<dependencies>
<dependency name="mymodule2" rev="2.0" conf="default"/>
</dependencies>
</ivy-module>

View File

@ -1,31 +1,31 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg"
module="mymodule"
status="integration"
publication="20091206000000">
<extends organisation="myorg" module="myparent" revision="latest.revision"
location="test-extends-parent.xml" extendType="description"/>
<description>Child description overrides parent.</description>
</info>
<dependencies>
<dependency name="mymodule2" rev="2.0" conf="default"/>
</dependencies>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg"
module="mymodule"
status="integration"
publication="20091206000000">
<extends organisation="myorg" module="myparent" revision="latest.revision"
location="test-extends-parent.xml" extendType="description"/>
<description>Child description overrides parent.</description>
</info>
<dependencies>
<dependency name="mymodule2" rev="2.0" conf="default"/>
</dependencies>
</ivy-module>

View File

@ -1,30 +1,30 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg"
module="mymodule"
status="integration"
publication="20091206000000">
<extends organisation="myorg" module="myparent" revision="latest.revision"
location="test-extends-parent.xml" extendType="description"/>
</info>
<dependencies>
<dependency name="mymodule2" rev="2.0" conf="default"/>
</dependencies>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg"
module="mymodule"
status="integration"
publication="20091206000000">
<extends organisation="myorg" module="myparent" revision="latest.revision"
location="test-extends-parent.xml" extendType="description"/>
</info>
<dependencies>
<dependency name="mymodule2" rev="2.0" conf="default"/>
</dependencies>
</ivy-module>

View File

@ -1,33 +1,33 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg"
module="mymodule"
status="integration"
publication="20091206000000">
<extends organisation="myorg" module="myparent" revision="latest.revision"
location="test-extends-parent.xml" extendType="configurations,dependencies"/>
</info>
<configurations>
<conf name="conf2" visibility="private"/>
</configurations>
<dependencies>
<dependency name="mymodule2" rev="2.0" conf="conf1,conf2"/>
</dependencies>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg"
module="mymodule"
status="integration"
publication="20091206000000">
<extends organisation="myorg" module="myparent" revision="latest.revision"
location="test-extends-parent.xml" extendType="configurations,dependencies"/>
</info>
<configurations>
<conf name="conf2" visibility="private"/>
</configurations>
<dependencies>
<dependency name="mymodule2" rev="2.0" conf="conf1,conf2"/>
</dependencies>
</ivy-module>

View File

@ -1,34 +1,34 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg"
module="myparent"
revision="myrev"
status="integration"
publication="20091206000000">
<description>Parent module description. </description>
</info>
<configurations>
<conf name="default"/>
<conf name="conf1" visibility="public"/>
</configurations>
<dependencies>
<dependency name="mymodule1" rev="1.0" conf="default"/>
</dependencies>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg"
module="myparent"
revision="myrev"
status="integration"
publication="20091206000000">
<description>Parent module description. </description>
</info>
<configurations>
<conf name="default"/>
<conf name="conf1" visibility="public"/>
</configurations>
<dependencies>
<dependency name="mymodule1" rev="1.0" conf="default"/>
</dependencies>
</ivy-module>

View File

@ -1,27 +1,27 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg"
module="mymodule">
<license name="Apache Sofware License" url="http://www.apache.org/licenses/LICENSE-2.0.txt" />
<description homepage="http://myorg.com/mymodule">
My module description.
</description>
</info>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg"
module="mymodule">
<license name="Apache Sofware License" url="http://www.apache.org/licenses/LICENSE-2.0.txt" />
<description homepage="http://myorg.com/mymodule">
My module description.
</description>
</info>
</ivy-module>

View File

@ -1,110 +1,110 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="http://www.somesite.com/ivy-doc.xsl"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!-- A comment before the first tag -->
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://incubator.apache.org/ivy/schemas/ivy.xsd" xmlns:e="http://ant.apache.org/ivy/extra">
<!-- A comment with accent é & special characters -->
<info organisation="${myorg}"
module="${mymodule}"
revision="${myrev}"
status="${mystatus}"
e:myextra="myval"
publication="{mypubdate}">
<license name="${mylicense}" url="${mylicenseurl}"/>
<ivyauthor name="jayasoft" url="http://www.jayasoft.org/"/>
<ivyauthor name="${myorg}" url="${myorgurl}"/>
<repository name="${ivyrep}" url="${ivyrepurl}" pattern="${ivyreppattern}" ivys="${ivys}" artifacts="${artifacts}"/>
<description homepage="${homepage}">
This module is <b>great</b> !<br/>
You can use it especially with myconf1 &amp; myconf2, and myconf4 is not too bad too.
</description>
</info>
<configurations>
<include file="${includefile}"/>
<conf name="${myvar}" description="${mydesc}"/>
<conf name="myconf2" description="desc 2" visibility="${visibility}"/>
<conf name="myconf3" description="desc 3" visibility="private"/>
<conf name="myconf4" description="desc 4" extends="${myvar}, myconf2"/>
<conf name="myoldconf" description="my old desc" deprecated="${deprecated}"/>
</configurations>
<publications>
<artifact name="${myartifact1}" type="${mytype}"/>
<artifact name="myartifact2" type="jar" conf="${myvar}"/>
<artifact name="myartifact3" type="jar" conf="myconf1, myconf2, myconf3"/>
<artifact name="myartifact4" type="jar">
<conf name="${myvar}"/>
<conf name="myconf3"/>
</artifact>
</publications>
<dependencies>
<dependency name="${mymodule2}" rev="${mymodule2rev}"/>
<dependency name="mymodule3" rev="2.0" changing="${changing}" transitive="${transitive}"/>
<dependency org="yourorg" name="yourmodule1" branch="trunk" rev="1.1" branchConstraint="branch1" revConstraint="1+" conf="${myvar}"/>
<dependency org="yourorg" name="yourmodule2" branch="branch1" rev="2+" conf="myconf1->yourconf1"/>
<dependency org="yourorg" name="yourmodule3" rev="3.1" conf="myconf1->yourconf1, yourconf2"/>
<dependency org="yourorg" name="yourmodule4" rev="4.1" conf="myconf1, myconf2->yourconf1, yourconf2"/>
<dependency org="yourorg" name="yourmodule5" rev="5.1" conf="myconf1->yourconf1;myconf2->yourconf1, yourconf2"/>
<dependency org="yourorg" name="yourmodule6" rev="latest.integration">
<conf name="${myvar}" mapped="${targetconf}"/>
<conf name="myconf2" mapped="yourconf1, yourconf2"/>
</dependency>
<dependency org="yourorg" name="yourmodule7" rev="7.1">
<conf name="myconf1">
<mapped name="yourconf1"/>
</conf>
<conf name="myconf2">
<mapped name="yourconf1"/>
<mapped name="yourconf2"/>
</conf>
</dependency>
<dependency org="yourorg" name="yourmodule8" rev="8.1">
<artifact name="yourartifact8-1" type="jar"/>
<artifact name="yourartifact8-2" type="jar"/>
</dependency>
<dependency org="yourorg" name="yourmodule9" rev="9.1" conf="myconf1,myconf2,myconf3->default">
<artifact name="${art9-1}" type="${mytype}" conf="${myvar},myconf2"/>
<artifact name="yourartifact9-2" type="jar">
<conf name="myconf2"/>
<conf name="${conf3}"/>
</artifact>
</dependency>
<dependency org="yourorg" name="yourmodule10" rev="10.1">
<include name="${includename}" type="${mytype}"/>
<include ext="${includeext}"/>
<exclude name="${excludename}"/>
</dependency>
<dependency org="yourorg" name="yourmodule11" rev="11.1" conf="*->@"/>
<exclude module="${excludemodule}" matcher="${excludematcher}" conf="${myvar}"/>
<exclude org="${excludeorg}" module="test" artifact="${excludeartifact}" type="${excludetype}" ext="jar"/>
<override org="yourorg" module=".*1" matcher="regexp" branch="BRANCH" rev="1.0"/>
<conflict org="${yourorg}" module="${yourmodule}" matcher="${regexp}" manager="${all}"/>
<conflict org="theirorg" module="theirmodule1" rev="${theirrev}"/>
</dependencies>
</ivy-module>
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="http://www.somesite.com/ivy-doc.xsl"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!-- A comment before the first tag -->
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://incubator.apache.org/ivy/schemas/ivy.xsd" xmlns:e="http://ant.apache.org/ivy/extra">
<!-- A comment with accent é & special characters -->
<info organisation="${myorg}"
module="${mymodule}"
revision="${myrev}"
status="${mystatus}"
e:myextra="myval"
publication="{mypubdate}">
<license name="${mylicense}" url="${mylicenseurl}"/>
<ivyauthor name="jayasoft" url="http://www.jayasoft.org/"/>
<ivyauthor name="${myorg}" url="${myorgurl}"/>
<repository name="${ivyrep}" url="${ivyrepurl}" pattern="${ivyreppattern}" ivys="${ivys}" artifacts="${artifacts}"/>
<description homepage="${homepage}">
This module is <b>great</b> !<br/>
You can use it especially with myconf1 &amp; myconf2, and myconf4 is not too bad too.
</description>
</info>
<configurations>
<include file="${includefile}"/>
<conf name="${myvar}" description="${mydesc}"/>
<conf name="myconf2" description="desc 2" visibility="${visibility}"/>
<conf name="myconf3" description="desc 3" visibility="private"/>
<conf name="myconf4" description="desc 4" extends="${myvar}, myconf2"/>
<conf name="myoldconf" description="my old desc" deprecated="${deprecated}"/>
</configurations>
<publications>
<artifact name="${myartifact1}" type="${mytype}"/>
<artifact name="myartifact2" type="jar" conf="${myvar}"/>
<artifact name="myartifact3" type="jar" conf="myconf1, myconf2, myconf3"/>
<artifact name="myartifact4" type="jar">
<conf name="${myvar}"/>
<conf name="myconf3"/>
</artifact>
</publications>
<dependencies>
<dependency name="${mymodule2}" rev="${mymodule2rev}"/>
<dependency name="mymodule3" rev="2.0" changing="${changing}" transitive="${transitive}"/>
<dependency org="yourorg" name="yourmodule1" branch="trunk" rev="1.1" branchConstraint="branch1" revConstraint="1+" conf="${myvar}"/>
<dependency org="yourorg" name="yourmodule2" branch="branch1" rev="2+" conf="myconf1->yourconf1"/>
<dependency org="yourorg" name="yourmodule3" rev="3.1" conf="myconf1->yourconf1, yourconf2"/>
<dependency org="yourorg" name="yourmodule4" rev="4.1" conf="myconf1, myconf2->yourconf1, yourconf2"/>
<dependency org="yourorg" name="yourmodule5" rev="5.1" conf="myconf1->yourconf1;myconf2->yourconf1, yourconf2"/>
<dependency org="yourorg" name="yourmodule6" rev="latest.integration">
<conf name="${myvar}" mapped="${targetconf}"/>
<conf name="myconf2" mapped="yourconf1, yourconf2"/>
</dependency>
<dependency org="yourorg" name="yourmodule7" rev="7.1">
<conf name="myconf1">
<mapped name="yourconf1"/>
</conf>
<conf name="myconf2">
<mapped name="yourconf1"/>
<mapped name="yourconf2"/>
</conf>
</dependency>
<dependency org="yourorg" name="yourmodule8" rev="8.1">
<artifact name="yourartifact8-1" type="jar"/>
<artifact name="yourartifact8-2" type="jar"/>
</dependency>
<dependency org="yourorg" name="yourmodule9" rev="9.1" conf="myconf1,myconf2,myconf3->default">
<artifact name="${art9-1}" type="${mytype}" conf="${myvar},myconf2"/>
<artifact name="yourartifact9-2" type="jar">
<conf name="myconf2"/>
<conf name="${conf3}"/>
</artifact>
</dependency>
<dependency org="yourorg" name="yourmodule10" rev="10.1">
<include name="${includename}" type="${mytype}"/>
<include ext="${includeext}"/>
<exclude name="${excludename}"/>
</dependency>
<dependency org="yourorg" name="yourmodule11" rev="11.1" conf="*->@"/>
<exclude module="${excludemodule}" matcher="${excludematcher}" conf="${myvar}"/>
<exclude org="${excludeorg}" module="test" artifact="${excludeartifact}" type="${excludetype}" ext="jar"/>
<override org="yourorg" module=".*1" matcher="regexp" branch="BRANCH" rev="1.0"/>
<conflict org="${yourorg}" module="${yourmodule}" matcher="${regexp}" manager="${all}"/>
<conflict org="theirorg" module="theirmodule1" rev="${theirrev}"/>
</dependencies>
</ivy-module>

View File

@ -1,38 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg"
module="mymodule"
revision="1.0"
status="integration"
publication="20050913185628"
/>
<configurations>
<conf name="default" visibility="public"/>
</configurations>
<publications>
<artifact name="mymodule" type="jar" ext="jar" conf="default"/>
</publications>
<dependencies>
<dependency org="myorg" name="mod1" rev="1.0" conf="*->*"/><!-- dependency 1 -->
<dependency org="test" name="mod2" rev="2.0" conf="default->default"/><!-- dependency 2 -->
<dependency org="test" name="mod3" rev="2.0" conf="default->*"><!-- dependency 3 (IVY-888) --></dependency>
</dependencies>
</ivy-module>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="myorg"
module="mymodule"
revision="1.0"
status="integration"
publication="20050913185628"
/>
<configurations>
<conf name="default" visibility="public"/>
</configurations>
<publications>
<artifact name="mymodule" type="jar" ext="jar" conf="default"/>
</publications>
<dependencies>
<dependency org="myorg" name="mod1" rev="1.0" conf="*->*"/><!-- dependency 1 -->
<dependency org="test" name="mod2" rev="2.0" conf="default->default"/><!-- dependency 2 -->
<dependency org="test" name="mod3" rev="2.0" conf="default->*"><!-- dependency 3 (IVY-888) --></dependency>
</dependencies>
</ivy-module>

View File

@ -1,44 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="2.2">
<info organisation="myorg"
module="mymodule"
revision="working@localhost"
status="integration"
publication="20091206000000"
>
<extends organisation="myorg" module="myparent" revision="myrev" location="test-extends-parent.xml" extendType="all"/>
<description>
Parent module description.
</description>
</info>
<configurations>
<conf name="default" visibility="public"/>
<conf name="conf1" visibility="public"/>
<conf name="conf2" visibility="private"/>
</configurations>
<publications>
<artifact name="mymodule" type="jar" ext="jar" conf="default,conf1,conf2"/>
</publications>
<dependencies>
<dependency org="myorg" name="mymodule1" rev="1.0" conf="default->default"/>
<dependency org="myorg" name="mymodule2" rev="2.0" conf="conf1->conf1;conf2->conf2"/>
</dependencies>
</ivy-module>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="2.2">
<info organisation="myorg"
module="mymodule"
revision="working@localhost"
status="integration"
publication="20091206000000"
>
<extends organisation="myorg" module="myparent" revision="myrev" location="test-extends-parent.xml" extendType="all"/>
<description>
Parent module description.
</description>
</info>
<configurations>
<conf name="default" visibility="public"/>
<conf name="conf1" visibility="public"/>
<conf name="conf2" visibility="private"/>
</configurations>
<publications>
<artifact name="mymodule" type="jar" ext="jar" conf="default,conf1,conf2"/>
</publications>
<dependencies>
<dependency org="myorg" name="mymodule1" rev="1.0" conf="default->default"/>
<dependency org="myorg" name="mymodule2" rev="2.0" conf="conf1->conf1;conf2->conf2"/>
</dependencies>
</ivy-module>

View File

@ -1,38 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="2.0">
<info organisation="myorg"
module="mymodule"
revision="NONE"
status="integration"
publication="20050501110000"
>
<license name="Apache Sofware License" url="http://www.apache.org/licenses/LICENSE-2.0.txt" />
<description homepage="http://myorg.com/mymodule">
My module description.
</description>
</info>
<configurations>
<conf name="default" visibility="public"/>
</configurations>
<publications>
<artifact name="mymodule" type="jar" ext="jar" conf="default"/>
</publications>
</ivy-module>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="2.0">
<info organisation="myorg"
module="mymodule"
revision="NONE"
status="integration"
publication="20050501110000"
>
<license name="Apache Sofware License" url="http://www.apache.org/licenses/LICENSE-2.0.txt" />
<description homepage="http://myorg.com/mymodule">
My module description.
</description>
</info>
<configurations>
<conf name="default" visibility="public"/>
</configurations>
<publications>
<artifact name="mymodule" type="jar" ext="jar" conf="default"/>
</publications>
</ivy-module>

View File

@ -1,25 +1,25 @@
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="apache"
module="ivy-635" />
<dependencies>
<dependency org="apache" name="mod1" rev="1.0" />
</dependencies>
</ivy-module>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<ivy-module version="1.0">
<info organisation="apache"
module="ivy-635" />
<dependencies>
<dependency org="apache" name="mod1" rev="1.0" />
</dependencies>
</ivy-module>

View File

@ -1,41 +1,41 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.resolver.util;
import java.io.File;
import java.util.Arrays;
import org.apache.ivy.plugins.repository.file.FileRepository;
import junit.framework.TestCase;
public class ResolverHelperTest extends TestCase {
public void testListTokenValuesForIvy1238() {
FileRepository rep = new FileRepository(new File(".").getAbsoluteFile());
String[] revisions = ResolverHelper.listTokenValues(rep, "test/repositories/IVY-1238/ivy-org/modA/v[revision]/ivy.xml", "revision");
assertNotNull(revisions);
assertEquals(2, revisions.length);
Arrays.sort(revisions);
assertEquals("1.0", revisions[0]);
assertEquals("2.0", revisions[1]);
}
}
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.ivy.plugins.resolver.util;
import java.io.File;
import java.util.Arrays;
import org.apache.ivy.plugins.repository.file.FileRepository;
import junit.framework.TestCase;
public class ResolverHelperTest extends TestCase {
public void testListTokenValuesForIvy1238() {
FileRepository rep = new FileRepository(new File(".").getAbsoluteFile());
String[] revisions = ResolverHelper.listTokenValues(rep, "test/repositories/IVY-1238/ivy-org/modA/v[revision]/ivy.xml", "revision");
assertNotNull(revisions);
assertEquals(2, revisions.length);
Arrays.sort(revisions);
assertEquals("1.0", revisions[0]);
assertEquals("2.0", revisions[1]);
}
}

Some files were not shown because too many files have changed in this diff Show More