You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by jl...@apache.org on 2014/01/14 09:27:43 UTC
svn commit: r1557968 [17/26] - in /ant/ivy/core/trunk:
src/java/org/apache/ivy/ src/java/org/apache/ivy/ant/
src/java/org/apache/ivy/core/ src/java/org/apache/ivy/core/cache/
src/java/org/apache/ivy/core/check/ src/java/org/apache/ivy/core/deliver/
src...
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/HttpClientHandler.java Tue Jan 14 08:27:37 2014
@@ -101,10 +101,10 @@ public class HttpClientHandler extends A
throw new IOException("The HTTP response code for " + url
+ " did not indicate a success." + " See log for more detail.");
}
-
+
Header encoding = get.getResponseHeader("Content-Encoding");
return getDecodingInputStream(encoding == null ? null : encoding.getValue(),
- get.getResponseBodyAsStream());
+ get.getResponseBodyAsStream());
}
public void download(URL src, File dest, CopyProgressListener l) throws IOException {
@@ -115,10 +115,10 @@ public class HttpClientHandler extends A
throw new IOException("The HTTP response code for " + src
+ " did not indicate a success." + " See log for more detail.");
}
-
+
Header encoding = get.getResponseHeader("Content-Encoding");
InputStream is = getDecodingInputStream(encoding == null ? null : encoding.getValue(),
- get.getResponseBodyAsStream());
+ get.getResponseBodyAsStream());
FileUtil.copy(is, dest, l);
dest.setLastModified(getLastModified(get));
} finally {
@@ -154,8 +154,8 @@ public class HttpClientHandler extends A
method = doGet(url, timeout);
}
if (checkStatusCode(url, method)) {
- return new URLInfo(true, getResponseContentLength(method),
- getLastModified(method), method.getRequestCharSet());
+ return new URLInfo(true, getResponseContentLength(method), getLastModified(method),
+ method.getRequestCharSet());
}
} catch (HttpException e) {
Message.error("HttpClientHandler: " + e.getMessage() + ":" + e.getReasonCode() + "="
@@ -182,12 +182,12 @@ public class HttpClientHandler extends A
if (status == HttpStatus.SC_OK) {
return true;
}
-
+
// IVY-1328: some servers return a 204 on a HEAD request
if ("HEAD".equals(method.getName()) && (status == 204)) {
return true;
}
-
+
Message.debug("HTTP response status: " + status + " url=" + url);
if (status == HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED) {
Message.warn("Your proxy requires authentication.");
@@ -269,8 +269,7 @@ public class HttpClientHandler extends A
private HttpClient getClient() {
if (httpClient == null) {
- final MultiThreadedHttpConnectionManager connManager =
- new MultiThreadedHttpConnectionManager();
+ final MultiThreadedHttpConnectionManager connManager = new MultiThreadedHttpConnectionManager();
httpClient = new HttpClient(connManager);
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@@ -299,8 +298,8 @@ public class HttpClientHandler extends A
"Apache Ivy/" + Ivy.getIvyVersion());
// authentication
- httpClient.getParams().setParameter(CredentialsProvider.PROVIDER,
- new IvyCredentialsProvider());
+ httpClient.getParams().setParameter(CredentialsProvider.PROVIDER,
+ new IvyCredentialsProvider());
}
return httpClient;
@@ -367,27 +366,27 @@ public class HttpClientHandler extends A
int getHttpClientMajorVersion();
}
-
+
private static class IvyCredentialsProvider implements CredentialsProvider {
public Credentials getCredentials(AuthScheme scheme, String host, int port, boolean proxy)
throws CredentialsNotAvailableException {
String realm = scheme.getRealm();
-
- org.apache.ivy.util.Credentials c = (org.apache.ivy.util.Credentials)
- CredentialsStore.INSTANCE.getCredentials(realm, host);
+
+ org.apache.ivy.util.Credentials c = (org.apache.ivy.util.Credentials) CredentialsStore.INSTANCE
+ .getCredentials(realm, host);
if (c != null) {
return createCredentials(c.getUserName(), c.getPasswd());
}
-
+
return null;
}
}
-
+
private static Credentials createCredentials(String username, String password) {
String user;
String domain;
-
+
int backslashIndex = username.indexOf('\\');
if (backslashIndex >= 0) {
user = username.substring(backslashIndex + 1);
@@ -396,13 +395,13 @@ public class HttpClientHandler extends A
user = username;
domain = System.getProperty("http.auth.ntlm.domain", "");
}
-
+
return new NTCredentials(user, password, HostUtil.getLocalHostName(), domain);
}
-
+
private static class FileRequestEntity implements RequestEntity {
private File file;
-
+
public FileRequestEntity(File file) {
this.file = file;
}
@@ -426,7 +425,7 @@ public class HttpClientHandler extends A
} finally {
instream.close();
}
- }
+ }
}
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/IvyAuthenticator.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/IvyAuthenticator.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/IvyAuthenticator.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/IvyAuthenticator.java Tue Jan 14 08:27:37 2014
@@ -31,33 +31,33 @@ import org.apache.ivy.util.Message;
public final class IvyAuthenticator extends Authenticator {
private Authenticator original;
-
+
private static boolean securityWarningLogged = false;
-
+
/**
* Private c'tor to prevent instantiation.
*/
private IvyAuthenticator(Authenticator original) {
this.original = original;
}
-
+
/**
- * Installs an <tt>IvyAuthenticator</tt> as default <tt>Authenticator</tt>.
- * Call this method before opening HTTP(S) connections to enable Ivy
- * authentication.
+ * Installs an <tt>IvyAuthenticator</tt> as default <tt>Authenticator</tt>. Call this method
+ * before opening HTTP(S) connections to enable Ivy authentication.
*/
public static void install() {
- // We will try to use the original authenticator as backup authenticator.
- // Since there is no getter available, so try to use some reflection to
+ // We will try to use the original authenticator as backup authenticator.
+ // Since there is no getter available, so try to use some reflection to
// obtain it. If that doesn't work, assume there is no original authenticator
Authenticator original = null;
-
+
try {
Field f = Authenticator.class.getDeclaredField("theAuthenticator");
f.setAccessible(true);
original = (Authenticator) f.get(null);
} catch (Throwable t) {
- Message.debug("Error occurred while getting the original authenticator: " + t.getMessage());
+ Message.debug("Error occurred while getting the original authenticator: "
+ + t.getMessage());
}
if (!(original instanceof IvyAuthenticator)) {
@@ -66,8 +66,8 @@ public final class IvyAuthenticator exte
} catch (SecurityException e) {
if (!securityWarningLogged) {
securityWarningLogged = true;
- Message.warn("Not enough permissions to set the IvyAuthenticator. " +
- "HTTP(S) authentication will be disabled!");
+ Message.warn("Not enough permissions to set the IvyAuthenticator. "
+ + "HTTP(S) authentication will be disabled!");
}
}
}
@@ -79,7 +79,7 @@ public final class IvyAuthenticator exte
protected PasswordAuthentication getPasswordAuthentication() {
PasswordAuthentication result = null;
-
+
if (isProxyAuthentication()) {
String proxyUser = System.getProperty("http.proxyUser");
if ((proxyUser != null) && (proxyUser.trim().length() > 0)) {
@@ -91,33 +91,32 @@ public final class IvyAuthenticator exte
Credentials c = CredentialsStore.INSTANCE.getCredentials(getRequestingPrompt(),
getRequestingHost());
Message.debug("authentication: k='"
- + Credentials.buildKey(getRequestingPrompt(), getRequestingHost()) + "' c='" + c
- + "'");
+ + Credentials.buildKey(getRequestingPrompt(), getRequestingHost()) + "' c='"
+ + c + "'");
if (c != null) {
final String password = c.getPasswd() == null ? "" : c.getPasswd();
result = new PasswordAuthentication(c.getUserName(), password.toCharArray());
}
}
-
+
if ((result == null) && (original != null)) {
Authenticator.setDefault(original);
try {
- result = Authenticator.requestPasswordAuthentication(getRequestingHost(),
- getRequestingSite(), getRequestingPort(), getRequestingProtocol(),
- getRequestingPrompt(), getRequestingScheme());
+ result = Authenticator.requestPasswordAuthentication(getRequestingHost(),
+ getRequestingSite(), getRequestingPort(), getRequestingProtocol(),
+ getRequestingPrompt(), getRequestingScheme());
} finally {
Authenticator.setDefault(this);
}
}
-
+
return result;
}
-
+
/**
- * Checks if the current authentication request is for the proxy server.
- * This functionality is not available in JDK1.4, so we check this in a
- * very dirty way which is probably not very portable, but will work for
- * the SUN 1.4 JDKs.
+ * Checks if the current authentication request is for the proxy server. This functionality is
+ * not available in JDK1.4, so we check this in a very dirty way which is probably not very
+ * portable, but will work for the SUN 1.4 JDKs.
*
* @return
*/
@@ -130,12 +129,13 @@ public final class IvyAuthenticator exte
} catch (NoSuchMethodException e) {
// do nothing, this is a JDK1.5+ method
} catch (Throwable t) {
- Message.debug("Error occurred while checking if the authentication request is for the proxy server: " + t.getMessage());
+ Message.debug("Error occurred while checking if the authentication request is for the proxy server: "
+ + t.getMessage());
}
-
+
// now we will do something very dirty and analyse the stack trace to see
// if this method is called from within the 'getHttpProxyAuthentication' method
- // or the 'getServerAuthentication' method which are both part of the
+ // or the 'getServerAuthentication' method which are both part of the
// sun.net.www.protocol.http.HttpURLConnection class.
// This might not work on other 1.4 JVM's!
// This code should be removed when Ivy requires JDK1.5+
@@ -148,7 +148,7 @@ public final class IvyAuthenticator exte
return false;
}
}
-
+
// fallback to the Ivy 2.2.0 behavior
String proxyHost = System.getProperty("http.proxyHost");
return getRequestingHost().equals(proxyHost);
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/URLHandler.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/URLHandler.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/URLHandler.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/URLHandler.java Tue Jan 14 08:27:37 2014
@@ -29,7 +29,7 @@ import org.apache.ivy.util.CopyProgressL
* check reachability, ...).
*/
public interface URLHandler {
-
+
/**
* Using the slower REQUEST method for getting the basic URL infos. Use this when getting errors
* behind a problematic/special proxy or firewall chain.
@@ -54,7 +54,8 @@ public interface URLHandler {
this(available, contentLength, lastModified, null);
}
- protected URLInfo(boolean available, long contentLength, long lastModified, String bodyCharset) {
+ protected URLInfo(boolean available, long contentLength, long lastModified,
+ String bodyCharset) {
this.available = available;
this.contentLength = contentLength;
this.lastModified = lastModified;
@@ -140,22 +141,25 @@ public interface URLHandler {
public long getLastModified(URL url, int timeout);
/**
- * Returns the URLInfo of the given url or a {@link #UNAVAILABLE} instance,
- * if the url is not reachable.
+ * Returns the URLInfo of the given url or a {@link #UNAVAILABLE} instance, if the url is not
+ * reachable.
*
- * @param url The url from which information is retrieved.
- * @return The URLInfo extracted from the given url, or {@link #UNAVAILABLE} when
- * the url is not available.
+ * @param url
+ * The url from which information is retrieved.
+ * @return The URLInfo extracted from the given url, or {@link #UNAVAILABLE} when the url is not
+ * available.
*/
public URLInfo getURLInfo(URL url);
/**
* never returns null, return UNAVAILABLE when url is not reachable
*
- * @param url The url from which information is retrieved.
- * @param timeout The timeout in milliseconds.
- * @return The URLInfo extracted from the given url, or {@link #UNAVAILABLE} when
- * the url is not available.
+ * @param url
+ * The url from which information is retrieved.
+ * @param timeout
+ * The timeout in milliseconds.
+ * @return The URLInfo extracted from the given url, or {@link #UNAVAILABLE} when the url is not
+ * available.
*/
public URLInfo getURLInfo(URL url, int timeout);
@@ -164,6 +168,6 @@ public interface URLHandler {
public void download(URL src, File dest, CopyProgressListener l) throws IOException;
public void upload(File src, URL dest, CopyProgressListener l) throws IOException;
-
+
public void setRequestMethod(int requestMethod);
}
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/URLHandlerDispatcher.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/URLHandlerDispatcher.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/URLHandlerDispatcher.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/URLHandlerDispatcher.java Tue Jan 14 08:27:37 2014
@@ -81,7 +81,7 @@ public class URLHandlerDispatcher implem
public void upload(File src, URL dest, CopyProgressListener l) throws IOException {
getHandler(dest.getProtocol()).upload(src, dest, l);
}
-
+
public void setRequestMethod(int requestMethod) {
defaultHandler.setRequestMethod(requestMethod);
for (Iterator it = handlers.values().iterator(); it.hasNext();) {
Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/URLHandlerRegistry.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/URLHandlerRegistry.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/URLHandlerRegistry.java (original)
+++ ant/ivy/core/trunk/src/java/org/apache/ivy/util/url/URLHandlerRegistry.java Tue Jan 14 08:27:37 2014
@@ -25,7 +25,7 @@ import org.apache.ivy.util.Message;
public final class URLHandlerRegistry {
private URLHandlerRegistry() {
}
-
+
private static URLHandler defaultHandler = new BasicURLHandler();
public static URLHandler getDefault() {
@@ -45,11 +45,11 @@ public final class URLHandlerRegistry {
public static URLHandler getHttp() {
try {
Class.forName("org.apache.commons.httpclient.HttpClient");
-
- // temporary fix for IVY-880: only use HttpClientHandler when
+
+ // temporary fix for IVY-880: only use HttpClientHandler when
// http-client-3.x is available
Class.forName("org.apache.commons.httpclient.params.HttpClientParams");
-
+
Class handler = Class.forName("org.apache.ivy.util.url.HttpClientHandler");
Message.verbose("jakarta commons httpclient detected: using it for http downloading");
return (URLHandler) handler.newInstance();
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/IvyTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/IvyTest.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/IvyTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/IvyTest.java Tue Jan 14 08:27:37 2014
@@ -48,23 +48,23 @@ public class IvyTest extends TestCase {
public void testMultipleInstances() throws Exception {
// this test checks that IvyContext is properly set and unset when using multiple instances
// of Ivy. We also check logging, because it heavily relies on IvyContext.
-
+
// we start by loading one ivy instance and using it to resolve some dependencies
MockMessageLogger mockLogger = new MockMessageLogger();
Ivy ivy = Ivy.newInstance();
ivy.getLoggerEngine().setDefaultLogger(mockLogger);
ivy.configure(new File("test/repositories/ivysettings.xml"));
- assertFalse("IvyContext should be cleared and return a default Ivy instance",
- IvyContext.getContext().getIvy() == ivy);
-
+ assertFalse("IvyContext should be cleared and return a default Ivy instance", IvyContext
+ .getContext().getIvy() == ivy);
+
ResolveReport report = ivy.resolve(new File(
- "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"),
+ "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"),
getResolveOptions(ivy, new String[] {"*"}));
assertNotNull(report);
assertFalse(report.hasError());
mockLogger.assertLogContains("mod1.1");
- assertFalse("IvyContext should be cleared and return a default Ivy instance",
- IvyContext.getContext().getIvy() == ivy);
+ assertFalse("IvyContext should be cleared and return a default Ivy instance", IvyContext
+ .getContext().getIvy() == ivy);
// then we load another instance, and use it for another resolution
MockMessageLogger mockLogger2 = new MockMessageLogger();
@@ -76,18 +76,17 @@ public class IvyTest extends TestCase {
assertNotNull(report);
assertFalse(report.hasError());
mockLogger2.assertLogContains("norev/ivysettings.xml");
- assertFalse("IvyContext should be cleared and return a default Ivy instance",
- IvyContext.getContext().getIvy() == ivy2);
-
+ assertFalse("IvyContext should be cleared and return a default Ivy instance", IvyContext
+ .getContext().getIvy() == ivy2);
+
// finally we reuse the first instance to make another resolution
- report = ivy.resolve(new File(
- "test/repositories/1/org6/mod6.1/ivys/ivy-0.3.xml"),
+ report = ivy.resolve(new File("test/repositories/1/org6/mod6.1/ivys/ivy-0.3.xml"),
getResolveOptions(ivy, new String[] {"extension"}));
assertNotNull(report);
assertFalse(report.hasError());
mockLogger.assertLogContains("mod6.1");
- assertFalse("IvyContext should be cleared and return a default Ivy instance",
- IvyContext.getContext().getIvy() == ivy);
+ assertFalse("IvyContext should be cleared and return a default Ivy instance", IvyContext
+ .getContext().getIvy() == ivy);
}
private ResolveOptions getResolveOptions(Ivy ivy, String[] confs) {
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/MainTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/MainTest.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/MainTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/MainTest.java Tue Jan 14 08:27:37 2014
@@ -50,7 +50,7 @@ public class MainTest extends TestCase {
assertEquals("Unrecognized option: -bad", ex.getMessage());
}
}
-
+
public void testMissingParameter() throws Exception {
try {
run(new String[] {"-ivy"});
@@ -59,40 +59,29 @@ public class MainTest extends TestCase {
assertEquals("no argument for: ivy", ex.getMessage());
}
}
-
+
public void testResolveSimple() throws Exception {
- run(new String[] {
- "-settings", "test/repositories/ivysettings.xml",
- "-ivy", "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"
- });
+ run(new String[] {"-settings", "test/repositories/ivysettings.xml", "-ivy",
+ "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"});
assertTrue(new File("build/cache/org1/mod1.2/ivy-2.0.xml").exists());
}
-
+
public void testResolveSimpleWithConfs() throws Exception {
- run(new String[] {
- "-settings", "test/repositories/ivysettings.xml",
- "-ivy", "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml",
- "-confs", "default"
- });
+ run(new String[] {"-settings", "test/repositories/ivysettings.xml", "-ivy",
+ "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml", "-confs", "default"});
assertTrue(new File("build/cache/org1/mod1.2/ivy-2.0.xml").exists());
}
-
+
public void testResolveSimpleWithConfs2() throws Exception {
- run(new String[] {
- "-settings", "test/repositories/ivysettings.xml",
- "-confs", "default",
- "-ivy", "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"
- });
+ run(new String[] {"-settings", "test/repositories/ivysettings.xml", "-confs", "default",
+ "-ivy", "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"});
assertTrue(new File("build/cache/org1/mod1.2/ivy-2.0.xml").exists());
}
-
+
public void testExtraParams1() throws Exception {
- String[] params = new String[] {
- "-settings", "test/repositories/ivysettings.xml",
- "-confs", "default",
- "-ivy", "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml",
- "foo1", "foo2"
- };
+ String[] params = new String[] {"-settings", "test/repositories/ivysettings.xml", "-confs",
+ "default", "-ivy", "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml", "foo1",
+ "foo2"};
CommandLine line = Main.getParser().parse(params);
String[] leftOver = line.getLeftOverArgs();
assertNotNull(leftOver);
@@ -102,12 +91,9 @@ public class MainTest extends TestCase {
}
public void testExtraParams2() throws Exception {
- String[] params = new String[] {
- "-settings", "test/repositories/ivysettings.xml",
- "-confs", "default",
- "-ivy", "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml",
- "--", "foo1", "foo2"
- };
+ String[] params = new String[] {"-settings", "test/repositories/ivysettings.xml", "-confs",
+ "default", "-ivy", "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml", "--",
+ "foo1", "foo2"};
CommandLine line = Main.getParser().parse(params);
String[] leftOver = line.getLeftOverArgs();
assertNotNull(leftOver);
@@ -117,11 +103,8 @@ public class MainTest extends TestCase {
}
public void testExtraParams3() throws Exception {
- String[] params = new String[] {
- "-settings", "test/repositories/ivysettings.xml",
- "-confs", "default",
- "-ivy", "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"
- };
+ String[] params = new String[] {"-settings", "test/repositories/ivysettings.xml", "-confs",
+ "default", "-ivy", "test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"};
CommandLine line = Main.getParser().parse(params);
String[] leftOver = line.getLeftOverArgs();
assertNotNull(leftOver);
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/TestFixture.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/TestFixture.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/TestFixture.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/TestFixture.java Tue Jan 14 08:27:37 2014
@@ -34,7 +34,8 @@ import org.apache.ivy.plugins.resolver.u
/**
* Fixture easing the development of tests requiring to set up a simple repository with some
- * modules, using micro ivy format to describe the repository. <br/> Example of use:
+ * modules, using micro ivy format to describe the repository. <br/>
+ * Example of use:
*
* <pre>
* public class MyTest extends TestCase {
@@ -48,24 +49,21 @@ import org.apache.ivy.plugins.resolver.u
* protected void tearDown() throws Exception {
* fixture.clean();
* }
- *
+ *
* public void testXXX() throws Exception {
- * fixture
- * .addMD("#A;1-> { #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();
- * ResolveReport r = fixture.resolve("#A;1");
- * // assertions go here
+ * fixture.addMD("#A;1-> { #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();
+ * ResolveReport r = fixture.resolve("#A;1");
+ * // assertions go here
* }
* }
* </pre>
*/
public class TestFixture {
-
+
private Collection mds = new ArrayList();
+
private Ivy ivy;
public TestFixture() {
@@ -80,12 +78,12 @@ public class TestFixture {
throw new RuntimeException(e);
}
}
-
+
public TestFixture addMD(String microIvy) {
mds.add(TestHelper.parseMicroIvyDescriptor(microIvy));
return this;
}
-
+
public TestFixture init() throws IOException {
TestHelper.fillRepository(getTestRepository(), mds);
return this;
@@ -98,28 +96,28 @@ public class TestFixture {
public IvySettings getSettings() {
return ivy.getSettings();
}
-
+
public Ivy getIvy() {
return ivy;
}
-
+
public void clean() {
TestHelper.cleanTest();
}
public File getIvyFile(String mrid) {
ResolvedResource r = getTestRepository().findIvyFileRef(
- new DefaultDependencyDescriptor(ModuleRevisionId.parse(mrid), false),
+ new DefaultDependencyDescriptor(ModuleRevisionId.parse(mrid), false),
TestHelper.newResolveData(getSettings()));
if (r == null) {
- throw new IllegalStateException("module not found: "+mrid);
+ throw new IllegalStateException("module not found: " + mrid);
}
return ((FileResource) r.getResource()).getFile();
}
- public ResolveReport resolve(String mrid)
- throws MalformedURLException, ParseException, IOException {
+ public ResolveReport resolve(String mrid) throws MalformedURLException, ParseException,
+ IOException {
return ivy.resolve(getIvyFile(mrid), TestHelper.newResolveOptions(getSettings()));
}
-
+
}
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/TestHelper.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/TestHelper.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/TestHelper.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/TestHelper.java Tue Jan 14 08:27:37 2014
@@ -49,36 +49,34 @@ import org.apache.ivy.util.FileUtil;
public class TestHelper {
- public static DefaultArtifact newArtifact(
- String organisation, String module, String revision,
+ public static DefaultArtifact newArtifact(String organisation, String module, String revision,
String artifact, String type, String ext) {
- return new DefaultArtifact(ModuleRevisionId.newInstance(
- organisation, module, revision), new Date(), artifact, type, ext);
+ return new DefaultArtifact(ModuleRevisionId.newInstance(organisation, module, revision),
+ new Date(), artifact, type, ext);
}
-
- public static File getArchiveFileInCache(Ivy ivy, String mrid,
- String artifactName, String type, String ext) {
- DefaultArtifact artifact = new DefaultArtifact(ModuleRevisionId.parse(mrid),
- new Date(), artifactName, type, ext);
+ public static File getArchiveFileInCache(Ivy ivy, String mrid, String artifactName,
+ String type, String ext) {
+ DefaultArtifact artifact = new DefaultArtifact(ModuleRevisionId.parse(mrid), new Date(),
+ artifactName, type, ext);
return getRepositoryCacheManager(ivy, artifact.getModuleRevisionId())
- .getArchiveFileInCache(artifact);
+ .getArchiveFileInCache(artifact);
}
- public static File getArchiveFileInCache(Ivy ivy, String organisation, String module,
+ public static File getArchiveFileInCache(Ivy ivy, String organisation, String module,
String revision, String artifactName, String type, String ext) {
- DefaultArtifact artifact = newArtifact(organisation, module, revision,
- artifactName, type, ext);
+ DefaultArtifact artifact = newArtifact(organisation, module, revision, artifactName, type,
+ ext);
return getRepositoryCacheManager(ivy, artifact.getModuleRevisionId())
- .getArchiveFileInCache(artifact);
+ .getArchiveFileInCache(artifact);
}
-
- public static DefaultRepositoryCacheManager getRepositoryCacheManager(Ivy ivy, ModuleRevisionId id) {
+ public static DefaultRepositoryCacheManager getRepositoryCacheManager(Ivy ivy,
+ ModuleRevisionId id) {
// WARN: this doesn't work if the resolver registered is a compound resolver (chain or dual)
// and a sub resolver doesn't use the same cache manager as the parent
- return (DefaultRepositoryCacheManager)
- ivy.getSettings().getResolver(id).getRepositoryCacheManager();
+ return (DefaultRepositoryCacheManager) ivy.getSettings().getResolver(id)
+ .getRepositoryCacheManager();
}
/**
@@ -115,10 +113,10 @@ public class TestHelper {
}
return c;
}
-
+
/**
- * Returns an array of {@link ModuleRevisionId} corresponding to the given comma separated list of
- * their text representation.
+ * Returns an array of {@link ModuleRevisionId} corresponding to the given comma separated list
+ * of their text representation.
*
* @param mrids
* the text representation of the {@link ModuleRevisionId}
@@ -128,53 +126,60 @@ public class TestHelper {
Collection parsedMrids = parseMrids(mrids);
return (ModuleRevisionId[]) parsedMrids.toArray(new ModuleRevisionId[parsedMrids.size()]);
}
-
+
/**
* Parses a string represenation of a module descriptor in micro ivy format.
* <p>
* Examples:
+ *
* <pre>
* #A;1
* </pre>
+ *
* <hr/>
+ *
* <pre>
* #A;2-> #B;[1.0,1.5]
* </pre>
+ *
* <hr/>
+ *
* <pre>
* #A;3-> { #B;[1.0,1.5] #C;[2.0,2.5] }
* </pre>
+ *
* </p>
*
- * @param microIvy the micro ivy description of the module descriptor
+ * @param microIvy
+ * the micro ivy description of the module descriptor
* @return the parsed module descriptor
*/
public static ModuleDescriptor parseMicroIvyDescriptor(String microIvy) {
Pattern mridPattern = ModuleRevisionId.NON_CAPTURING_PATTERN;
Matcher m = mridPattern.matcher(microIvy);
if (m.matches()) {
- return DefaultModuleDescriptor
- .newBasicInstance(ModuleRevisionId.parse(microIvy), new Date());
+ return DefaultModuleDescriptor.newBasicInstance(ModuleRevisionId.parse(microIvy),
+ new Date());
}
-
- Pattern oneDependencyPattern = Pattern.compile(
- "(" + mridPattern.pattern() + ")\\s*->\\s*(" + mridPattern.pattern() + ")");
+
+ Pattern oneDependencyPattern = Pattern.compile("(" + mridPattern.pattern() + ")\\s*->\\s*("
+ + mridPattern.pattern() + ")");
m = oneDependencyPattern.matcher(microIvy);
if (m.matches()) {
- DefaultModuleDescriptor md = DefaultModuleDescriptor
- .newBasicInstance(ModuleRevisionId.parse(m.group(1)), new Date());
- md.addDependency(new DefaultDependencyDescriptor(ModuleRevisionId.parse(m.group(2)), false));
+ DefaultModuleDescriptor md = DefaultModuleDescriptor.newBasicInstance(
+ ModuleRevisionId.parse(m.group(1)), new Date());
+ md.addDependency(new DefaultDependencyDescriptor(ModuleRevisionId.parse(m.group(2)),
+ false));
return md;
}
-
- String p = "(" + mridPattern.pattern() + ")\\s*->\\s*\\{\\s*((?:"
- + mridPattern.pattern() + ",?\\s+)*" + mridPattern.pattern() + ")?\\s*\\}";
- Pattern multipleDependenciesPattern = Pattern.compile(
- p);
+
+ String p = "(" + mridPattern.pattern() + ")\\s*->\\s*\\{\\s*((?:" + mridPattern.pattern()
+ + ",?\\s+)*" + mridPattern.pattern() + ")?\\s*\\}";
+ Pattern multipleDependenciesPattern = Pattern.compile(p);
m = multipleDependenciesPattern.matcher(microIvy);
if (m.matches()) {
- DefaultModuleDescriptor md = DefaultModuleDescriptor
- .newBasicInstance(ModuleRevisionId.parse(m.group(1)), new Date());
+ DefaultModuleDescriptor md = DefaultModuleDescriptor.newBasicInstance(
+ ModuleRevisionId.parse(m.group(1)), new Date());
String mrids = m.group(2);
if (mrids != null) {
Collection depMrids = parseMrids(mrids);
@@ -185,9 +190,9 @@ public class TestHelper {
}
return md;
}
- throw new IllegalArgumentException("invalid micro ivy format: "+microIvy);
+ throw new IllegalArgumentException("invalid micro ivy format: " + microIvy);
}
-
+
/**
* Parses a collection of module descriptors in the micro ivy format, separated by double semi
* columns.
@@ -196,7 +201,7 @@ public class TestHelper {
* the text representation of the collection of module descriptors
* @return the collection of module descriptors parsed
*/
- public static Collection/*<ModuleDescriptor>*/ parseMicroIvyDescriptors(String microIvy) {
+ public static Collection/* <ModuleDescriptor> */parseMicroIvyDescriptors(String microIvy) {
String[] mds = microIvy.split("\\s*;;\\s*");
Collection r = new ArrayList();
for (int i = 0; i < mds.length; i++) {
@@ -204,16 +209,19 @@ public class TestHelper {
}
return r;
}
-
+
/**
* Fills a repository with a set of module, using empty files for published artifacts.
*
- * @param resolver the resolver to use to publish the modules
- * @param mds the descriptors of the modules to put in the repository
- * @throws IOException if an IO problem occurs while filling the repository
+ * @param resolver
+ * the resolver to use to publish the modules
+ * @param mds
+ * the descriptors of the modules to put in the repository
+ * @throws IOException
+ * if an IO problem occurs while filling the repository
*/
- public static void fillRepository(
- DependencyResolver resolver, Collection/*<ModuleDescriptor>*/ mds) throws IOException {
+ public static void fillRepository(DependencyResolver resolver,
+ Collection/* <ModuleDescriptor> */mds) throws IOException {
File tmp = File.createTempFile("ivy", "tmp");
try {
for (Iterator iter = mds.iterator(); iter.hasNext();) {
@@ -242,7 +250,7 @@ public class TestHelper {
tmp.delete();
}
}
-
+
/**
* A file system resolver which can be used with the
* {@link #fillRepository(DependencyResolver, Collection)} method to create a test case of
@@ -255,30 +263,32 @@ public class TestHelper {
FileSystemResolver testRepository = new FileSystemResolver();
testRepository.setName("test");
String testRepoDir = new File("build/test/test-repo").getAbsolutePath();
- testRepository.addIvyPattern(
- testRepoDir + "/[organisation]/[module]/[revision]/[artifact].[ext]");
- testRepository.addArtifactPattern(
- testRepoDir + "/[organisation]/[module]/[revision]/[artifact].[ext]");
+ testRepository.addIvyPattern(testRepoDir
+ + "/[organisation]/[module]/[revision]/[artifact].[ext]");
+ testRepository.addArtifactPattern(testRepoDir
+ + "/[organisation]/[module]/[revision]/[artifact].[ext]");
return testRepository;
}
/**
* Cleans up the test repository.
+ *
* @see #newTestRepository()
*/
public static void cleanTestRepository() {
FileUtil.forceDelete(new File("build/test/test-repo"));
}
-
+
/**
* Cleans up the test repository and cache.
+ *
* @see #newTestSettings()
*/
public static void cleanTest() {
cleanTestRepository();
FileUtil.forceDelete(new File("build/test/cache"));
}
-
+
/**
* Init a test resolver as default, useful combined with
* {@link #fillRepository(DependencyResolver, Collection)}.
@@ -293,7 +303,7 @@ public class TestHelper {
settings.setDefaultResolver("test");
return settings;
}
-
+
/**
* Create basic resolve data using the given settings
*
@@ -302,9 +312,8 @@ public class TestHelper {
* @return basic resolve data useful for testing
*/
public static ResolveData newResolveData(IvySettings settings) {
- return new ResolveData(
- new ResolveEngine(settings, new EventManager(), new SortEngine(settings)),
- newResolveOptions(settings));
+ return new ResolveData(new ResolveEngine(settings, new EventManager(), new SortEngine(
+ settings)), newResolveOptions(settings));
}
/**
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/AntTestHelper.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/AntTestHelper.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/AntTestHelper.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/AntTestHelper.java Tue Jan 14 08:27:37 2014
@@ -21,7 +21,7 @@ import org.apache.tools.ant.DefaultLogge
import org.apache.tools.ant.Project;
public class AntTestHelper {
- // this is probably already available in some Ant class or helper...
+ // this is probably already available in some Ant class or helper...
public static Project newProject() {
Project project = new Project();
DefaultLogger logger = new DefaultLogger();
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileTest.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileTest.java Tue Jan 14 08:27:37 2014
@@ -21,11 +21,11 @@ import org.apache.ivy.core.report.Resolv
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");
@@ -33,7 +33,7 @@ public class IvyAntSettingsBuildFileTest
assertFalse(report.hasError());
assertEquals(1, report.getDependencies().size());
}
-
+
public void testOverrideSetToFalse() {
executeTarget("testOverrideSetToFalse");
ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
@@ -41,13 +41,13 @@ public class IvyAntSettingsBuildFileTest
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"));
+ assertNull("Default ivy.instance settings shouldn't have been loaded", getProject()
+ .getReference("ivy.instance"));
}
-
+
public void testSettingsWithIdIvyInstance() {
// IVY-925
executeTarget("testSettingsWithPropertyAsId");
@@ -56,7 +56,7 @@ public class IvyAntSettingsBuildFileTest
assertFalse(report.hasError());
assertEquals(1, report.getDependencies().size());
}
-
+
public void testStackOverflow() {
// IVY-924
configureProject("test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileStackOverflow.xml");
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyArtifactPropertyTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyArtifactPropertyTest.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyArtifactPropertyTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyArtifactPropertyTest.java Tue Jan 14 08:27:37 2014
@@ -65,8 +65,8 @@ public class IvyArtifactPropertyTest ext
prop.execute();
String val = project.getProperty("mod1.2.mod1.2-2.0");
assertNotNull(val);
- assertEquals(new File("build/cache/mod1.2/mod1.2-2.0.jar").getCanonicalPath(),
- new File(val).getCanonicalPath());
+ assertEquals(new File("build/cache/mod1.2/mod1.2-2.0.jar").getCanonicalPath(),
+ new File(val).getCanonicalPath());
}
public void testWithResolveId() throws Exception {
@@ -89,7 +89,7 @@ public class IvyArtifactPropertyTest ext
String val = project.getProperty("mod1.2.mod1.2-2.0");
assertNotNull(val);
- assertEquals(new File("build/cache/mod1.2/mod1.2-2.0.jar").getCanonicalPath(),
+ assertEquals(new File("build/cache/mod1.2/mod1.2-2.0.jar").getCanonicalPath(),
new File(val).getCanonicalPath());
}
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildListTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildListTest.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildListTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildListTest.java Tue Jan 14 08:27:37 2014
@@ -436,7 +436,8 @@ public class IvyBuildListTest extends Te
}
public void testAbsolutePathToParent() {
- project.setProperty("master-parent.dir", new File("test/buildlists/testAbsolutePathToParent/master-parent").getAbsolutePath());
+ project.setProperty("master-parent.dir", new File(
+ "test/buildlists/testAbsolutePathToParent/master-parent").getAbsolutePath());
FileSet fs = new FileSet();
fs.setDir(new File("test/buildlists/testAbsolutePathToParent"));
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildNumberTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildNumberTest.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildNumberTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyBuildNumberTest.java Tue Jan 14 08:27:37 2014
@@ -160,7 +160,7 @@ public class IvyBuildNumberTest extends
assertEquals(null, buildNumber.getProject().getProperty("ivy.build.number"));
assertEquals("0", buildNumber.getProject().getProperty("ivy.new.build.number"));
}
-
+
public void testWithBadChecksum() throws Exception {
Project project = new Project();
project.setProperty("ivy.settings.file", "test/repositories/ivysettings-checksums.xml");
@@ -176,7 +176,7 @@ public class IvyBuildNumberTest extends
assertEquals("0", buildNumber.getProject().getProperty("ivy.build.number"));
assertEquals("1", buildNumber.getProject().getProperty("ivy.new.build.number"));
}
-
+
public void testChainResolver() throws Exception {
// IVY-1037
Project project = new Project();
@@ -191,5 +191,4 @@ public class IvyBuildNumberTest extends
assertEquals("3", buildNumber.getProject().getProperty("ivy.new.revision"));
}
-
}
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCacheFilesetTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCacheFilesetTest.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCacheFilesetTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCacheFilesetTest.java Tue Jan 14 08:27:37 2014
@@ -72,20 +72,21 @@ public class IvyCacheFilesetTest extends
DirectoryScanner directoryScanner = fs.getDirectoryScanner(project);
assertEquals(1, directoryScanner.getIncludedFiles().length);
assertEquals(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar")
- .getAbsolutePath(), new File(directoryScanner.getBasedir(),
- directoryScanner.getIncludedFiles()[0]).getAbsolutePath());
+ .getAbsolutePath(),
+ new File(directoryScanner.getBasedir(), directoryScanner.getIncludedFiles()[0])
+ .getAbsolutePath());
}
private File getArchiveFileInCache(String organisation, String module, String revision,
String artifact, String type, String ext) {
- return TestHelper.getArchiveFileInCache(fileset.getIvyInstance(), organisation,
- module, revision, artifact, type, ext);
+ return TestHelper.getArchiveFileInCache(fileset.getIvyInstance(), organisation, module,
+ revision, artifact, type, ext);
}
private File getArchiveFileInCache(String organisation, String module, String revision,
String artifact, String type, String ext, File cache) {
- return TestHelper.getArchiveFileInCache(fileset.getIvyInstance(), organisation,
- module, revision, artifact, type, ext);
+ return TestHelper.getArchiveFileInCache(fileset.getIvyInstance(), organisation, module,
+ revision, artifact, type, ext);
}
public void testEmptyConf() throws Exception {
@@ -115,7 +116,7 @@ public class IvyCacheFilesetTest extends
public void testInvalidPattern() throws Exception {
try {
- project.setProperty("ivy.settings.file",
+ project.setProperty("ivy.settings.file",
"test/repositories/ivysettings-invalidcachepattern.xml");
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-simple.xml");
fileset.setSetid("simple-setid");
@@ -152,9 +153,10 @@ public class IvyCacheFilesetTest extends
FileSet fs = (FileSet) ref;
DirectoryScanner directoryScanner = fs.getDirectoryScanner(project);
assertEquals(1, directoryScanner.getIncludedFiles().length);
- assertEquals(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar",
- cache2).getAbsolutePath(), new File(directoryScanner.getBasedir(),
- directoryScanner.getIncludedFiles()[0]).getAbsolutePath());
+ assertEquals(
+ getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar", cache2)
+ .getAbsolutePath(), new File(directoryScanner.getBasedir(),
+ directoryScanner.getIncludedFiles()[0]).getAbsolutePath());
} finally {
Delete del = new Delete();
del.setProject(new Project());
@@ -163,15 +165,14 @@ public class IvyCacheFilesetTest extends
}
}
-
public void testGetBaseDir() {
File base = null;
base = fileset.getBaseDir(base, new File("x/aa/b/c"));
assertEquals(new File("x/aa/b").getAbsoluteFile(), base);
-
+
base = fileset.getBaseDir(base, new File("x/aa/b/d/e"));
assertEquals(new File("x/aa/b").getAbsoluteFile(), base);
-
+
base = fileset.getBaseDir(base, new File("x/ab/b/d"));
assertEquals(new File("x").getAbsoluteFile(), base);
}
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCleanCacheTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCleanCacheTest.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCleanCacheTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyCleanCacheTest.java Tue Jan 14 08:27:37 2014
@@ -26,11 +26,15 @@ import org.apache.tools.ant.Project;
public class IvyCleanCacheTest extends TestCase {
private IvyCleanCache cleanCache;
+
private File cacheDir;
+
private File repoCache2;
+
private File repoCache;
+
private File resolutionCache;
-
+
protected void setUp() throws Exception {
Project p = new Project();
cacheDir = new File("build/cache");
@@ -39,10 +43,10 @@ public class IvyCleanCacheTest extends T
cleanCache.setProject(p);
IvyConfigure settings = new IvyConfigure();
settings.setProject(p);
- settings.setUrl(
- IvyCleanCacheTest.class.getResource("ivysettings-cleancache.xml").toExternalForm());
+ settings.setUrl(IvyCleanCacheTest.class.getResource("ivysettings-cleancache.xml")
+ .toExternalForm());
settings.perform();
-
+
resolutionCache = new File(cacheDir, "resolution");
repoCache = new File(cacheDir, "repository");
repoCache2 = new File(cacheDir, "repository2");
@@ -50,14 +54,14 @@ public class IvyCleanCacheTest extends T
repoCache.mkdirs();
repoCache2.mkdirs();
}
-
+
public void testCleanAll() throws Exception {
cleanCache.perform();
assertFalse(resolutionCache.exists());
assertFalse(repoCache.exists());
assertFalse(repoCache2.exists());
}
-
+
public void testResolutionOnly() throws Exception {
cleanCache.setCache(IvyCleanCache.NONE);
cleanCache.perform();
@@ -65,7 +69,7 @@ public class IvyCleanCacheTest extends T
assertTrue(repoCache.exists());
assertTrue(repoCache2.exists());
}
-
+
public void testRepositoryOnly() throws Exception {
cleanCache.setResolution(false);
cleanCache.perform();
@@ -73,7 +77,7 @@ public class IvyCleanCacheTest extends T
assertFalse(repoCache.exists());
assertFalse(repoCache2.exists());
}
-
+
public void testOneRepositoryOnly() throws Exception {
cleanCache.setResolution(false);
cleanCache.setCache("mycache");
@@ -82,7 +86,7 @@ public class IvyCleanCacheTest extends T
assertFalse(repoCache.exists());
assertTrue(repoCache2.exists());
}
-
+
public void testUnknownCache() throws Exception {
cleanCache.setResolution(false);
cleanCache.setCache("yourcache");
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyConfigureTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyConfigureTest.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyConfigureTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyConfigureTest.java Tue Jan 14 08:27:37 2014
@@ -32,6 +32,7 @@ import org.apache.tools.ant.types.Refere
public class IvyConfigureTest extends TestCase {
private IvyConfigure configure;
+
private Project project;
protected void setUp() throws Exception {
@@ -41,28 +42,30 @@ public class IvyConfigureTest extends Te
configure = new IvyConfigure();
configure.setProject(project);
}
-
+
private Ivy getIvyInstance() {
IvyTask task = new IvyTask() {
public void doExecute() throws BuildException {
- }};
+ }
+ };
task.setProject(project);
task.init();
-
+
Reference ref = new Reference(configure.getSettingsId());
-// ref.setProject(project);
+ // ref.setProject(project);
task.setSettingsRef(ref);
return task.getIvyInstance();
}
-
+
public void testDefaultCacheDir() {
// test with an URL
configure.setUrl(getClass().getResource("ivysettings-defaultCacheDir.xml"));
configure.setSettingsId("test");
configure.execute();
-
- assertEquals(new File("mycache").getAbsolutePath(), project.getProperty("ivy.cache.dir.test"));
-
+
+ assertEquals(new File("mycache").getAbsolutePath(),
+ project.getProperty("ivy.cache.dir.test"));
+
// test with a File
project = new Project();
configure = new IvyConfigure();
@@ -71,13 +74,15 @@ public class IvyConfigureTest extends Te
configure.setSettingsId("test2");
configure.execute();
- assertEquals(new File("mycache").getAbsolutePath(), project.getProperty("ivy.cache.dir.test2"));
-
+ assertEquals(new File("mycache").getAbsolutePath(),
+ project.getProperty("ivy.cache.dir.test2"));
+
// test if no defaultCacheDir is specified
project = new Project();
configure = new IvyConfigure();
configure.setProject(project);
- configure.setFile(new File("test/java/org/apache/ivy/ant/ivysettings-noDefaultCacheDir.xml"));
+ configure
+ .setFile(new File("test/java/org/apache/ivy/ant/ivysettings-noDefaultCacheDir.xml"));
configure.setSettingsId("test3");
configure.execute();
@@ -87,8 +92,7 @@ public class IvyConfigureTest extends Te
public void testDefault() throws Exception {
// by default settings look in the current directory for an ivysettings.xml file...
// but Ivy itself has one, and we don't want to use it
- configure.getProject()
- .setProperty("ivy.settings.file", "no/settings/will/use/default.xml");
+ configure.getProject().setProperty("ivy.settings.file", "no/settings/will/use/default.xml");
configure.execute();
IvySettings settings = getIvyInstance().getSettings();
@@ -104,8 +108,7 @@ public class IvyConfigureTest extends Te
public void testDefault14() throws Exception {
// by default settings look in the current directory for an ivysettings.xml file...
// but Ivy itself has one, and we don't want to use it
- configure.getProject()
- .setProperty("ivy.settings.file", "no/settings/will/use/default.xml");
+ configure.getProject().setProperty("ivy.settings.file", "no/settings/will/use/default.xml");
configure.getProject().setProperty("ivy.14.compatible", "true");
configure.execute();
@@ -129,10 +132,11 @@ public class IvyConfigureTest extends Te
assertEquals(new File("build/cache").getAbsoluteFile(), settings.getDefaultCache());
assertEquals(new File("test/repositories/ivysettings.xml").getAbsolutePath(), settings
.getVariables().getVariable("ivy.settings.file"));
- assertEquals(new File("test/repositories/ivysettings.xml").toURI().toURL().toExternalForm(),
+ assertEquals(
+ new File("test/repositories/ivysettings.xml").toURI().toURL().toExternalForm(),
settings.getVariables().getVariable("ivy.settings.url"));
- assertEquals(new File("test/repositories").getAbsolutePath(), settings.getVariables().getVariable(
- "ivy.settings.dir"));
+ assertEquals(new File("test/repositories").getAbsolutePath(), settings.getVariables()
+ .getVariable("ivy.settings.dir"));
assertEquals("myvalue", settings.getVariables().getVariable("myproperty"));
}
@@ -179,7 +183,7 @@ public class IvyConfigureTest extends Te
IvySettings settings = getIvyInstance().getSettings();
assertNotNull(settings);
- assertEquals("lib/test/[artifact]-[revision].[ext]",
+ assertEquals("lib/test/[artifact]-[revision].[ext]",
settings.getVariables().getVariable("ivy.retrieve.pattern"));
}
@@ -188,21 +192,19 @@ public class IvyConfigureTest extends Te
.toExternalForm();
configure.setUrl(confUrl);
configure.setSettingsId("this.id");
-
+
configure.execute();
assertNotNull(getIvyInstance());
- assertEquals("value",
- configure.getProject().getProperty("ivy.test.variable"));
- assertEquals("value",
- configure.getProject().getProperty("ivy.test.variable.this.id"));
+ assertEquals("value", configure.getProject().getProperty("ivy.test.variable"));
+ assertEquals("value", configure.getProject().getProperty("ivy.test.variable.this.id"));
}
public void testIncludeTwice() throws Exception {
// IVY-601
configure.setFile(new File("test/java/org/apache/ivy/ant/ivysettings-include-twice.xml"));
-
+
configure.execute();
assertNotNull(getIvyInstance());
@@ -221,7 +223,7 @@ public class IvyConfigureTest extends Te
configure.setFile(new File("test/repositories/ivysettings.xml"));
configure.execute();
assertNotNull(getIvyInstance());
-
+
assertTrue(ivy != getIvyInstance());
}
@@ -237,7 +239,7 @@ public class IvyConfigureTest extends Te
newAntSettings.setOverride("false");
newAntSettings.setFile(new File("test/repositories/ivysettings.xml"));
newAntSettings.execute();
-
+
assertTrue(ivy == getIvyInstance());
}
@@ -252,7 +254,7 @@ public class IvyConfigureTest extends Te
configure.setProject(project);
configure.setOverride("notallowed");
configure.setFile(new File("test/repositories/ivysettings.xml"));
-
+
try {
configure.execute();
fail("calling settings twice with the same id with "
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyConvertPomTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyConvertPomTest.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyConvertPomTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyConvertPomTest.java Tue Jan 14 08:27:37 2014
@@ -33,19 +33,19 @@ public class IvyConvertPomTest extends T
task.setIvyFile(destFile);
task.execute();
- //do not work properly on all platform and depends on the file date
- //keep the code in comments in case someone manage to fix this and to highlight the fact
- //that this is not checked
-
-// String wrote = FileUtil.readEntirely(new BufferedReader(new FileReader(destFile)));
-// String expected = readEntirely("test-convertpom.xml").replaceAll("\r\n", "\n").replace(
-// '\r', '\n');
-// assertEquals(expected, wrote);
+ // do not work properly on all platform and depends on the file date
+ // keep the code in comments in case someone manage to fix this and to highlight the fact
+ // that this is not checked
+
+ // String wrote = FileUtil.readEntirely(new BufferedReader(new FileReader(destFile)));
+ // String expected = readEntirely("test-convertpom.xml").replaceAll("\r\n", "\n").replace(
+ // '\r', '\n');
+ // assertEquals(expected, wrote);
}
-// private String readEntirely(String resource) throws IOException {
-// return FileUtil.readEntirely(
-// new BufferedReader(new InputStreamReader(IvyConvertPomTest.class.getResource(resource)
-// .openStream()))).replaceAll("\r\n", "\n").replace('\r', '\n');
-// }
+ // private String readEntirely(String resource) throws IOException {
+ // return FileUtil.readEntirely(
+ // new BufferedReader(new InputStreamReader(IvyConvertPomTest.class.getResource(resource)
+ // .openStream()))).replaceAll("\r\n", "\n").replace('\r', '\n');
+ // }
}
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyDeliverTest.java Tue Jan 14 08:27:37 2014
@@ -93,7 +93,7 @@ public class IvyDeliverTest extends Test
del.setDir(new File("build/test/retrieve"));
del.execute();
}
-
+
private void cleanRep() {
Delete del = new Delete();
del.setProject(new Project());
@@ -102,8 +102,8 @@ public class IvyDeliverTest extends Test
}
public void testMergeParent() throws IOException, ParseException {
- //publish the parent descriptor first, so that it can be found while
- //we are reading the child descriptor.
+ // publish the parent descriptor first, so that it can be found while
+ // we are reading the child descriptor.
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-multiconf.xml");
IvyResolve res = new IvyResolve();
res.setProject(project);
@@ -116,13 +116,14 @@ public class IvyDeliverTest extends Test
File art = new File("build/test/deliver/resolve-simple-1.0.jar");
FileUtil.copy(new File("test/repositories/1/org1/mod1.1/jars/mod1.1-1.0.jar"), art, null);
pubParent.execute();
-
- //resolve and deliver the child descriptor
- project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-extends-multiconf.xml");
+
+ // resolve and deliver the child descriptor
+ project.setProperty("ivy.dep.file",
+ "test/java/org/apache/ivy/ant/ivy-extends-multiconf.xml");
res = new IvyResolve();
res.setProject(project);
res.execute();
-
+
deliver.setPubrevision("1.2");
deliver.setDeliverpattern("build/test/deliver/merge/ivy-[revision].xml");
deliver.execute();
@@ -137,20 +138,19 @@ public class IvyDeliverTest extends Test
BufferedReader merged = new BufferedReader(new FileReader(delivered));
BufferedReader expected = new BufferedReader(new InputStreamReader(getClass()
- .getResourceAsStream("ivy-extends-merged.xml")));
+ .getResourceAsStream("ivy-extends-merged.xml")));
try {
- for (String mergeLine = merged.readLine(),
- expectedLine = expected.readLine();
- mergeLine != null && expectedLine != null;
- mergeLine = merged.readLine(),
- expectedLine = expected.readLine()) {
-
+ for (String mergeLine = merged.readLine(), expectedLine = expected.readLine(); mergeLine != null
+ && expectedLine != null; mergeLine = merged.readLine(), expectedLine = expected
+ .readLine()) {
+
mergeLine = mergeLine.trim();
expectedLine = expectedLine.trim();
-
+
if (!mergeLine.startsWith("<info"))
- assertEquals("published descriptor matches at line[" + lineNo + "]", expectedLine.trim(), mergeLine.trim());
-
+ assertEquals("published descriptor matches at line[" + lineNo + "]",
+ expectedLine.trim(), mergeLine.trim());
+
++lineNo;
}
} finally {
@@ -158,7 +158,7 @@ public class IvyDeliverTest extends Test
expected.close();
}
}
-
+
public void testSimple() throws Exception {
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-latest.xml");
IvyResolve res = new IvyResolve();
@@ -174,13 +174,13 @@ public class IvyDeliverTest extends Test
assertTrue(deliveredIvyFile.exists());
ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
new IvySettings(), deliveredIvyFile.toURI().toURL(), true);
- assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"), md
- .getModuleRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"),
+ md.getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(1, dds.length);
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2"),
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2"),
dds[0].getDependencyRevisionId());
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "latest.integration"),
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "latest.integration"),
dds[0].getDynamicConstraintDependencyRevisionId());
}
@@ -200,13 +200,13 @@ public class IvyDeliverTest extends Test
assertTrue(deliveredIvyFile.exists());
ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
new IvySettings(), deliveredIvyFile.toURI().toURL(), true);
- assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"), md
- .getModuleRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"),
+ md.getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(1, dds.length);
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2"),
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2"),
dds[0].getDependencyRevisionId());
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2"),
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2"),
dds[0].getDynamicConstraintDependencyRevisionId());
}
@@ -233,12 +233,12 @@ public class IvyDeliverTest extends Test
assertTrue(deliveredIvyFile.exists());
ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
new IvySettings(), deliveredIvyFile.toURI().toURL(), true);
- assertEquals(ModuleRevisionId.newInstance("apache", "resolve-simple", "1.2"), md
- .getModuleRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("apache", "resolve-simple", "1.2"),
+ md.getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(1, dds.length);
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"), dds[0]
- .getDependencyRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"),
+ dds[0].getDependencyRevisionId());
}
public void testWithResolveIdInAnotherBuild() throws Exception {
@@ -270,12 +270,12 @@ public class IvyDeliverTest extends Test
assertTrue(deliveredIvyFile.exists());
ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
new IvySettings(), deliveredIvyFile.toURI().toURL(), true);
- assertEquals(ModuleRevisionId.newInstance("apache", "resolve-simple", "1.2"), md
- .getModuleRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("apache", "resolve-simple", "1.2"),
+ md.getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(1, dds.length);
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"), dds[0]
- .getDependencyRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"),
+ dds[0].getDependencyRevisionId());
}
public void testReplaceBranchInfo() throws Exception {
@@ -294,8 +294,8 @@ public class IvyDeliverTest extends Test
assertTrue(deliveredIvyFile.exists());
ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
new IvySettings(), deliveredIvyFile.toURI().toURL(), true);
- assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "BRANCH1", "1.2"),
- md.getModuleRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "BRANCH1", "1.2"),
+ md.getModuleRevisionId());
}
public void testWithBranch() throws Exception {
@@ -314,12 +314,12 @@ public class IvyDeliverTest extends Test
assertTrue(deliveredIvyFile.exists());
ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
new IvySettings(), deliveredIvyFile.toURI().toURL(), true);
- assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"), md
- .getModuleRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"),
+ md.getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(1, dds.length);
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "TRUNK", "2.2"), dds[0]
- .getDependencyRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "TRUNK", "2.2"),
+ dds[0].getDependencyRevisionId());
}
public void testReplaceBranch() throws Exception {
@@ -327,8 +327,9 @@ public class IvyDeliverTest extends Test
settings.setProject(project);
settings.execute();
// change the default branch to use
- IvyAntSettings.getDefaultInstance(settings).getConfiguredIvyInstance(settings).getSettings().setDefaultBranch("BRANCH1");
-
+ IvyAntSettings.getDefaultInstance(settings).getConfiguredIvyInstance(settings)
+ .getSettings().setDefaultBranch("BRANCH1");
+
// resolve a module dependencies
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-latest.xml");
IvyResolve res = new IvyResolve();
@@ -340,19 +341,19 @@ public class IvyDeliverTest extends Test
deliver.setDeliverpattern("build/test/deliver/ivy-[revision].xml");
deliver.execute();
- // should have done the ivy delivering, including setting the branch according to the
+ // should have done the ivy delivering, including setting the branch according to the
// configured default
File deliveredIvyFile = new File("build/test/deliver/ivy-1.2.xml");
assertTrue(deliveredIvyFile.exists());
ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
new IvySettings(), deliveredIvyFile.toURI().toURL(), true);
- assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"), md
- .getModuleRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"),
+ md.getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(1, dds.length);
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "BRANCH1", "2.2"),
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "BRANCH1", "2.2"),
dds[0].getDependencyRevisionId());
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "latest.integration"),
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "latest.integration"),
dds[0].getDynamicConstraintDependencyRevisionId());
}
@@ -374,14 +375,14 @@ public class IvyDeliverTest extends Test
assertTrue(deliveredIvyFile.exists());
ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
new IvySettings(), deliveredIvyFile.toURI().toURL(), false);
- assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"), md
- .getModuleRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"),
+ md.getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(1, dds.length);
Map extraAtt = new HashMap();
extraAtt.put("myExtraAtt", "myValue");
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2", extraAtt), dds[0]
- .getDependencyRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2", extraAtt),
+ dds[0].getDependencyRevisionId());
}
public void testWithDynEvicted() throws Exception {
@@ -390,22 +391,22 @@ public class IvyDeliverTest extends Test
res.setValidate(false);
res.setProject(project);
res.execute();
-
+
deliver.setPubrevision("1.2");
deliver.setDeliverpattern("build/test/deliver/ivy-[revision].xml");
deliver.setValidate(false);
deliver.execute();
-
+
// should have done the ivy delivering
File deliveredIvyFile = new File("build/test/deliver/ivy-1.2.xml");
- assertTrue(deliveredIvyFile.exists());
+ assertTrue(deliveredIvyFile.exists());
ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
- new IvySettings(), deliveredIvyFile.toURI().toURL(), false);
- assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"),
+ new IvySettings(), deliveredIvyFile.toURI().toURL(), false);
+ assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"),
md.getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(2, dds.length);
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2"),
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2"),
dds[0].getDependencyRevisionId());
IvyRetrieve ret = new IvyRetrieve();
@@ -437,22 +438,22 @@ public class IvyDeliverTest extends Test
res.setValidate(false);
res.setProject(project);
res.execute();
-
+
deliver.setPubrevision("1.2");
deliver.setDeliverpattern("build/test/deliver/ivy-[revision].xml");
deliver.setValidate(false);
deliver.execute();
-
+
// should have done the ivy delivering
File deliveredIvyFile = new File("build/test/deliver/ivy-1.2.xml");
- assertTrue(deliveredIvyFile.exists());
+ assertTrue(deliveredIvyFile.exists());
ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
- new IvySettings(), deliveredIvyFile.toURI().toURL(), false);
- assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"),
+ new IvySettings(), deliveredIvyFile.toURI().toURL(), false);
+ assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"),
md.getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(2, dds.length);
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2"),
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2"),
dds[1].getDependencyRevisionId());
IvyRetrieve ret = new IvyRetrieve();
@@ -476,7 +477,7 @@ public class IvyDeliverTest extends Test
expectedFileSet, actualFileSet);
list.delete();
}
-
+
public void testReplaceImportedConfigurations() throws Exception {
project.setProperty("ivy.dep.file", "test/java/org/apache/ivy/ant/ivy-import-confs.xml");
IvyResolve res = new IvyResolve();
@@ -492,10 +493,10 @@ public class IvyDeliverTest extends Test
assertTrue(deliveredIvyFile.exists());
String deliveredFileContent = FileUtil.readEntirely(new BufferedReader(new FileReader(
deliveredIvyFile)));
- assertTrue("import not replaced: import can still be found in file", deliveredFileContent
- .indexOf("import") == -1);
- assertTrue("import not replaced: conf1 cannot be found in file", deliveredFileContent
- .indexOf("conf1") != -1);
+ assertTrue("import not replaced: import can still be found in file",
+ deliveredFileContent.indexOf("import") == -1);
+ assertTrue("import not replaced: conf1 cannot be found in file",
+ deliveredFileContent.indexOf("conf1") != -1);
}
public void testReplaceVariables() throws Exception {
@@ -515,10 +516,10 @@ public class IvyDeliverTest extends Test
assertTrue(deliveredIvyFile.exists());
String deliveredFileContent = FileUtil.readEntirely(new BufferedReader(new FileReader(
deliveredIvyFile)));
- assertTrue("variable not replaced: myvar can still be found in file", deliveredFileContent
- .indexOf("myvar") == -1);
- assertTrue("variable not replaced: myvalue cannot be found in file", deliveredFileContent
- .indexOf("myvalue") != -1);
+ assertTrue("variable not replaced: myvar can still be found in file",
+ deliveredFileContent.indexOf("myvar") == -1);
+ assertTrue("variable not replaced: myvalue cannot be found in file",
+ deliveredFileContent.indexOf("myvalue") != -1);
}
public void testNoReplaceDynamicRev() throws Exception {
@@ -537,12 +538,12 @@ public class IvyDeliverTest extends Test
assertTrue(deliveredIvyFile.exists());
ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
new IvySettings(), deliveredIvyFile.toURI().toURL(), true);
- assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"), md
- .getModuleRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("apache", "resolve-latest", "1.2"),
+ md.getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(1, dds.length);
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "latest.integration"), dds[0]
- .getDependencyRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "latest.integration"),
+ dds[0].getDependencyRevisionId());
}
public void testDifferentRevisionsForSameModule() throws Exception {
@@ -561,15 +562,15 @@ public class IvyDeliverTest extends Test
assertTrue(deliveredIvyFile.exists());
ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
new IvySettings(), deliveredIvyFile.toURI().toURL(), true);
- assertEquals(ModuleRevisionId.newInstance("apache", "different-revs", "1.2"), md
- .getModuleRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("apache", "different-revs", "1.2"),
+ md.getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(3, dds.length);
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"), dds[0]
- .getDependencyRevisionId());
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"), dds[1]
- .getDependencyRevisionId());
- assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "1.1"), dds[2]
- .getDependencyRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"),
+ dds[0].getDependencyRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"),
+ dds[1].getDependencyRevisionId());
+ assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "1.1"),
+ dds[2].getDependencyRevisionId());
}
}
Modified: ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyInfoTest.java
URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyInfoTest.java?rev=1557968&r1=1557967&r2=1557968&view=diff
==============================================================================
--- ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyInfoTest.java (original)
+++ ant/ivy/core/trunk/test/java/org/apache/ivy/ant/IvyInfoTest.java Tue Jan 14 08:27:37 2014
@@ -58,8 +58,10 @@ public class IvyInfoTest extends TestCas
assertEquals("myvalue", info.getProject().getProperty("ivy.extra.myextraatt"));
// test the configuration descriptions
- assertEquals("The default dependencies", info.getProject().getProperty("ivy.configuration.default.desc"));
- assertEquals("Dependencies used for testing", info.getProject().getProperty("ivy.configuration.test.desc"));
+ assertEquals("The default dependencies",
+ info.getProject().getProperty("ivy.configuration.default.desc"));
+ assertEquals("Dependencies used for testing",
+ info.getProject().getProperty("ivy.configuration.test.desc"));
assertNull(info.getProject().getProperty("ivy.configuration.private.desc"));
}