IVY-55: accept organization as token

git-svn-id: https://svn.apache.org/repos/asf/incubator/ivy/trunk@484011 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Xavier Hanin 2005-07-15 05:44:51 +00:00
parent fb360bfce8
commit c08c2aa005
3 changed files with 29 additions and 0 deletions

View File

@ -1,3 +1,4 @@
- accept organization as token (IVY-55)
- added type filtering mechanism on resolve task (IVY-45)
- detect and warn about resolver using ivy cache as repository (IVY-53)
- new transitive attribute on dependency, which enable to disable transitive dependency

View File

@ -25,6 +25,7 @@ public class IvyPatternHelper {
public static final String REVISION_KEY = "revision";
public static final String MODULE_KEY = "module";
public static final String ORGANISATION_KEY = "organisation";
public static final String ORGANISATION_KEY2 = "organization";
private static final Pattern VAR_PATTERN = Pattern.compile("\\$\\{(.*?)\\}");
private static final Pattern TOKEN_PATTERN = Pattern.compile("\\[(.*?)\\]");
@ -67,6 +68,7 @@ public class IvyPatternHelper {
public static String substitute(String pattern, String org, String module, String revision, String artifact, String type, String ext, String conf) {
Map tokens = new HashMap();
tokens.put(ORGANISATION_KEY, org==null?"":org);
tokens.put(ORGANISATION_KEY2, org==null?"":org);
tokens.put(MODULE_KEY, module==null?"":module);
tokens.put(REVISION_KEY, revision==null?"":revision);
tokens.put(ARTIFACT_KEY, artifact==null?module:artifact);

View File

@ -0,0 +1,26 @@
/*
* This file is subject to the licence found in LICENCE.TXT in the root directory of the project.
* Copyright Jayasoft 2005 - All rights reserved
*
* #SNAPSHOT#
*/
package fr.jayasoft.ivy.util;
import junit.framework.TestCase;
public class IvyPatternHelperTest extends TestCase {
public void testSubstitute() {
String pattern = "[organisation]/[module]/build/archives/[type]s/[artifact]-[revision].[ext]";
assertEquals(
"jayasoft/Test/build/archives/jars/test-1.0.jar",
IvyPatternHelper.substitute(pattern, "jayasoft", "Test", "1.0", "test", "jar", "jar"));
}
public void testOrganization() {
String pattern = "[organization]/[module]/build/archives/[type]s/[artifact]-[revision].[ext]";
assertEquals(
"jayasoft/Test/build/archives/jars/test-1.0.jar",
IvyPatternHelper.substitute(pattern, "jayasoft", "Test", "1.0", "test", "jar", "jar"));
}
}