You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by jh...@apache.org on 2017/06/14 09:37:18 UTC
[01/11] ant-ivy git commit: Generics and other fixes in tests and
tutorials
Repository: ant-ivy
Updated Branches:
refs/heads/master 545536e34 -> 225afb8ba
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/plugins/repository/vfs/VfsTestHelper.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/repository/vfs/VfsTestHelper.java b/test/java/org/apache/ivy/plugins/repository/vfs/VfsTestHelper.java
index f64255f..ecbed50 100644
--- a/test/java/org/apache/ivy/plugins/repository/vfs/VfsTestHelper.java
+++ b/test/java/org/apache/ivy/plugins/repository/vfs/VfsTestHelper.java
@@ -57,7 +57,7 @@ public class VfsTestHelper {
// setup and initialize VFS
fsManager = new StandardFileSystemManager() {
protected void configurePlugins() throws FileSystemException {
- // disable automatic loading potential unsupported extensions
+ // disable automatic loading of potentially unsupported extensions
}
};
fsManager.setConfiguration(getClass().getResource(VFS_CONF).toString());
@@ -75,10 +75,10 @@ public class VfsTestHelper {
* name of the resource
* @return <class>List</class> of well-formed VFS resource identifiers
*/
- public List createVFSUriSet(String resource) {
- List set = new ArrayList();
- for (int i = 0; i < VfsURI.SUPPORTED_SCHEMES.length; i++) {
- set.add(VfsURI.vfsURIFactory(VfsURI.SUPPORTED_SCHEMES[i], resource, ivy));
+ public List<VfsURI> createVFSUriSet(String resource) {
+ List<VfsURI> set = new ArrayList<VfsURI>();
+ for (String scheme : VfsURI.SUPPORTED_SCHEMES) {
+ set.add(VfsURI.vfsURIFactory(scheme, resource, ivy));
}
return set;
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/plugins/resolver/ChainResolverTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/resolver/ChainResolverTest.java b/test/java/org/apache/ivy/plugins/resolver/ChainResolverTest.java
index 7f03298..28d04f6 100644
--- a/test/java/org/apache/ivy/plugins/resolver/ChainResolverTest.java
+++ b/test/java/org/apache/ivy/plugins/resolver/ChainResolverTest.java
@@ -158,8 +158,8 @@ public class ChainResolverTest extends AbstractDependencyResolverTest {
assertNotNull(rmr);
assertEquals("3", rmr.getResolver().getName());
List ddAsList = Arrays.asList(new DependencyDescriptor[] {dd});
- for (int i = 0; i < resolvers.length; i++) {
- assertEquals(ddAsList, resolvers[i].askedDeps);
+ for (MockResolver resolver : resolvers) {
+ assertEquals(ddAsList, resolver.askedDeps);
}
}
@@ -198,8 +198,8 @@ public class ChainResolverTest extends AbstractDependencyResolverTest {
assertNotNull(rmr);
assertEquals("5", rmr.getResolver().getName());
List ddAsList = Arrays.asList(new DependencyDescriptor[] {dd});
- for (int i = 0; i < resolvers.length; i++) {
- assertEquals(ddAsList, resolvers[i].askedDeps);
+ for (MockResolver resolver : resolvers) {
+ assertEquals(ddAsList, resolver.askedDeps);
}
}
@@ -282,8 +282,8 @@ public class ChainResolverTest extends AbstractDependencyResolverTest {
assertNotNull(rmr);
assertEquals("5", rmr.getResolver().getName());
List ddAsList = Arrays.asList(new DependencyDescriptor[] {dd});
- for (int i = 0; i < resolvers.length; i++) {
- assertEquals(ddAsList, resolvers[i].askedDeps);
+ for (MockResolver resolver : resolvers) {
+ assertEquals(ddAsList, resolver.askedDeps);
}
}
@@ -375,8 +375,8 @@ public class ChainResolverTest extends AbstractDependencyResolverTest {
chain.setSettings(settings);
MockResolver[] resolvers = new MockResolver[] {MockResolver.buildMockResolver(settings,
"1", true, null)};
- for (int i = 0; i < resolvers.length; i++) {
- chain.add(resolvers[i]);
+ for (MockResolver resolver : resolvers) {
+ chain.add(resolver);
}
chain.getDependency(dd, data);
// should not have asked any dependency, should have hit the cache
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/plugins/resolver/IBiblioResolverTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/resolver/IBiblioResolverTest.java b/test/java/org/apache/ivy/plugins/resolver/IBiblioResolverTest.java
index 79cfe61..743ff02 100644
--- a/test/java/org/apache/ivy/plugins/resolver/IBiblioResolverTest.java
+++ b/test/java/org/apache/ivy/plugins/resolver/IBiblioResolverTest.java
@@ -230,8 +230,8 @@ public class IBiblioResolverTest extends AbstractDependencyResolverTest {
Map[] valuesMaps = resolver.listTokenValues(new String[] {IvyPatternHelper.MODULE_KEY},
otherTokenValues);
Set vals = new HashSet();
- for (int i = 0; i < valuesMaps.length; i++) {
- vals.add(valuesMaps[i].get(IvyPatternHelper.MODULE_KEY));
+ for (Map valuesMap : valuesMaps) {
+ vals.add(valuesMap.get(IvyPatternHelper.MODULE_KEY));
}
values = (String[]) vals.toArray(new String[vals.size()]);
assertEquals(1, values.length);
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/util/url/ApacheURLListerTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/util/url/ApacheURLListerTest.java b/test/java/org/apache/ivy/util/url/ApacheURLListerTest.java
index 3af35e6..6ab2543 100644
--- a/test/java/org/apache/ivy/util/url/ApacheURLListerTest.java
+++ b/test/java/org/apache/ivy/util/url/ApacheURLListerTest.java
@@ -18,7 +18,6 @@
package org.apache.ivy.util.url;
import java.net.URL;
-import java.util.Iterator;
import java.util.List;
import org.junit.Test;
@@ -40,23 +39,22 @@ public class ApacheURLListerTest {
public void testRetrieveListing() throws Exception {
ApacheURLLister lister = new ApacheURLLister();
- List files = lister.retrieveListing(
+ List<URL> files = lister.retrieveListing(
ApacheURLListerTest.class.getResource("apache-file-listing.html"), true, false);
assertNotNull(files);
assertTrue(files.size() > 0);
- for (Iterator iter = files.iterator(); iter.hasNext();) {
- URL file = (URL) iter.next();
+ for (URL file : files) {
assertTrue("found a non matching file: " + file,
file.getPath().matches(".*/[^/]+\\.(jar|md5|sha1)"));
}
// try a directory listing
- List dirs = lister.retrieveListing(
+ List<URL> dirs = lister.retrieveListing(
ApacheURLListerTest.class.getResource("apache-dir-listing.html"), false, true);
assertNotNull(dirs);
assertEquals(4, dirs.size());
- List empty = lister.retrieveListing(
+ List<URL> empty = lister.retrieveListing(
ApacheURLListerTest.class.getResource("apache-dir-listing.html"), true, false);
assertTrue(empty.isEmpty());
}
@@ -70,7 +68,7 @@ public class ApacheURLListerTest {
public void testRetrieveListingWithSpaces() throws Exception {
ApacheURLLister lister = new ApacheURLLister();
- List files = lister.retrieveListing(
+ List<URL> files = lister.retrieveListing(
ApacheURLListerTest.class.getResource("listing-with-spaces.html"), true, false);
assertNotNull(files);
assertTrue(files.size() > 0);
@@ -80,7 +78,7 @@ public class ApacheURLListerTest {
public void testRetrieveArtifactoryListing() throws Exception {
ApacheURLLister lister = new ApacheURLLister();
- List files = lister.retrieveListing(
+ List<URL> files = lister.retrieveListing(
ApacheURLListerTest.class.getResource("artifactory-dir-listing.html"), true, true);
assertNotNull(files);
assertEquals(1, files.size());
@@ -90,7 +88,7 @@ public class ApacheURLListerTest {
public void testRetrieveArchivaListing() throws Exception {
ApacheURLLister lister = new ApacheURLLister();
- List d = lister.listDirectories(ApacheURLListerTest.class
+ List<URL> d = lister.listDirectories(ApacheURLListerTest.class
.getResource("archiva-listing.html"));
assertNotNull(d);
// archiva listing is not valid html at all currently (1.0, unclosed a tags),
@@ -102,7 +100,7 @@ public class ApacheURLListerTest {
public void testRetrieveFixedArchivaListing() throws Exception {
ApacheURLLister lister = new ApacheURLLister();
- List d = lister.listDirectories(ApacheURLListerTest.class
+ List<URL> d = lister.listDirectories(ApacheURLListerTest.class
.getResource("fixed-archiva-listing.html"));
assertNotNull(d);
assertEquals(3, d.size());
@@ -112,7 +110,7 @@ public class ApacheURLListerTest {
public void testRetrieveMavenProxyListing() throws Exception {
ApacheURLLister lister = new ApacheURLLister();
- List d = lister.listDirectories(ApacheURLListerTest.class
+ List<URL> d = lister.listDirectories(ApacheURLListerTest.class
.getResource("maven-proxy-listing.html"));
assertNotNull(d);
assertEquals(3, d.size());
[02/11] ant-ivy git commit: Generics and other fixes in tests and
tutorials
Posted by jh...@apache.org.
Generics and other fixes in tests and tutorials
Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/8b9f2d51
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/8b9f2d51
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/8b9f2d51
Branch: refs/heads/master
Commit: 8b9f2d5177c849b37809ab38035e1d757d963314
Parents: 4c6450f
Author: twogee <g....@gmail.com>
Authored: Sat Jun 10 08:56:44 2017 +0200
Committer: twogee <g....@gmail.com>
Committed: Sat Jun 10 21:47:21 2017 +0200
----------------------------------------------------------------------
ivy.xml | 32 +++----
.../src/filter/ccimpl/CCFilter.java | 4 +-
.../src/filter/hmimpl/HMFilter.java | 4 +-
.../test/filter/AbstractTestFilter.java | 1 -
src/example/dual/project/src/example/Hello.java | 51 ----------
.../dual/project/src/example/HelloIvy.java | 51 ++++++++++
src/example/hello-ivy/src/example/Hello.java | 51 ----------
.../hello-ivy/src/example/HelloConsole.java | 51 ++++++++++
.../projects/find/src/find/FindFile.java | 2 +-
.../projects/find/src/find/Main.java | 4 +-
.../projects/list/src/list/ListFile.java | 5 +-
.../projects/size/src/size/FileSize.java | 5 +-
.../ivy/plugins/repository/vfs/VfsResource.java | 8 +-
test/java/org/apache/ivy/TestFixture.java | 3 +-
test/java/org/apache/ivy/TestHelper.java | 42 ++++-----
.../apache/ivy/ant/AntBuildResolverTest.java | 12 +--
.../org/apache/ivy/ant/FixDepsTaskTest.java | 9 +-
.../org/apache/ivy/ant/IvyBuildListTest.java | 4 +-
.../java/org/apache/ivy/ant/IvyDeliverTest.java | 10 +-
.../apache/ivy/ant/IvyPostResolveTaskTest.java | 69 +++++++-------
.../java/org/apache/ivy/ant/IvyResolveTest.java | 2 +-
.../org/apache/ivy/ant/IvyResourcesTest.java | 5 +-
.../apache/ivy/core/module/id/ModuleIdTest.java | 2 +-
.../ivy/core/publish/PublishEventsTest.java | 5 +-
.../org/apache/ivy/core/search/SearchTest.java | 18 ++--
.../java/org/apache/ivy/core/sort/SortTest.java | 97 ++++++++++----------
.../conflict/LatestConflictManagerTest.java | 20 +---
.../matcher/AbstractPatternMatcherTest.java | 16 ++--
.../parser/xml/XmlModuleUpdaterTest.java | 18 ++--
.../repository/vfs/VfsRepositoryTest.java | 33 ++-----
.../plugins/repository/vfs/VfsResourceTest.java | 50 ++++------
.../plugins/repository/vfs/VfsTestHelper.java | 10 +-
.../ivy/plugins/resolver/ChainResolverTest.java | 16 ++--
.../plugins/resolver/IBiblioResolverTest.java | 4 +-
.../ivy/util/url/ApacheURLListerTest.java | 20 ++--
35 files changed, 336 insertions(+), 398 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/ivy.xml
----------------------------------------------------------------------
diff --git a/ivy.xml b/ivy.xml
index f2f7e86..d7417c8 100644
--- a/ivy.xml
+++ b/ivy.xml
@@ -26,7 +26,7 @@
Apache Ivy is a tool for managing (recording, tracking, resolving and reporting) project dependencies.
</description>
</info>
- <configurations>
+ <configurations defaultconfmapping="*->default">
<conf name="core" description="only ivy jar, without any dependencies"/>
<conf name="httpclient" extends="core" description="core + optional httpclient for better http handling"/>
<conf name="oro" extends="core" description="to use optional glob matcher"/>
@@ -35,32 +35,32 @@
<conf name="standalone" extends="core" description="to launch in standalone mode (from command line)"/>
<conf name="ant" extends="core" description="core + ant jar provided as a dependency"/>
<conf name="default" extends="core" description="full ivy with all dependencies"/>
- <conf name="test" description="dependencies used for junit testing ivy" visibility="private" />
- <conf name="source" description="ivy sources" />
+ <conf name="test" description="dependencies used for junit testing ivy" visibility="private"/>
+ <conf name="source" description="ivy sources"/>
</configurations>
<publications>
<artifact name="ivy" type="jar" conf="core"/>
<artifact name="ivy" type="source" ext="jar" conf="source"/>
</publications>
<dependencies>
- <dependency org="org.apache.ant" name="ant" rev="1.9.9" conf="default,ant->default"/>
+ <dependency org="org.apache.ant" name="ant" rev="1.9.9" conf="default,ant"/>
<dependency org="commons-httpclient" name="commons-httpclient" rev="3.1" conf="default,httpclient->runtime,master"/>
- <dependency org="oro" name="oro" rev="2.0.8" conf="default,oro->default"/>
- <dependency org="commons-vfs" name="commons-vfs" rev="1.0" conf="default,vfs->default"/>
- <dependency org="com.jcraft" name="jsch" rev="0.1.54" conf="default,sftp->default"/>
- <dependency org="com.jcraft" name="jsch.agentproxy" rev="0.0.9" conf="default,sftp->default"/>
- <dependency org="com.jcraft" name="jsch.agentproxy.connector-factory" rev="0.0.9" conf="default,sftp->default"/>
- <dependency org="com.jcraft" name="jsch.agentproxy.jsch" rev="0.0.9" conf="default,sftp->default"/>
+ <dependency org="oro" name="oro" rev="2.0.8" conf="default,oro"/>
+ <dependency org="commons-vfs" name="commons-vfs" rev="1.0" conf="default,vfs"/>
+ <dependency org="com.jcraft" name="jsch" rev="0.1.54" conf="default,sftp"/>
+ <dependency org="com.jcraft" name="jsch.agentproxy" rev="0.0.9" conf="default,sftp"/>
+ <dependency org="com.jcraft" name="jsch.agentproxy.connector-factory" rev="0.0.9" conf="default,sftp"/>
+ <dependency org="com.jcraft" name="jsch.agentproxy.jsch" rev="0.0.9" conf="default,sftp"/>
<dependency org="org.bouncycastle" name="bcpg-jdk15on" rev="1.52" conf="default"/>
<dependency org="org.bouncycastle" name="bcprov-jdk15on" rev="1.52" conf="default"/>
<!-- Test dependencies -->
- <dependency org="junit" name="junit" rev="4.12" conf="test->default"/>
- <dependency org="org.hamcrest" name="hamcrest-core" rev="1.3" conf="test->default"/>
- <dependency org="org.apache.ant" name="ant-testutil" rev="1.9.9" conf="test->default" transitive="false"/>
- <dependency org="org.apache.ant" name="ant-launcher" rev="1.9.9" conf="test->default" transitive="false"/>
- <dependency org="ant-contrib" name="ant-contrib" rev="1.0b3" conf="test->default" transitive="false"/>
- <dependency org="xmlunit" name="xmlunit" rev="1.6" conf="test->default" transitive="false"/>
+ <dependency org="junit" name="junit" rev="4.12" conf="test"/>
+ <dependency org="org.hamcrest" name="hamcrest-core" rev="1.3" conf="test"/>
+ <dependency org="org.apache.ant" name="ant-testutil" rev="1.9.9" conf="test" transitive="false"/>
+ <dependency org="org.apache.ant" name="ant-launcher" rev="1.9.9" conf="test" transitive="false"/>
+ <dependency org="ant-contrib" name="ant-contrib" rev="1.0b3" conf="test" transitive="false"/>
+ <dependency org="xmlunit" name="xmlunit" rev="1.6" conf="test" transitive="false"/>
<!-- Global exclude for junit and hamcrest -->
<exclude org="junit" module="junit" conf="core,default,httpclient,oro,vfs,sftp,standalone,ant"/>
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/example/configurations/multi-projects/filter-framework/src/filter/ccimpl/CCFilter.java
----------------------------------------------------------------------
diff --git a/src/example/configurations/multi-projects/filter-framework/src/filter/ccimpl/CCFilter.java b/src/example/configurations/multi-projects/filter-framework/src/filter/ccimpl/CCFilter.java
index 3dd8abb..2dc71c4 100644
--- a/src/example/configurations/multi-projects/filter-framework/src/filter/ccimpl/CCFilter.java
+++ b/src/example/configurations/multi-projects/filter-framework/src/filter/ccimpl/CCFilter.java
@@ -34,12 +34,12 @@ public class CCFilter implements IFilter {
return values;
}
- List result = new ArrayList(Arrays.asList(values));
+ List<String> result = new ArrayList<String>(Arrays.asList(values));
CollectionUtils.filter(result, new Predicate() {
public boolean evaluate(Object o) {
return o != null && o.toString().startsWith(prefix);
}
});
- return (String[]) result.toArray(new String[result.size()]);
+ return result.toArray(new String[result.size()]);
}
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java
----------------------------------------------------------------------
diff --git a/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java b/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java
index 18191c2..bcb2e1d 100644
--- a/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java
+++ b/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java
@@ -30,13 +30,13 @@ public class HMFilter implements IFilter {
if (prefix == null) {
return values;
}
- List result = new ArrayList();
+ List<String> result = new ArrayList<String>();
for (int i = 0; i < values.length; i++) {
String string = values[i];
if (string != null && string.startsWith(prefix)) {
result.add(string);
}
}
- return (String[]) result.toArray(new String[result.size()]);
+ return result.toArray(new String[result.size()]);
}
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/example/configurations/multi-projects/filter-framework/test/filter/AbstractTestFilter.java
----------------------------------------------------------------------
diff --git a/src/example/configurations/multi-projects/filter-framework/test/filter/AbstractTestFilter.java b/src/example/configurations/multi-projects/filter-framework/test/filter/AbstractTestFilter.java
index 81da01a..7c8c4f2 100644
--- a/src/example/configurations/multi-projects/filter-framework/test/filter/AbstractTestFilter.java
+++ b/src/example/configurations/multi-projects/filter-framework/test/filter/AbstractTestFilter.java
@@ -21,7 +21,6 @@ import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
public abstract class AbstractTestFilter {
/**
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/example/dual/project/src/example/Hello.java
----------------------------------------------------------------------
diff --git a/src/example/dual/project/src/example/Hello.java b/src/example/dual/project/src/example/Hello.java
deleted file mode 100644
index bc84237..0000000
--- a/src/example/dual/project/src/example/Hello.java
+++ /dev/null
@@ -1,51 +0,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 example;
-
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.methods.HeadMethod;
-import org.apache.commons.lang.WordUtils;
-
-/**
- * Simple hello world example to show how easy it is to retrieve libs with ivy,
- * including transitive dependencies
- */
-public final class Hello {
- public static void main(String[] args) throws Exception {
- String message = "hello ivy !";
- System.out.println("standard message : " + message);
- System.out.println("capitalized by " + WordUtils.class.getName()
- + " : " + WordUtils.capitalizeFully(message));
-
- HttpClient client = new HttpClient();
- HeadMethod head = new HeadMethod("http://www.ibiblio.org/");
- client.executeMethod(head);
-
- int status = head.getStatusCode();
- System.out.println("head status code with httpclient: " + status);
- head.releaseConnection();
-
- System.out.println(
- "now check if httpclient dependency on commons-logging has been realized");
- Class clss = Class.forName("org.apache.commons.logging.Log");
- System.out.println("found logging class in classpath: " + clss);
- }
-
- private Hello() {
- }
-}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/example/dual/project/src/example/HelloIvy.java
----------------------------------------------------------------------
diff --git a/src/example/dual/project/src/example/HelloIvy.java b/src/example/dual/project/src/example/HelloIvy.java
new file mode 100644
index 0000000..bc84237
--- /dev/null
+++ b/src/example/dual/project/src/example/HelloIvy.java
@@ -0,0 +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.
+ *
+ */
+package example;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.methods.HeadMethod;
+import org.apache.commons.lang.WordUtils;
+
+/**
+ * Simple hello world example to show how easy it is to retrieve libs with ivy,
+ * including transitive dependencies
+ */
+public final class Hello {
+ public static void main(String[] args) throws Exception {
+ String message = "hello ivy !";
+ System.out.println("standard message : " + message);
+ System.out.println("capitalized by " + WordUtils.class.getName()
+ + " : " + WordUtils.capitalizeFully(message));
+
+ HttpClient client = new HttpClient();
+ HeadMethod head = new HeadMethod("http://www.ibiblio.org/");
+ client.executeMethod(head);
+
+ int status = head.getStatusCode();
+ System.out.println("head status code with httpclient: " + status);
+ head.releaseConnection();
+
+ System.out.println(
+ "now check if httpclient dependency on commons-logging has been realized");
+ Class clss = Class.forName("org.apache.commons.logging.Log");
+ System.out.println("found logging class in classpath: " + clss);
+ }
+
+ private Hello() {
+ }
+}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/example/hello-ivy/src/example/Hello.java
----------------------------------------------------------------------
diff --git a/src/example/hello-ivy/src/example/Hello.java b/src/example/hello-ivy/src/example/Hello.java
deleted file mode 100644
index f3d0d45..0000000
--- a/src/example/hello-ivy/src/example/Hello.java
+++ /dev/null
@@ -1,51 +0,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 example;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.CommandLineParser;
-import org.apache.commons.cli.GnuParser;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.commons.cli.Options;
-import org.apache.commons.lang.WordUtils;
-
-/**
- * Simple example to show how easy it is to retrieve transitive libs with ivy !!!
- */
-public final class Hello {
- public static void main(String[] args) throws Exception {
- Option msg = OptionBuilder.withArgName("msg")
- .hasArg()
- .withDescription("the message to capitalize")
- .create("message");
- Options options = new Options();
- options.addOption(msg);
-
- CommandLineParser parser = new GnuParser();
- CommandLine line = parser.parse(options, args);
-
- String message = line.getOptionValue("message", "hello ivy !");
- System.out.println("standard message : " + message);
- System.out.println("capitalized by " + WordUtils.class.getName()
- + " : " + WordUtils.capitalizeFully(message));
- }
-
- private Hello() {
- }
-}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/example/hello-ivy/src/example/HelloConsole.java
----------------------------------------------------------------------
diff --git a/src/example/hello-ivy/src/example/HelloConsole.java b/src/example/hello-ivy/src/example/HelloConsole.java
new file mode 100644
index 0000000..f3d0d45
--- /dev/null
+++ b/src/example/hello-ivy/src/example/HelloConsole.java
@@ -0,0 +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.
+ *
+ */
+package example;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.Option;
+import org.apache.commons.cli.OptionBuilder;
+import org.apache.commons.cli.Options;
+import org.apache.commons.lang.WordUtils;
+
+/**
+ * Simple example to show how easy it is to retrieve transitive libs with ivy !!!
+ */
+public final class Hello {
+ public static void main(String[] args) throws Exception {
+ Option msg = OptionBuilder.withArgName("msg")
+ .hasArg()
+ .withDescription("the message to capitalize")
+ .create("message");
+ Options options = new Options();
+ options.addOption(msg);
+
+ CommandLineParser parser = new GnuParser();
+ CommandLine line = parser.parse(options, args);
+
+ String message = line.getOptionValue("message", "hello ivy !");
+ System.out.println("standard message : " + message);
+ System.out.println("capitalized by " + WordUtils.class.getName()
+ + " : " + WordUtils.capitalizeFully(message));
+ }
+
+ private Hello() {
+ }
+}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/example/multi-project/projects/find/src/find/FindFile.java
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/find/src/find/FindFile.java b/src/example/multi-project/projects/find/src/find/FindFile.java
index 1e1e7ea..8e54dc2 100644
--- a/src/example/multi-project/projects/find/src/find/FindFile.java
+++ b/src/example/multi-project/projects/find/src/find/FindFile.java
@@ -38,7 +38,7 @@ public final class FindFile {
private static Collection find(Collection files, final String name) {
return CollectionUtils.select(files, new Predicate() {
public boolean evaluate(Object o) {
- return ((File) o).getName().indexOf(name) != -1;
+ return ((File) o).getName().contains(name);
}
});
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/example/multi-project/projects/find/src/find/Main.java
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/find/src/find/Main.java b/src/example/multi-project/projects/find/src/find/Main.java
index 1ed0c7e..ccfa1ce 100644
--- a/src/example/multi-project/projects/find/src/find/Main.java
+++ b/src/example/multi-project/projects/find/src/find/Main.java
@@ -59,8 +59,8 @@ public final class Main {
String name = line.getOptionValue("name", "jar");
Collection files = FindFile.find(dir, name);
System.out.println("listing files in " + dir + " containing " + name);
- for (Iterator it = files.iterator(); it.hasNext();) {
- System.out.println("\t" + it.next() + "\n");
+ for (Object file : files) {
+ System.out.println("\t" + file + "\n");
}
} catch (ParseException exp) {
// oops, something went wrong
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/example/multi-project/projects/list/src/list/ListFile.java
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/list/src/list/ListFile.java b/src/example/multi-project/projects/list/src/list/ListFile.java
index 0985ab7..14a28e7 100644
--- a/src/example/multi-project/projects/list/src/list/ListFile.java
+++ b/src/example/multi-project/projects/list/src/list/ListFile.java
@@ -35,9 +35,8 @@ public final class ListFile {
private static Collection list(File file, Collection files) {
if (file.isDirectory()) {
- File[] f = file.listFiles();
- for (int i = 0; i < f.length; i++) {
- list(f[i], files);
+ for (File f : file.listFiles()) {
+ list(f, files);
}
} else {
files.add(file);
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/example/multi-project/projects/size/src/size/FileSize.java
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/size/src/size/FileSize.java b/src/example/multi-project/projects/size/src/size/FileSize.java
index f0e0163..c2efcf1 100644
--- a/src/example/multi-project/projects/size/src/size/FileSize.java
+++ b/src/example/multi-project/projects/size/src/size/FileSize.java
@@ -33,9 +33,8 @@ public final class FileSize {
public static long totalSize(Collection files) {
long total = 0;
- for (Iterator it = files.iterator(); it.hasNext();) {
- File f = (File) it.next();
- total += f.length();
+ for (Object file : files) {
+ total += ((File) file).length();
}
return total;
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java b/src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java
index 444b2f9..53e4429 100644
--- a/src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java
+++ b/src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java
@@ -86,15 +86,13 @@ public class VfsResource implements Resource {
*
* @return A <code>ArrayList</code> of VFSResources
*/
- public List getChildren() {
+ public List<String> getChildren() {
init();
- ArrayList list = new ArrayList();
+ ArrayList<String> list = new ArrayList<String>();
try {
if ((resourceImpl != null) && resourceImpl.exists()
&& (resourceImpl.getType() == FileType.FOLDER)) {
- FileObject[] children = resourceImpl.getChildren();
- for (int i = 0; i < children.length; i++) {
- FileObject child = children[i];
+ for (FileObject child : resourceImpl.getChildren()) {
list.add(normalize(child.getName().getURI()));
}
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/TestFixture.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/TestFixture.java b/test/java/org/apache/ivy/TestFixture.java
index 9690978..b47b626 100644
--- a/test/java/org/apache/ivy/TestFixture.java
+++ b/test/java/org/apache/ivy/TestFixture.java
@@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.Collection;
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
+import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.report.ResolveReport;
import org.apache.ivy.core.settings.IvySettings;
@@ -64,7 +65,7 @@ import org.apache.ivy.plugins.resolver.util.ResolvedResource;
*/
public class TestFixture {
- private Collection mds = new ArrayList();
+ private final Collection<ModuleDescriptor> mds = new ArrayList<ModuleDescriptor>();
private Ivy ivy;
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/TestHelper.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/TestHelper.java b/test/java/org/apache/ivy/TestHelper.java
index 7963407..1a18c66 100644
--- a/test/java/org/apache/ivy/TestHelper.java
+++ b/test/java/org/apache/ivy/TestHelper.java
@@ -22,7 +22,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
-import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -95,8 +94,8 @@ public class TestHelper {
* the3 mrids to test
*/
public static void assertModuleRevisionIds(String expectedMrids,
- Collection/* <ModuleRevisionId> */mrids) {
- Collection expected = parseMrids(expectedMrids);
+ Collection<ModuleRevisionId> mrids) {
+ Collection<ModuleRevisionId> expected = parseMrids(expectedMrids);
assertEquals(expected, mrids);
}
@@ -108,11 +107,11 @@ public class TestHelper {
* the text representation of the {@link ModuleRevisionId}
* @return a collection of {@link ModuleRevisionId}
*/
- public static Collection parseMrids(String mrids) {
+ public static Collection<ModuleRevisionId> parseMrids(String mrids) {
String[] m = mrids.split(",?\\s+");
- Collection c = new LinkedHashSet();
- for (int i = 0; i < m.length; i++) {
- c.add(ModuleRevisionId.parse(m[i]));
+ Collection<ModuleRevisionId> c = new LinkedHashSet<ModuleRevisionId>();
+ for (String s : m) {
+ c.add(ModuleRevisionId.parse(s));
}
return c;
}
@@ -126,8 +125,8 @@ public class TestHelper {
* @return an array of {@link ModuleRevisionId}
*/
public static ModuleRevisionId[] parseMridsToArray(String mrids) {
- Collection parsedMrids = parseMrids(mrids);
- return (ModuleRevisionId[]) parsedMrids.toArray(new ModuleRevisionId[parsedMrids.size()]);
+ Collection<ModuleRevisionId> parsedMrids = parseMrids(mrids);
+ return parsedMrids.toArray(new ModuleRevisionId[parsedMrids.size()]);
}
/**
@@ -185,9 +184,8 @@ public class TestHelper {
ModuleRevisionId.parse(m.group(1)), new Date());
String mrids = m.group(2);
if (mrids != null) {
- Collection depMrids = parseMrids(mrids);
- for (Iterator iter = depMrids.iterator(); iter.hasNext();) {
- ModuleRevisionId dep = (ModuleRevisionId) iter.next();
+ Collection<ModuleRevisionId> depMrids = parseMrids(mrids);
+ for (ModuleRevisionId dep : depMrids) {
md.addDependency(new DefaultDependencyDescriptor(dep, false));
}
}
@@ -204,11 +202,11 @@ 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++) {
- r.add(parseMicroIvyDescriptor(mds[i]));
+ Collection<ModuleDescriptor> r = new ArrayList<ModuleDescriptor>();
+ for (String md : mds) {
+ r.add(parseMicroIvyDescriptor(md));
}
return r;
}
@@ -223,13 +221,12 @@ public class TestHelper {
* @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();) {
+ for (ModuleDescriptor md : mds) {
boolean overwrite = false;
- ModuleDescriptor md = (ModuleDescriptor) iter.next();
resolver.beginPublishTransaction(md.getModuleRevisionId(), overwrite);
boolean published = false;
try {
@@ -237,9 +234,8 @@ public class TestHelper {
resolver.publish(md.getMetadataArtifact(), tmp, overwrite);
tmp.delete();
tmp.createNewFile();
- Artifact[] artifacts = md.getAllArtifacts();
- for (int i = 0; i < artifacts.length; i++) {
- resolver.publish(artifacts[i], tmp, overwrite);
+ for (Artifact artifact : md.getAllArtifacts()) {
+ resolver.publish(artifact, tmp, overwrite);
}
resolver.commitPublishTransaction();
published = true;
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/ant/AntBuildResolverTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/AntBuildResolverTest.java b/test/java/org/apache/ivy/ant/AntBuildResolverTest.java
index 9e228a4..0bf8bd8 100644
--- a/test/java/org/apache/ivy/ant/AntBuildResolverTest.java
+++ b/test/java/org/apache/ivy/ant/AntBuildResolverTest.java
@@ -85,7 +85,7 @@ public class AntBuildResolverTest {
resolve.setKeep(true);
resolve.execute();
- ResolveReport report = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport report = project.getReference("ivy.resolved.report");
assertEquals(1, report.getDependencies().size());
assertEquals(MRID_MODULE1, report.getDependencies().get(0).getResolvedId());
}
@@ -98,7 +98,7 @@ public class AntBuildResolverTest {
resolve.setKeep(true);
resolve.execute();
- ResolveReport report = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport report = project.getReference("ivy.resolved.report");
assertEquals(2, report.getDependencies().size());
assertEquals(MRID_PROJECT1, report.getDependencies().get(0).getResolvedId());
assertEquals(MRID_MODULE1, report.getDependencies().get(1).getResolvedId());
@@ -122,7 +122,7 @@ public class AntBuildResolverTest {
resolve.setKeep(true);
resolve.execute();
- ResolveReport report = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport report = project.getReference("ivy.resolved.report");
assertEquals(2, report.getDependencies().size());
assertEquals(MRID_PROJECT1, report.getDependencies().get(0).getResolvedId());
assertEquals(MRID_MODULE1, report.getDependencies().get(1).getResolvedId());
@@ -143,7 +143,7 @@ public class AntBuildResolverTest {
resolve.setKeep(true);
resolve.execute();
- ResolveReport report = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport report = project.getReference("ivy.resolved.report");
assertEquals(2, report.getDependencies().size());
assertEquals(MRID_PROJECT1, report.getDependencies().get(0).getResolvedId());
assertEquals(MRID_MODULE1, report.getDependencies().get(1).getResolvedId());
@@ -170,7 +170,7 @@ public class AntBuildResolverTest {
cachePath.setPathid("test.cachepath.id");
cachePath.execute();
- Path path = (Path) project.getReference("test.cachepath.id");
+ Path path = project.getReference("test.cachepath.id");
assertEquals(2, path.size());
assertEquals(
new File("test/workspace/project1/target/dist/jars/project1.jar").getAbsolutePath(),
@@ -194,7 +194,7 @@ public class AntBuildResolverTest {
cachePath.setPathid("test.cachepath.id");
cachePath.execute();
- Path path = (Path) project.getReference("test.cachepath.id");
+ Path path = project.getReference("test.cachepath.id");
assertEquals(2, path.size());
assertEquals(new File("test/workspace/project1/target/classes").getAbsolutePath(),
path.list()[0]);
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/ant/FixDepsTaskTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/FixDepsTaskTest.java b/test/java/org/apache/ivy/ant/FixDepsTaskTest.java
index 42a8037..8811348 100644
--- a/test/java/org/apache/ivy/ant/FixDepsTaskTest.java
+++ b/test/java/org/apache/ivy/ant/FixDepsTaskTest.java
@@ -23,6 +23,7 @@ import java.util.Arrays;
import java.util.List;
import org.apache.ivy.TestHelper;
+import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
import org.apache.ivy.core.settings.IvySettings;
import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
@@ -215,10 +216,10 @@ public class FixDepsTaskTest {
toString(Arrays.asList(md2.getDependencies())));
}
- private List/* <String> */toString(List list) {
- List strings = new ArrayList(list.size());
- for (int i = 0; i < list.size(); i++) {
- strings.add(list.get(i).toString());
+ private List<String> toString(List<DependencyDescriptor> list) {
+ List<String> strings = new ArrayList<String>(list.size());
+ for (DependencyDescriptor dd : list) {
+ strings.add(dd.toString());
}
return strings;
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/ant/IvyBuildListTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/IvyBuildListTest.java b/test/java/org/apache/ivy/ant/IvyBuildListTest.java
index 2599c70..cb5b4e4 100644
--- a/test/java/org/apache/ivy/ant/IvyBuildListTest.java
+++ b/test/java/org/apache/ivy/ant/IvyBuildListTest.java
@@ -340,7 +340,7 @@ public class IvyBuildListTest {
fs.setExcludes("E2/build.xml,F/build.xml,G/build.xml");
buildlist.addFileset(fs);
- buildlist.setOnMissingDescriptor(new String("tail")); // IVY-805: new String instance
+ buildlist.setOnMissingDescriptor("tail"); // IVY-805: new String instance
String[] files = getFiles(buildlist);
@@ -357,7 +357,7 @@ public class IvyBuildListTest {
fs.setExcludes("E2/build.xml,F/build.xml,G/build.xml");
buildlist.addFileset(fs);
- buildlist.setOnMissingDescriptor(new String("skip")); // IVY-805: new String instance
+ buildlist.setOnMissingDescriptor("skip"); // IVY-805: new String instance
String[] files = getFiles(buildlist);
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/ant/IvyDeliverTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/IvyDeliverTest.java b/test/java/org/apache/ivy/ant/IvyDeliverTest.java
index 15ac59a..881b971 100644
--- a/test/java/org/apache/ivy/ant/IvyDeliverTest.java
+++ b/test/java/org/apache/ivy/ant/IvyDeliverTest.java
@@ -385,7 +385,7 @@ public class IvyDeliverTest {
md.getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(1, dds.length);
- Map extraAtt = new HashMap();
+ Map<String, String> extraAtt = new HashMap<String, String>();
extraAtt.put("myExtraAtt", "myValue");
assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2", extraAtt),
dds[0].getDependencyRevisionId());
@@ -423,8 +423,8 @@ public class IvyDeliverTest {
File list = new File("build/test/retrieve");
String[] files = list.list();
- HashSet actualFileSet = new HashSet(Arrays.asList(files));
- HashSet expectedFileSet = new HashSet();
+ HashSet<String> actualFileSet = new HashSet<String>(Arrays.asList(files));
+ HashSet<String> expectedFileSet = new HashSet<String>();
for (DependencyDescriptor dd : dds) {
String name = dd.getDependencyId().getName();
String rev = dd.getDependencyRevisionId().getRevision();
@@ -470,8 +470,8 @@ public class IvyDeliverTest {
File list = new File("build/test/retrieve");
String[] files = list.list();
- HashSet actualFileSet = new HashSet(Arrays.asList(files));
- HashSet expectedFileSet = new HashSet();
+ HashSet<String> actualFileSet = new HashSet<String>(Arrays.asList(files));
+ HashSet<String> expectedFileSet = new HashSet<String>();
for (DependencyDescriptor dd : dds) {
String name = dd.getDependencyId().getName();
String rev = dd.getDependencyRevisionId().getRevision();
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/ant/IvyPostResolveTaskTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/IvyPostResolveTaskTest.java b/test/java/org/apache/ivy/ant/IvyPostResolveTaskTest.java
index 295fc1c..23bbf3f 100644
--- a/test/java/org/apache/ivy/ant/IvyPostResolveTaskTest.java
+++ b/test/java/org/apache/ivy/ant/IvyPostResolveTaskTest.java
@@ -72,12 +72,12 @@ public class IvyPostResolveTaskTest {
resolve.setConf("default,compile");
resolve.execute();
- ResolveReport reportBefore = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport reportBefore = project.getReference("ivy.resolved.report");
task.setConf("default");
task.execute();
- ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport reportAfter = project.getReference("ivy.resolved.report");
assertSame("IvyPostResolveTask has performed a resolve where it shouldn't", reportBefore,
reportAfter);
@@ -91,12 +91,12 @@ public class IvyPostResolveTaskTest {
resolve.setConf("default");
resolve.execute();
- ResolveReport reportBefore = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport reportBefore = project.getReference("ivy.resolved.report");
task.setConf("default");
task.execute();
- ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport reportAfter = project.getReference("ivy.resolved.report");
assertSame("IvyPostResolveTask has performed a resolve where it shouldn't", reportBefore,
reportAfter);
@@ -110,12 +110,12 @@ public class IvyPostResolveTaskTest {
resolve.setConf("*");
resolve.execute();
- ResolveReport reportBefore = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport reportBefore = project.getReference("ivy.resolved.report");
task.setConf("default");
task.execute();
- ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport reportAfter = project.getReference("ivy.resolved.report");
assertSame("IvyPostResolveTask has performed a resolve where it shouldn't", reportBefore,
reportAfter);
@@ -129,12 +129,12 @@ public class IvyPostResolveTaskTest {
resolve.setConf("*");
resolve.execute();
- ResolveReport reportBefore = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport reportBefore = project.getReference("ivy.resolved.report");
task.setConf("*");
task.execute();
- ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport reportAfter = project.getReference("ivy.resolved.report");
assertSame("IvyPostResolveTask has performed a resolve where it shouldn't", reportBefore,
reportAfter);
@@ -148,14 +148,14 @@ public class IvyPostResolveTaskTest {
resolve.setConf("compile");
resolve.execute();
- ResolveReport reportBefore = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport reportBefore = project.getReference("ivy.resolved.report");
assertTrue(getArchiveFileInCache("org1", "mod1.1", "2.0", "mod1.1", "jar", "jar").exists());
assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
task.setConf("*");
task.execute();
- ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport reportAfter = project.getReference("ivy.resolved.report");
assertNotSame("IvyPostResolveTask hasn't performed a resolve where it should have",
reportBefore, reportAfter);
@@ -170,7 +170,7 @@ public class IvyPostResolveTaskTest {
resolve.setConf("compile");
resolve.execute();
- ResolveReport reportBefore = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport reportBefore = project.getReference("ivy.resolved.report");
assertTrue(getArchiveFileInCache("org1", "mod1.1", "2.0", "mod1.1", "jar", "jar").exists());
assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
@@ -178,7 +178,7 @@ public class IvyPostResolveTaskTest {
task.setKeep(false); // don't keep the resolve results
task.execute();
- ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport reportAfter = project.getReference("ivy.resolved.report");
assertSame("IvyPostResolveTask has kept the resolve report where it should have",
reportBefore, reportAfter);
@@ -194,7 +194,7 @@ public class IvyPostResolveTaskTest {
task.setConf("*"); // will trigger a resolve
task.execute();
- ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport reportAfter = project.getReference("ivy.resolved.report");
assertNull("IvyPostResolveTask has kept the resolve report where it should have",
reportAfter);
@@ -211,7 +211,7 @@ public class IvyPostResolveTaskTest {
task.setConf("*"); // will trigger a resolve
task.execute();
- ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport reportAfter = project.getReference("ivy.resolved.report");
assertNotNull("IvyPostResolveTask has kept the resolve report where it should have",
reportAfter);
@@ -227,8 +227,7 @@ public class IvyPostResolveTaskTest {
resolve.setResolveId("testResolveId");
resolve.execute();
- ResolveReport report1 = (ResolveReport) project
- .getReference("ivy.resolved.report.testResolveId");
+ ResolveReport report1 = project.getReference("ivy.resolved.report.testResolveId");
// perform another resolve
resolve = new IvyResolve();
@@ -237,14 +236,14 @@ public class IvyPostResolveTaskTest {
resolve.setConf("*");
resolve.execute();
- ResolveReport reportBefore = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport reportBefore = project.getReference("ivy.resolved.report");
task.setConf("default");
task.setResolveId("testResolveId");
task.execute();
- ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
- ResolveReport report2 = (ResolveReport) project
+ ResolveReport reportAfter = project.getReference("ivy.resolved.report");
+ ResolveReport report2 = project
.getReference("ivy.resolved.report.testResolveId");
assertSame("IvyPostResolveTask has performed a resolve where it shouldn't", reportBefore,
@@ -262,7 +261,7 @@ public class IvyPostResolveTaskTest {
resolve.setResolveId("testResolveId");
resolve.execute();
- ResolveReport report1 = (ResolveReport) project
+ ResolveReport report1 = project
.getReference("ivy.resolved.report.testResolveId");
// perform another resolve
@@ -272,14 +271,14 @@ public class IvyPostResolveTaskTest {
resolve.setConf("*");
resolve.execute();
- ResolveReport reportBefore = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport reportBefore = project.getReference("ivy.resolved.report");
task.setConf("default");
task.setResolveId("testResolveId");
task.execute();
- ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
- ResolveReport report2 = (ResolveReport) project
+ ResolveReport reportAfter = project.getReference("ivy.resolved.report");
+ ResolveReport report2 = project
.getReference("ivy.resolved.report.testResolveId");
assertSame("IvyPostResolveTask has performed a resolve where it shouldn't", reportBefore,
@@ -297,7 +296,7 @@ public class IvyPostResolveTaskTest {
resolve.setResolveId("testResolveId");
resolve.execute();
- ResolveReport report1 = (ResolveReport) project
+ ResolveReport report1 = project
.getReference("ivy.resolved.report.testResolveId");
// perform another resolve
@@ -307,14 +306,14 @@ public class IvyPostResolveTaskTest {
resolve.setConf("*");
resolve.execute();
- ResolveReport reportBefore = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport reportBefore = project.getReference("ivy.resolved.report");
task.setConf("default");
task.setResolveId("testResolveId");
task.execute();
- ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
- ResolveReport report2 = (ResolveReport) project
+ ResolveReport reportAfter = project.getReference("ivy.resolved.report");
+ ResolveReport report2 = project
.getReference("ivy.resolved.report.testResolveId");
assertSame("IvyPostResolveTask has performed a resolve where it shouldn't", reportBefore,
@@ -332,7 +331,7 @@ public class IvyPostResolveTaskTest {
resolve.setResolveId("testResolveId");
resolve.execute();
- ResolveReport report1 = (ResolveReport) project
+ ResolveReport report1 = project
.getReference("ivy.resolved.report.testResolveId");
// perform another resolve
@@ -342,14 +341,14 @@ public class IvyPostResolveTaskTest {
resolve.setConf("*");
resolve.execute();
- ResolveReport reportBefore = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport reportBefore = project.getReference("ivy.resolved.report");
task.setConf("*");
task.setResolveId("testResolveId");
task.execute();
- ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
- ResolveReport report2 = (ResolveReport) project
+ ResolveReport reportAfter = project.getReference("ivy.resolved.report");
+ ResolveReport report2 = project
.getReference("ivy.resolved.report.testResolveId");
assertSame("IvyPostResolveTask has performed a resolve where it shouldn't", reportBefore,
@@ -367,7 +366,7 @@ public class IvyPostResolveTaskTest {
resolve.setResolveId("testResolveId");
resolve.execute();
- ResolveReport report1 = (ResolveReport) project
+ ResolveReport report1 = project
.getReference("ivy.resolved.report.testResolveId");
assertTrue(getArchiveFileInCache("org1", "mod1.1", "2.0", "mod1.1", "jar", "jar").exists());
assertFalse(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar", "jar").exists());
@@ -379,14 +378,14 @@ public class IvyPostResolveTaskTest {
resolve.setConf("*");
resolve.execute();
- ResolveReport reportBefore = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport reportBefore = project.getReference("ivy.resolved.report");
task.setConf("*");
task.setResolveId("testResolveId");
task.execute();
- ResolveReport reportAfter = (ResolveReport) project.getReference("ivy.resolved.report");
- ResolveReport report2 = (ResolveReport) project
+ ResolveReport reportAfter = project.getReference("ivy.resolved.report");
+ ResolveReport report2 = project
.getReference("ivy.resolved.report.testResolveId");
assertNotSame("IvyPostResolveTask hasn't performed a resolve where it should have",
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/ant/IvyResolveTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/IvyResolveTest.java b/test/java/org/apache/ivy/ant/IvyResolveTest.java
index 49cfd91..ee220e9 100644
--- a/test/java/org/apache/ivy/ant/IvyResolveTest.java
+++ b/test/java/org/apache/ivy/ant/IvyResolveTest.java
@@ -101,7 +101,7 @@ public class IvyResolveTest {
resolve.setKeep(true);
resolve.execute();
- ResolveReport report = (ResolveReport) project.getReference("ivy.resolved.report");
+ ResolveReport report = project.getReference("ivy.resolved.report");
assertNotNull(report);
assertFalse(report.hasError());
assertEquals(1, report.getArtifacts().size());
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/ant/IvyResourcesTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/IvyResourcesTest.java b/test/java/org/apache/ivy/ant/IvyResourcesTest.java
index 95a9c9d..ab60e6d 100644
--- a/test/java/org/apache/ivy/ant/IvyResourcesTest.java
+++ b/test/java/org/apache/ivy/ant/IvyResourcesTest.java
@@ -22,7 +22,6 @@ import static org.junit.Assert.assertTrue;
import java.io.File;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import org.apache.ivy.Ivy;
@@ -66,9 +65,7 @@ public class IvyResourcesTest {
private List asList(IvyResources ivyResources) {
List resources = new ArrayList();
- Iterator it = ivyResources.iterator();
- while (it.hasNext()) {
- Object r = it.next();
+ for (Object r : ivyResources) {
assertTrue(r instanceof FileResource);
resources.add(((FileResource) r).getFile());
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/core/module/id/ModuleIdTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/module/id/ModuleIdTest.java b/test/java/org/apache/ivy/core/module/id/ModuleIdTest.java
index d65b91a..6adc823 100644
--- a/test/java/org/apache/ivy/core/module/id/ModuleIdTest.java
+++ b/test/java/org/apache/ivy/core/module/id/ModuleIdTest.java
@@ -69,7 +69,7 @@ public class ModuleIdTest {
ModuleId moduleId = new ModuleId(org, name);
ModuleId moduleId2 = new ModuleId(null, name);
- assertFalse(moduleId.equals(null));
+ assertNotNull(moduleId);
assertFalse(moduleId.equals(moduleId2));
assertFalse(moduleId2.equals(moduleId));
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/core/publish/PublishEventsTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/publish/PublishEventsTest.java b/test/java/org/apache/ivy/core/publish/PublishEventsTest.java
index 6062441..858d44a 100644
--- a/test/java/org/apache/ivy/core/publish/PublishEventsTest.java
+++ b/test/java/org/apache/ivy/core/publish/PublishEventsTest.java
@@ -23,7 +23,6 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
-import java.util.Iterator;
import org.apache.ivy.Ivy;
import org.apache.ivy.core.IvyContext;
@@ -247,8 +246,8 @@ public class PublishEventsTest {
// set an error to be thrown during publication of the data file.
this.publishError = new IOException("boom!");
// we don't care which artifact is attempted; either will fail with an IOException.
- for (Iterator it = expectedPublications.values().iterator(); it.hasNext();) {
- ((PublishTestCase) it.next()).expectedSuccess = false;
+ for (Object o : expectedPublications.values()) {
+ ((PublishTestCase) o).expectedSuccess = false;
}
try {
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/core/search/SearchTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/search/SearchTest.java b/test/java/org/apache/ivy/core/search/SearchTest.java
index 2fa96ee..e56f9bd 100644
--- a/test/java/org/apache/ivy/core/search/SearchTest.java
+++ b/test/java/org/apache/ivy/core/search/SearchTest.java
@@ -42,13 +42,13 @@ public class SearchTest {
Ivy ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/m2/ivysettings.xml").toURI().toURL());
- Map otherTokenValues = new HashMap();
+ Map<String, Object> otherTokenValues = new HashMap<String, Object>();
otherTokenValues.put(IvyPatternHelper.ORGANISATION_KEY, "org.apache");
otherTokenValues.put(IvyPatternHelper.MODULE_KEY, "test-metadata");
String[] revs = ivy.listTokenValues(IvyPatternHelper.REVISION_KEY, otherTokenValues);
- assertEquals(new HashSet(Arrays.asList(new String[] {"1.0", "1.1"})),
- new HashSet(Arrays.asList(revs)));
+ assertEquals(new HashSet<String>(Arrays.asList(new String[] {"1.0", "1.1"})),
+ new HashSet<String>(Arrays.asList(revs)));
}
@Test
@@ -57,13 +57,13 @@ public class SearchTest {
ivy.configure(new File("test/repositories/m2/ivysettings.xml").toURI().toURL());
((IBiblioResolver) ivy.getSettings().getResolver("m2")).setUseMavenMetadata(false);
- Map otherTokenValues = new HashMap();
+ Map<String, Object> otherTokenValues = new HashMap<String, Object>();
otherTokenValues.put(IvyPatternHelper.ORGANISATION_KEY, "org.apache");
otherTokenValues.put(IvyPatternHelper.MODULE_KEY, "test-metadata");
String[] revs = ivy.listTokenValues(IvyPatternHelper.REVISION_KEY, otherTokenValues);
- assertEquals(new HashSet(Arrays.asList(new String[] {"1.0", "1.1", "1.2"})), new HashSet(
- Arrays.asList(revs)));
+ assertEquals(new HashSet<String>(Arrays.asList(new String[] {"1.0", "1.1", "1.2"})),
+ new HashSet<String>(Arrays.asList(revs)));
}
@Test
@@ -72,7 +72,7 @@ public class SearchTest {
ivy.configure(new File("test/repositories/IVY-1128/ivysettings.xml"));
IvySettings settings = ivy.getSettings();
- Map extendedAttributes = new HashMap();
+ Map<String, String> extendedAttributes = new HashMap<String, String>();
extendedAttributes.put("e:att1", "extraatt");
extendedAttributes.put("e:att2", "extraatt2");
ModuleRevisionId criteria = ModuleRevisionId.newInstance("test", "a", "*",
@@ -85,12 +85,12 @@ public class SearchTest {
ModuleRevisionId mrid = mrids[0];
assertEquals("extraatt", mrid.getExtraAttribute("att1"));
- Map extraAttributes = mrid.getExtraAttributes();
+ Map<String, String> extraAttributes = mrid.getExtraAttributes();
assertEquals(2, extraAttributes.size());
assertTrue(extraAttributes.toString(), extraAttributes.keySet().contains("att1"));
assertTrue(extraAttributes.toString(), extraAttributes.keySet().contains("att2"));
- Map qualifiedExtraAttributes = mrid.getQualifiedExtraAttributes();
+ Map<String, String> qualifiedExtraAttributes = mrid.getQualifiedExtraAttributes();
assertEquals(2, qualifiedExtraAttributes.size());
assertTrue(qualifiedExtraAttributes.toString(),
qualifiedExtraAttributes.keySet().contains("e:att1"));
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/core/sort/SortTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/sort/SortTest.java b/test/java/org/apache/ivy/core/sort/SortTest.java
index 4a8477d..9dda5df 100644
--- a/test/java/org/apache/ivy/core/sort/SortTest.java
+++ b/test/java/org/apache/ivy/core/sort/SortTest.java
@@ -21,7 +21,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
-import java.util.Iterator;
import java.util.List;
import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
@@ -83,9 +82,8 @@ public class SortTest {
DefaultModuleDescriptor[][] expectedOrder = new DefaultModuleDescriptor[][] {
{md1, md2, md3, md4}};
- Collection permutations = getAllLists(md1, md3, md2, md4);
- for (Iterator it = permutations.iterator(); it.hasNext();) {
- List toSort = (List) it.next();
+ Collection<List<ModuleDescriptor>> permutations = getAllLists(md1, md3, md2, md4);
+ for (List<ModuleDescriptor> toSort : permutations) {
assertSorted(expectedOrder, sortModuleDescriptors(toSort, nonMatchReporter));
}
}
@@ -106,9 +104,8 @@ public class SortTest {
{md2, md3, md4, md1}, {md3, md4, md1, md2}, {md4, md1, md2, md3},
{md1, md2, md3, md4}};
- Collection permutations = getAllLists(md1, md3, md2, md4);
- for (Iterator it = permutations.iterator(); it.hasNext();) {
- List toSort = (List) it.next();
+ Collection<List<ModuleDescriptor>> permutations = getAllLists(md1, md3, md2, md4);
+ for (List<ModuleDescriptor> toSort : permutations) {
assertSorted(possibleOrder, sortModuleDescriptors(toSort, nonMatchReporter));
}
}
@@ -124,9 +121,8 @@ public class SortTest {
// {md3, md1, md2, md4}
// we don't have this solution. The loops appear has one contiguous element.
};
- Collection permutations = getAllLists(md1, md3, md2, md4);
- for (Iterator it = permutations.iterator(); it.hasNext();) {
- List toSort = (List) it.next();
+ Collection<List<ModuleDescriptor>> permutations = getAllLists(md1, md3, md2, md4);
+ for (List<ModuleDescriptor> toSort : permutations) {
assertSorted(possibleOrder, sortModuleDescriptors(toSort, nonMatchReporter));
}
}
@@ -140,7 +136,7 @@ public class SortTest {
addDependency(md3, "md4", "rev4");
addDependency(md4, "md1", "rev1");
addDependency(md4, "md2", "rev2");
- List toSort = Arrays.asList(new Object[] {md1, md2, md3, md4});
+ List<ModuleDescriptor> toSort = Arrays.asList(new ModuleDescriptor[] {md1, md2, md3, md4});
sortModuleDescriptors(toSort, nonMatchReporter);
// If it ends, it's ok.
}
@@ -188,7 +184,7 @@ public class SortTest {
CircularDependencyReporterMock circularDepReportMock = new CircularDependencyReporterMock();
settings.setCircularDependencyStrategy(circularDepReportMock);
- List toSort = Arrays.asList(new ModuleDescriptor[] {md4, md3, md2, md1});
+ List<ModuleDescriptor> toSort = Arrays.asList(new ModuleDescriptor[] {md4, md3, md2, md1});
sortModuleDescriptors(toSort, nonMatchReporter);
circularDepReportMock.validate();
@@ -210,9 +206,8 @@ public class SortTest {
DefaultModuleDescriptor[][] expectedOrder = new DefaultModuleDescriptor[][] {
{md1, md2, md3, md4}};
- Collection permutations = getAllLists(md1, md3, md2, md4);
- for (Iterator it = permutations.iterator(); it.hasNext();) {
- List toSort = (List) it.next();
+ Collection<List<ModuleDescriptor>> permutations = getAllLists(md1, md3, md2, md4);
+ for (List<ModuleDescriptor> toSort : permutations) {
assertSorted(expectedOrder, sortModuleDescriptors(toSort, nonMatchReporter));
}
@@ -237,9 +232,8 @@ public class SortTest {
DefaultModuleDescriptor[][] possibleOrder = new DefaultModuleDescriptor[][] {
{md1, md2, md3, md4}};
- Collection permutations = getAllLists(md1, md3, md2, md4);
- for (Iterator it = permutations.iterator(); it.hasNext();) {
- List toSort = (List) it.next();
+ Collection<List<ModuleDescriptor>> permutations = getAllLists(md1, md3, md2, md4);
+ for (List<ModuleDescriptor> toSort : permutations) {
assertSorted(possibleOrder, sortModuleDescriptors(toSort, nonMatchReporter));
}
@@ -273,12 +267,12 @@ public class SortTest {
}
}
NonMatchingVersionReporterMock nonMatchingVersionReporterMock = new NonMatchingVersionReporterMock();
- List toSort = Arrays.asList(new ModuleDescriptor[] {md4, md3, md2, md1});
+ List<ModuleDescriptor> toSort = Arrays.asList(new ModuleDescriptor[] {md4, md3, md2, md1});
sortModuleDescriptors(toSort, nonMatchingVersionReporterMock);
nonMatchingVersionReporterMock.validate();
}
- private List sortModuleDescriptors(List toSort,
+ private List<ModuleDescriptor> sortModuleDescriptors(List<ModuleDescriptor> toSort,
NonMatchingVersionReporter nonMatchingVersionReporter) {
return sortEngine.sortModuleDescriptors(toSort,
new SortOptions().setNonMatchingVersionReporter(nonMatchingVersionReporter));
@@ -299,16 +293,16 @@ public class SortTest {
}
/**
- * Verifies that sorted in one of the list of listOfPossibleSort.
+ * Verifies that sorted is one of the lists of listOfPossibleSort.
*
* @param listOfPossibleSort
* array of possible sort result
* @param sorted
* actual sortedList to compare
*/
- private void assertSorted(DefaultModuleDescriptor[][] listOfPossibleSort, List sorted) {
- for (int i = 0; i < listOfPossibleSort.length; i++) {
- DefaultModuleDescriptor[] expectedList = listOfPossibleSort[i];
+ private void assertSorted(DefaultModuleDescriptor[][] listOfPossibleSort,
+ List<ModuleDescriptor> sorted) {
+ for (DefaultModuleDescriptor[] expectedList : listOfPossibleSort) {
assertEquals(expectedList.length, sorted.size());
boolean isExpected = true;
for (int j = 0; j < expectedList.length; j++) {
@@ -328,7 +322,7 @@ public class SortTest {
if (i > 0) {
errorMessage.append(" , ");
}
- errorMessage.append(((DefaultModuleDescriptor) sorted.get(i)).getModuleRevisionId());
+ errorMessage.append(sorted.get(i).getModuleRevisionId());
}
errorMessage.append("}\nExpected : \n");
for (int i = 0; i < listOfPossibleSort.length; i++) {
@@ -349,33 +343,34 @@ public class SortTest {
}
/** Returns a collection of lists that contains the elements a,b,c and d */
- private Collection getAllLists(Object a, Object b, Object c, Object d) {
+ private Collection<List<ModuleDescriptor>> getAllLists(ModuleDescriptor a, ModuleDescriptor b,
+ ModuleDescriptor c, ModuleDescriptor d) {
final int nbOfList = 24;
- ArrayList r = new ArrayList(nbOfList);
- r.add(Arrays.asList(new Object[] {a, b, c, d}));
- r.add(Arrays.asList(new Object[] {a, b, d, c}));
- r.add(Arrays.asList(new Object[] {a, c, b, d}));
- r.add(Arrays.asList(new Object[] {a, c, d, b}));
- r.add(Arrays.asList(new Object[] {a, d, b, c}));
- r.add(Arrays.asList(new Object[] {a, d, c, b}));
- r.add(Arrays.asList(new Object[] {b, a, c, d}));
- r.add(Arrays.asList(new Object[] {b, a, d, c}));
- r.add(Arrays.asList(new Object[] {b, c, a, d}));
- r.add(Arrays.asList(new Object[] {b, c, d, a}));
- r.add(Arrays.asList(new Object[] {b, d, a, c}));
- r.add(Arrays.asList(new Object[] {b, d, c, a}));
- r.add(Arrays.asList(new Object[] {c, b, a, d}));
- r.add(Arrays.asList(new Object[] {c, b, d, a}));
- r.add(Arrays.asList(new Object[] {c, a, b, d}));
- r.add(Arrays.asList(new Object[] {c, a, d, b}));
- r.add(Arrays.asList(new Object[] {c, d, b, a}));
- r.add(Arrays.asList(new Object[] {c, d, a, b}));
- r.add(Arrays.asList(new Object[] {d, b, c, a}));
- r.add(Arrays.asList(new Object[] {d, b, a, c}));
- r.add(Arrays.asList(new Object[] {d, c, b, a}));
- r.add(Arrays.asList(new Object[] {d, c, a, b}));
- r.add(Arrays.asList(new Object[] {d, a, b, c}));
- r.add(Arrays.asList(new Object[] {d, a, c, b}));
+ Collection<List<ModuleDescriptor>> r = new ArrayList<List<ModuleDescriptor>>(nbOfList);
+ r.add(Arrays.asList(new ModuleDescriptor[] {a, b, c, d}));
+ r.add(Arrays.asList(new ModuleDescriptor[] {a, b, d, c}));
+ r.add(Arrays.asList(new ModuleDescriptor[] {a, c, b, d}));
+ r.add(Arrays.asList(new ModuleDescriptor[] {a, c, d, b}));
+ r.add(Arrays.asList(new ModuleDescriptor[] {a, d, b, c}));
+ r.add(Arrays.asList(new ModuleDescriptor[] {a, d, c, b}));
+ r.add(Arrays.asList(new ModuleDescriptor[] {b, a, c, d}));
+ r.add(Arrays.asList(new ModuleDescriptor[] {b, a, d, c}));
+ r.add(Arrays.asList(new ModuleDescriptor[] {b, c, a, d}));
+ r.add(Arrays.asList(new ModuleDescriptor[] {b, c, d, a}));
+ r.add(Arrays.asList(new ModuleDescriptor[] {b, d, a, c}));
+ r.add(Arrays.asList(new ModuleDescriptor[] {b, d, c, a}));
+ r.add(Arrays.asList(new ModuleDescriptor[] {c, b, a, d}));
+ r.add(Arrays.asList(new ModuleDescriptor[] {c, b, d, a}));
+ r.add(Arrays.asList(new ModuleDescriptor[] {c, a, b, d}));
+ r.add(Arrays.asList(new ModuleDescriptor[] {c, a, d, b}));
+ r.add(Arrays.asList(new ModuleDescriptor[] {c, d, b, a}));
+ r.add(Arrays.asList(new ModuleDescriptor[] {c, d, a, b}));
+ r.add(Arrays.asList(new ModuleDescriptor[] {d, b, c, a}));
+ r.add(Arrays.asList(new ModuleDescriptor[] {d, b, a, c}));
+ r.add(Arrays.asList(new ModuleDescriptor[] {d, c, b, a}));
+ r.add(Arrays.asList(new ModuleDescriptor[] {d, c, a, b}));
+ r.add(Arrays.asList(new ModuleDescriptor[] {d, a, b, c}));
+ r.add(Arrays.asList(new ModuleDescriptor[] {d, a, c, b}));
return r;
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/plugins/conflict/LatestConflictManagerTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/conflict/LatestConflictManagerTest.java b/test/java/org/apache/ivy/plugins/conflict/LatestConflictManagerTest.java
index cdefcea..3a9e113 100644
--- a/test/java/org/apache/ivy/plugins/conflict/LatestConflictManagerTest.java
+++ b/test/java/org/apache/ivy/plugins/conflict/LatestConflictManagerTest.java
@@ -65,8 +65,7 @@ public class LatestConflictManagerTest {
String[] confs = report.getConfigurations();
while (dependencies.hasNext()) {
IvyNode node = (IvyNode) dependencies.next();
- for (int i = 0; i < confs.length; i++) {
- String conf = confs[i];
+ for (String conf : confs) {
if (!node.isEvicted(conf)) {
boolean flag1 = report.getConfigurationReport(conf).getDependency(
node.getResolvedId()) != null;
@@ -85,9 +84,7 @@ public class LatestConflictManagerTest {
ResolveReport report = ivy.resolve(
LatestConflictManagerTest.class.getResource("ivy-383.xml"), getResolveOptions());
ConfigurationResolveReport defaultReport = report.getConfigurationReport("default");
- Iterator iter = defaultReport.getModuleRevisionIds().iterator();
- while (iter.hasNext()) {
- ModuleRevisionId mrid = (ModuleRevisionId) iter.next();
+ for (ModuleRevisionId mrid : defaultReport.getModuleRevisionIds()) {
if (mrid.getName().equals("mod1.1")) {
assertEquals("1.0", mrid.getRevision());
} else if (mrid.getName().equals("mod1.2")) {
@@ -114,9 +111,7 @@ public class LatestConflictManagerTest {
LatestConflictManagerTest.class.getResource("ivy-latest-time-1.xml"),
getResolveOptions());
ConfigurationResolveReport defaultReport = report.getConfigurationReport("default");
- Iterator iter = defaultReport.getModuleRevisionIds().iterator();
- while (iter.hasNext()) {
- ModuleRevisionId mrid = (ModuleRevisionId) iter.next();
+ for (ModuleRevisionId mrid : defaultReport.getModuleRevisionIds()) {
if (mrid.getName().equals("mod1.1")) {
assertEquals("1.0", mrid.getRevision());
} else if (mrid.getName().equals("mod1.2")) {
@@ -142,9 +137,7 @@ public class LatestConflictManagerTest {
LatestConflictManagerTest.class.getResource("ivy-latest-time-2.xml"),
getResolveOptions());
ConfigurationResolveReport defaultReport = report.getConfigurationReport("default");
- Iterator iter = defaultReport.getModuleRevisionIds().iterator();
- while (iter.hasNext()) {
- ModuleRevisionId mrid = (ModuleRevisionId) iter.next();
+ for (ModuleRevisionId mrid : defaultReport.getModuleRevisionIds()) {
if (mrid.getName().equals("mod1.1")) {
assertEquals("1.0", mrid.getRevision());
} else if (mrid.getName().equals("mod1.2")) {
@@ -180,10 +173,7 @@ public class LatestConflictManagerTest {
LatestConflictManagerTest.class.getResource("ivy-latest-time-transitivity.xml"),
getResolveOptions());
ConfigurationResolveReport defaultReport = report.getConfigurationReport("default");
- Iterator iter = defaultReport.getModuleRevisionIds().iterator();
- while (iter.hasNext()) {
- ModuleRevisionId mrid = (ModuleRevisionId) iter.next();
-
+ for (ModuleRevisionId mrid : defaultReport.getModuleRevisionIds()) {
if (mrid.getName().equals("A")) {
assertEquals("A revision should be 1.0.0", "1.0.0", mrid.getRevision());
} else if (mrid.getName().equals("D")) {
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/plugins/matcher/AbstractPatternMatcherTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/matcher/AbstractPatternMatcherTest.java b/test/java/org/apache/ivy/plugins/matcher/AbstractPatternMatcherTest.java
index b7f532f..62df8ec 100644
--- a/test/java/org/apache/ivy/plugins/matcher/AbstractPatternMatcherTest.java
+++ b/test/java/org/apache/ivy/plugins/matcher/AbstractPatternMatcherTest.java
@@ -52,20 +52,20 @@ public abstract class AbstractPatternMatcherTest {
// test some exact patterns for this matcher
String[] expressions = getExactExpressions();
- for (int i = 0; i < expressions.length; i++) {
- matcher = patternMatcher.getMatcher(expressions[i]);
- assertTrue("Expression '" + expressions[i] + "' should be exact", matcher.isExact());
+ for (String expression : expressions) {
+ matcher = patternMatcher.getMatcher(expression);
+ assertTrue("Expression '" + expression + "' should be exact", matcher.isExact());
matcher.matches("The words aren't what they were.");
- assertTrue("Expression '" + expressions[i] + "' should be exact", matcher.isExact());
+ assertTrue("Expression '" + expression + "' should be exact", matcher.isExact());
}
// test some inexact patterns for this matcher
expressions = getInexactExpressions();
- for (int i = 0; i < expressions.length; i++) {
- matcher = patternMatcher.getMatcher(expressions[i]);
- assertFalse("Expression '" + expressions[i] + "' should be inexact", matcher.isExact());
+ for (String expression : expressions) {
+ matcher = patternMatcher.getMatcher(expression);
+ assertFalse("Expression '" + expression + "' should be inexact", matcher.isExact());
matcher.matches("The words aren't what they were.");
- assertFalse("Expression '" + expressions[i] + "' should be inexact", matcher.isExact());
+ assertFalse("Expression '" + expression + "' should be inexact", matcher.isExact());
}
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java b/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java
index 68be597..5e687b9 100644
--- a/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java
+++ b/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java
@@ -301,9 +301,8 @@ public class XmlModuleUpdaterTest {
assertEquals("Number of published artifacts incorrect", 4, artifacts.length);
// test that the correct configuration has been removed
- for (int i = 0; i < artifacts.length; i++) {
- Artifact current = artifacts[i];
- List currentConfs = Arrays.asList(current.getConfigurations());
+ for (Artifact current : artifacts) {
+ List<String> currentConfs = Arrays.asList(current.getConfigurations());
assertTrue("myconf2 hasn't been removed for artifact " + current.getName(),
!currentConfs.contains("myconf2"));
}
@@ -327,13 +326,14 @@ public class XmlModuleUpdaterTest {
assertEquals("Number of dependencies is incorrect", 8, deps.length);
// check that none of the dependencies contains myconf2
- for (int i = 0; i < deps.length; i++) {
- String name = deps[i].getDependencyId().getName();
+ for (DependencyDescriptor dep : deps) {
+ String name = dep.getDependencyId().getName();
assertFalse("Dependency " + name + " shouldn't have myconf2 as module configuration",
- Arrays.asList(deps[i].getModuleConfigurations()).contains("myconf2"));
- assertEquals("Dependency " + name
- + " shouldn't have a dependency artifact for configuration myconf2", 0,
- deps[i].getDependencyArtifacts("myconf2").length);
+ Arrays.asList(dep.getModuleConfigurations()).contains("myconf2"));
+ assertEquals(
+ "Dependency " + name
+ + " shouldn't have a dependency artifact for configuration myconf2",
+ 0, dep.getDependencyArtifacts("myconf2").length);
}
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/plugins/repository/vfs/VfsRepositoryTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/repository/vfs/VfsRepositoryTest.java b/test/java/org/apache/ivy/plugins/repository/vfs/VfsRepositoryTest.java
index 2624d49..fe2fae4 100644
--- a/test/java/org/apache/ivy/plugins/repository/vfs/VfsRepositoryTest.java
+++ b/test/java/org/apache/ivy/plugins/repository/vfs/VfsRepositoryTest.java
@@ -19,7 +19,6 @@ package org.apache.ivy.plugins.repository.vfs;
import java.io.File;
import java.io.IOException;
-import java.util.Iterator;
import org.apache.ivy.util.FileUtil;
@@ -80,9 +79,7 @@ public class VfsRepositoryTest {
String destResource = VfsTestHelper.SCRATCH_DIR + "/" + testResource;
String destFile = FileUtil.concat(VfsTestHelper.TEST_REPO_DIR, destResource);
- Iterator vfsURIs = helper.createVFSUriSet(destResource).iterator();
- while (vfsURIs.hasNext()) {
- VfsURI vfsURI = (VfsURI) vfsURIs.next();
+ for (VfsURI vfsURI : helper.createVFSUriSet(destResource)) {
if (scratchDir.exists()) {
FileUtil.forceDelete(scratchDir);
}
@@ -110,10 +107,7 @@ public class VfsRepositoryTest {
String destResource = VfsTestHelper.SCRATCH_DIR + "/" + testResource;
File destFile = new File(FileUtil.concat(VfsTestHelper.TEST_REPO_DIR, destResource));
- Iterator vfsURIs = helper.createVFSUriSet(destResource).iterator();
- while (vfsURIs.hasNext()) {
- VfsURI vfsURI = (VfsURI) vfsURIs.next();
-
+ for (VfsURI vfsURI : helper.createVFSUriSet(destResource)) {
// remove existing scratch dir and populate it with an empty file
// that we can overwrite. We do this so that we can test file sizes.
// seeded file has length 0, while put file will have a length > 0
@@ -150,9 +144,7 @@ public class VfsRepositoryTest {
destFile.getParentFile().mkdirs();
destFile.createNewFile();
- Iterator vfsURIs = helper.createVFSUriSet(destResource).iterator();
- while (vfsURIs.hasNext()) {
- VfsURI vfsURI = (VfsURI) vfsURIs.next();
+ for (VfsURI vfsURI : helper.createVFSUriSet(destResource)) {
repo.put(new File(srcFile), vfsURI.toString(), false);
}
}
@@ -167,9 +159,7 @@ public class VfsRepositoryTest {
String testResource = VfsTestHelper.TEST_IVY_XML;
String testFile = FileUtil.concat(scratchDir.getAbsolutePath(), testResource);
- Iterator vfsURIs = helper.createVFSUriSet(testResource).iterator();
- while (vfsURIs.hasNext()) {
- VfsURI vfsURI = (VfsURI) vfsURIs.next();
+ for (VfsURI vfsURI : helper.createVFSUriSet(testResource)) {
if (scratchDir.exists()) {
FileUtil.forceDelete(scratchDir);
}
@@ -195,10 +185,7 @@ public class VfsRepositoryTest {
String testResource = VfsTestHelper.TEST_IVY_XML;
File testFile = new File(FileUtil.concat(scratchDir.getAbsolutePath(), testResource));
- Iterator vfsURIs = helper.createVFSUriSet(testResource).iterator();
- while (vfsURIs.hasNext()) {
- VfsURI vfsURI = (VfsURI) vfsURIs.next();
-
+ for (VfsURI vfsURI : helper.createVFSUriSet(testResource)) {
// setup - remove existing scratch area and populate with a file to override
if (scratchDir.exists()) {
FileUtil.forceDelete(scratchDir);
@@ -227,10 +214,7 @@ public class VfsRepositoryTest {
public void testGetResourceValidExist() throws Exception {
String testResource = VfsTestHelper.TEST_IVY_XML;
- Iterator vfsURIs = helper.createVFSUriSet(testResource).iterator();
-
- while (vfsURIs.hasNext()) {
- VfsURI vfsURI = (VfsURI) vfsURIs.next();
+ for (VfsURI vfsURI : helper.createVFSUriSet(testResource)) {
try {
assertNotNull(repo.getResource(vfsURI.toString()));
} catch (IOException e) {
@@ -248,10 +232,7 @@ public class VfsRepositoryTest {
public void testGetResourceValidNoExist() throws Exception {
String testResource = VfsTestHelper.SCRATCH_DIR + "/nosuchfile.jar";
- Iterator vfsURIs = helper.createVFSUriSet(testResource).iterator();
- while (vfsURIs.hasNext()) {
- VfsURI vfsURI = (VfsURI) vfsURIs.next();
-
+ for (VfsURI vfsURI : helper.createVFSUriSet(testResource)) {
// make sure the declared resource does not exist
if (scratchDir.exists()) {
FileUtil.forceDelete(scratchDir);
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8b9f2d51/test/java/org/apache/ivy/plugins/repository/vfs/VfsResourceTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/repository/vfs/VfsResourceTest.java b/test/java/org/apache/ivy/plugins/repository/vfs/VfsResourceTest.java
index 13a311b..4801175 100644
--- a/test/java/org/apache/ivy/plugins/repository/vfs/VfsResourceTest.java
+++ b/test/java/org/apache/ivy/plugins/repository/vfs/VfsResourceTest.java
@@ -27,7 +27,6 @@ import java.net.URI;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
import org.junit.After;
@@ -52,9 +51,7 @@ public class VfsResourceTest {
*/
@Test
public void testCreateResourceThatExists() throws Exception {
- Iterator vfsURIs = helper.createVFSUriSet(VfsTestHelper.TEST_IVY_XML).iterator();
- while (vfsURIs.hasNext()) {
- VfsURI vfsURI = (VfsURI) vfsURIs.next();
+ for (VfsURI vfsURI : helper.createVFSUriSet(VfsTestHelper.TEST_IVY_XML)) {
String resId = vfsURI.toString();
VfsResource res = new VfsResource(resId, helper.fsManager);
assertNotNull("Unexpected null value on VFS URI: " + resId, res);
@@ -93,9 +90,7 @@ public class VfsResourceTest {
*/
@Test
public void testCreateResourceThatDoesntExist() throws Exception {
- Iterator vfsURIs = helper.createVFSUriSet("zzyyxx.zzyyxx").iterator();
- while (vfsURIs.hasNext()) {
- VfsURI vfsURI = (VfsURI) vfsURIs.next();
+ for (VfsURI vfsURI : helper.createVFSUriSet("zzyyxx.zzyyxx")) {
String resId = vfsURI.toString();
VfsResource res = new VfsResource(resId, helper.fsManager);
assertNotNull("Unexpected null value on VFS URI: " + resId, res);
@@ -141,24 +136,19 @@ public class VfsResourceTest {
@Test
public void testListFolderChildren() throws Exception {
final String testFolder = "2/mod10.1";
- final List expectedFiles = Arrays.asList(new String[] {"ivy-1.0.xml", "ivy-1.1.xml",
- "ivy-1.2.xml", "ivy-1.3.xml"});
+ final List<String> expectedFiles = Arrays
+ .asList(new String[] {"ivy-1.0.xml", "ivy-1.1.xml", "ivy-1.2.xml", "ivy-1.3.xml"});
- Iterator baseVfsURIs = helper.createVFSUriSet(testFolder).iterator();
- while (baseVfsURIs.hasNext()) {
- VfsURI baseVfsURI = (VfsURI) baseVfsURIs.next();
-
- List expected = new ArrayList();
- for (int i = 0; i < expectedFiles.size(); i++) {
- String resId = baseVfsURI.toString() + "/" + expectedFiles.get(i);
+ for (VfsURI baseVfsURI : helper.createVFSUriSet(testFolder)) {
+ List<String> expected = new ArrayList<String>();
+ for (String expectedFile : expectedFiles) {
+ String resId = baseVfsURI.toString() + "/" + expectedFile;
expected.add(resId);
}
- List actual = new ArrayList();
+ List<String> actual = new ArrayList<String>();
VfsResource res = new VfsResource(baseVfsURI.toString(), helper.fsManager);
- Iterator children = res.getChildren().iterator();
- while (children.hasNext()) {
- String resId = (String) children.next();
+ for (String resId : res.getChildren()) {
// remove entries ending in .svn
if (!resId.endsWith(".svn")) {
actual.add(resId);
@@ -178,13 +168,11 @@ public class VfsResourceTest {
*/
@Test
public void testListFileChildren() throws Exception {
- Iterator testSet = helper.createVFSUriSet(VfsTestHelper.TEST_IVY_XML).iterator();
- while (testSet.hasNext()) {
- VfsURI vfsURI = (VfsURI) testSet.next();
+ for (VfsURI vfsURI : helper.createVFSUriSet(VfsTestHelper.TEST_IVY_XML)) {
VfsResource res = new VfsResource(vfsURI.toString(), helper.fsManager);
- List results = res.getChildren();
- assertEquals("getChildren query on file provided results when it shouldn't have",
- 0, results.size());
+ List<String> results = res.getChildren();
+ assertEquals("getChildren query on file provided results when it shouldn't have", 0,
+ results.size());
}
}
@@ -194,13 +182,11 @@ public class VfsResourceTest {
*/
@Test
public void testListImaginary() throws Exception {
- Iterator testSet = helper.createVFSUriSet("idontexistzzxx").iterator();
- while (testSet.hasNext()) {
- VfsURI vfsURI = (VfsURI) testSet.next();
+ for (VfsURI vfsURI : helper.createVFSUriSet("idontexistzzxx")) {
VfsResource res = new VfsResource(vfsURI.toString(), helper.fsManager);
- List results = res.getChildren();
- assertEquals("getChildren query on file provided results when it shouldn't have",
- 0, results.size());
+ List<String> results = res.getChildren();
+ assertEquals("getChildren query on file provided results when it shouldn't have", 0,
+ results.size());
}
}
}
[08/11] ant-ivy git commit: More Java 7 syntax in tests and other
optimisations
Posted by jh...@apache.org.
More Java 7 syntax in tests and other optimisations
Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/973704dc
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/973704dc
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/973704dc
Branch: refs/heads/master
Commit: 973704dc1c284a148c989e3da92a546bd0d2af0d
Parents: 3cf36b8
Author: twogee <g....@gmail.com>
Authored: Tue Jun 13 21:24:03 2017 +0200
Committer: twogee <g....@gmail.com>
Committed: Tue Jun 13 21:55:52 2017 +0200
----------------------------------------------------------------------
.../core/module/descriptor/IvyMakePomTest.java | 11 ++----
.../apache/ivy/osgi/obr/OBRXMLWriterTest.java | 10 +----
.../plugins/lock/ArtifactLockStrategyTest.java | 6 +--
.../ivy/plugins/repository/vfs/VfsURI.java | 41 +++++++++++---------
4 files changed, 29 insertions(+), 39 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/973704dc/test/java/org/apache/ivy/core/module/descriptor/IvyMakePomTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/module/descriptor/IvyMakePomTest.java b/test/java/org/apache/ivy/core/module/descriptor/IvyMakePomTest.java
index 8b4ba44..b372479 100644
--- a/test/java/org/apache/ivy/core/module/descriptor/IvyMakePomTest.java
+++ b/test/java/org/apache/ivy/core/module/descriptor/IvyMakePomTest.java
@@ -170,7 +170,7 @@ public class IvyMakePomTest {
// move to next sibling
nextChild = nextChild.getNextSibling();
}
- return new PomDependency(groupId, artifactId, version, scope, classifier, optional != null ? Boolean.parseBoolean(optional) : false);
+ return new PomDependency(groupId, artifactId, version, scope, classifier, optional != null && Boolean.parseBoolean(optional));
}
private static Node skipIfTextNode(final Node node) {
@@ -182,13 +182,8 @@ public class IvyMakePomTest {
@Override
public String toString() {
- return "PomDependency{" +
- "groupId='" + groupId + '\'' +
- ", artifactId='" + artifactId + '\'' +
- ", version='" + version + '\'' +
- ", scope='" + scope + '\'' +
- ", classifier='" + classifier + '\'' +
- '}';
+ return String.format("PomDependency{groupId='%s', artifactId='%s', version='%s', scope='%s', classifier='%s'}",
+ groupId, artifactId, version, scope, classifier);
}
}
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/973704dc/test/java/org/apache/ivy/osgi/obr/OBRXMLWriterTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/osgi/obr/OBRXMLWriterTest.java b/test/java/org/apache/ivy/osgi/obr/OBRXMLWriterTest.java
index 0054656..f0c4c0d 100644
--- a/test/java/org/apache/ivy/osgi/obr/OBRXMLWriterTest.java
+++ b/test/java/org/apache/ivy/osgi/obr/OBRXMLWriterTest.java
@@ -62,20 +62,14 @@ public class OBRXMLWriterTest {
new File("build/test-files").mkdirs();
File obrFile = new File("build/test-files/obr-sources.xml");
- FileOutputStream out = new FileOutputStream(obrFile);
- try {
+ try (FileOutputStream out = new FileOutputStream(obrFile)) {
ContentHandler handler = OBRXMLWriter.newHandler(out, "UTF-8", true);
OBRXMLWriter.writeBundles(bundles, handler);
- } finally {
- out.close();
}
- FileInputStream in = new FileInputStream(obrFile);
BundleRepoDescriptor repo;
- try {
+ try (FileInputStream in = new FileInputStream(obrFile)) {
repo = OBRXMLParser.parse(new URI("file:///test"), in);
- } finally {
- in.close();
}
assertEquals(2, CollectionUtils.toList(repo.getModules()).size());
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/973704dc/test/java/org/apache/ivy/plugins/lock/ArtifactLockStrategyTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/lock/ArtifactLockStrategyTest.java b/test/java/org/apache/ivy/plugins/lock/ArtifactLockStrategyTest.java
index e886469..5f0375f 100644
--- a/test/java/org/apache/ivy/plugins/lock/ArtifactLockStrategyTest.java
+++ b/test/java/org/apache/ivy/plugins/lock/ArtifactLockStrategyTest.java
@@ -189,11 +189,7 @@ public class ArtifactLockStrategyTest {
}
} catch (ParseException e) {
Message.info("parse exception " + e);
- } catch (RuntimeException e) {
- Message.info("exception " + e);
- e.printStackTrace();
- throw e;
- } catch (Error e) {
+ } catch (RuntimeException | Error e) {
Message.info("exception " + e);
e.printStackTrace();
throw e;
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/973704dc/test/java/org/apache/ivy/plugins/repository/vfs/VfsURI.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/repository/vfs/VfsURI.java b/test/java/org/apache/ivy/plugins/repository/vfs/VfsURI.java
index 1dac7b0..3b89002 100644
--- a/test/java/org/apache/ivy/plugins/repository/vfs/VfsURI.java
+++ b/test/java/org/apache/ivy/plugins/repository/vfs/VfsURI.java
@@ -60,24 +60,29 @@ public class VfsURI {
*/
public static VfsURI vfsURIFactory(String scheme, String resource, Ivy ivy) {
VfsURI vfsURI = null;
- if (scheme.equals(SCHEME_CIFS)) {
- vfsURI = new VfsURI(SCHEME_CIFS, ivy.getVariable(VfsTestHelper.PROP_VFS_USER_ID),
- ivy.getVariable(VfsTestHelper.PROP_VFS_USER_PASSWD),
- ivy.getVariable(VfsTestHelper.PROP_VFS_HOST),
- ivy.getVariable(VfsTestHelper.PROP_VFS_SAMBA_REPO) + "/" + resource);
- } else if (scheme.equals(SCHEME_FILE)) {
- vfsURI = new VfsURI(SCHEME_FILE, null, null, null, VfsTestHelper.CWD + "/"
- + VfsTestHelper.TEST_REPO_DIR + "/" + resource);
- } else if (scheme.equals(SCHEME_FTP)) {
- vfsURI = new VfsURI(SCHEME_FTP, ivy.getVariable(VfsTestHelper.PROP_VFS_USER_ID),
- ivy.getVariable(VfsTestHelper.PROP_VFS_USER_PASSWD),
- ivy.getVariable(VfsTestHelper.PROP_VFS_HOST), VfsTestHelper.CWD + "/"
- + VfsTestHelper.TEST_REPO_DIR + "/" + resource);
- } else if (scheme.equals(SCHEME_SFTP)) {
- vfsURI = new VfsURI(SCHEME_SFTP, ivy.getVariable(VfsTestHelper.PROP_VFS_USER_ID),
- ivy.getVariable(VfsTestHelper.PROP_VFS_USER_PASSWD),
- ivy.getVariable(VfsTestHelper.PROP_VFS_HOST), VfsTestHelper.CWD + "/"
- + VfsTestHelper.TEST_REPO_DIR + "/" + resource);
+ switch (scheme) {
+ case SCHEME_CIFS:
+ vfsURI = new VfsURI(SCHEME_CIFS, ivy.getVariable(VfsTestHelper.PROP_VFS_USER_ID),
+ ivy.getVariable(VfsTestHelper.PROP_VFS_USER_PASSWD),
+ ivy.getVariable(VfsTestHelper.PROP_VFS_HOST),
+ ivy.getVariable(VfsTestHelper.PROP_VFS_SAMBA_REPO) + "/" + resource);
+ break;
+ case SCHEME_FILE:
+ vfsURI = new VfsURI(SCHEME_FILE, null, null, null, VfsTestHelper.CWD + "/"
+ + VfsTestHelper.TEST_REPO_DIR + "/" + resource);
+ break;
+ case SCHEME_FTP:
+ vfsURI = new VfsURI(SCHEME_FTP, ivy.getVariable(VfsTestHelper.PROP_VFS_USER_ID),
+ ivy.getVariable(VfsTestHelper.PROP_VFS_USER_PASSWD),
+ ivy.getVariable(VfsTestHelper.PROP_VFS_HOST), VfsTestHelper.CWD + "/"
+ + VfsTestHelper.TEST_REPO_DIR + "/" + resource);
+ break;
+ case SCHEME_SFTP:
+ vfsURI = new VfsURI(SCHEME_SFTP, ivy.getVariable(VfsTestHelper.PROP_VFS_USER_ID),
+ ivy.getVariable(VfsTestHelper.PROP_VFS_USER_PASSWD),
+ ivy.getVariable(VfsTestHelper.PROP_VFS_HOST), VfsTestHelper.CWD + "/"
+ + VfsTestHelper.TEST_REPO_DIR + "/" + resource);
+ break;
}
return vfsURI;
}
[07/11] ant-ivy git commit: Java 7 diamonds in tests
Posted by jh...@apache.org.
Java 7 diamonds in tests
Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/3cf36b8c
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/3cf36b8c
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/3cf36b8c
Branch: refs/heads/master
Commit: 3cf36b8cacd27557e0af0695c2c827f82d29d6e4
Parents: d7651dc
Author: twogee <g....@gmail.com>
Authored: Tue Jun 13 21:23:23 2017 +0200
Committer: twogee <g....@gmail.com>
Committed: Tue Jun 13 21:23:23 2017 +0200
----------------------------------------------------------------------
test/java/org/apache/ivy/TestFixture.java | 2 +-
test/java/org/apache/ivy/TestHelper.java | 4 +-
.../core/module/descriptor/IvyMakePomTest.java | 2 +-
.../ivy/core/publish/PublishEventsTest.java | 2 +-
.../ivy/core/report/ResolveReportTest.java | 4 +-
.../apache/ivy/core/resolve/ResolveTest.java | 116 +++++++++----------
.../org/apache/ivy/core/search/SearchTest.java | 14 +--
.../java/org/apache/ivy/core/sort/SortTest.java | 2 +-
.../ivy/osgi/core/ManifestParserTest.java | 4 +-
.../apache/ivy/osgi/obr/OBRResolverTest.java | 6 +-
.../apache/ivy/osgi/obr/OBRXMLWriterTest.java | 2 +-
.../plugins/repository/vfs/VfsResourceTest.java | 4 +-
.../plugins/repository/vfs/VfsTestHelper.java | 2 +-
.../org/apache/ivy/util/ConfiguratorTest.java | 10 +-
.../org/apache/ivy/util/MockMessageLogger.java | 6 +-
15 files changed, 90 insertions(+), 90 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3cf36b8c/test/java/org/apache/ivy/TestFixture.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/TestFixture.java b/test/java/org/apache/ivy/TestFixture.java
index b47b626..7886ead 100644
--- a/test/java/org/apache/ivy/TestFixture.java
+++ b/test/java/org/apache/ivy/TestFixture.java
@@ -65,7 +65,7 @@ import org.apache.ivy.plugins.resolver.util.ResolvedResource;
*/
public class TestFixture {
- private final Collection<ModuleDescriptor> mds = new ArrayList<ModuleDescriptor>();
+ private final Collection<ModuleDescriptor> mds = new ArrayList<>();
private Ivy ivy;
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3cf36b8c/test/java/org/apache/ivy/TestHelper.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/TestHelper.java b/test/java/org/apache/ivy/TestHelper.java
index c260f5a..20fdfc3 100644
--- a/test/java/org/apache/ivy/TestHelper.java
+++ b/test/java/org/apache/ivy/TestHelper.java
@@ -108,7 +108,7 @@ public class TestHelper {
* @return a collection of {@link ModuleRevisionId}
*/
public static Collection<ModuleRevisionId> parseMrids(String mrids) {
- Collection<ModuleRevisionId> c = new LinkedHashSet<ModuleRevisionId>();
+ Collection<ModuleRevisionId> c = new LinkedHashSet<>();
for (String s : mrids.split(",?\\s+")) {
c.add(ModuleRevisionId.parse(s));
}
@@ -201,7 +201,7 @@ public class TestHelper {
* @return the collection of module descriptors parsed
*/
public static Collection<ModuleDescriptor> parseMicroIvyDescriptors(String microIvy) {
- Collection<ModuleDescriptor> r = new ArrayList<ModuleDescriptor>();
+ Collection<ModuleDescriptor> r = new ArrayList<>();
for (String md : microIvy.split("\\s*;;\\s*")) {
r.add(parseMicroIvyDescriptor(md));
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3cf36b8c/test/java/org/apache/ivy/core/module/descriptor/IvyMakePomTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/module/descriptor/IvyMakePomTest.java b/test/java/org/apache/ivy/core/module/descriptor/IvyMakePomTest.java
index d962e8d..8b4ba44 100644
--- a/test/java/org/apache/ivy/core/module/descriptor/IvyMakePomTest.java
+++ b/test/java/org/apache/ivy/core/module/descriptor/IvyMakePomTest.java
@@ -77,7 +77,7 @@ public class IvyMakePomTest {
assertNotNull("Dependencies element wasn't found in the generated POM file", dependencies);
assertEquals("Unexpected number of dependencies in the generated POM file", 2, dependencies.getLength());
- final Set<String> expectedPomArtifactIds = new HashSet<String>();
+ final Set<String> expectedPomArtifactIds = new HashSet<>();
expectedPomArtifactIds.add("foo");
expectedPomArtifactIds.add("bar");
for (int i = 0; i < dependencies.getLength(); i++) {
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3cf36b8c/test/java/org/apache/ivy/core/publish/PublishEventsTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/publish/PublishEventsTest.java b/test/java/org/apache/ivy/core/publish/PublishEventsTest.java
index 13937c6..704a1fc 100644
--- a/test/java/org/apache/ivy/core/publish/PublishEventsTest.java
+++ b/test/java/org/apache/ivy/core/publish/PublishEventsTest.java
@@ -124,7 +124,7 @@ public class PublishEventsTest {
assertEquals("sanity check", "foo", dataArtifact.getName());
ivyArtifact = MDArtifact.newIvyArtifact(publishModule);
- expectedPublications = new HashMap<ArtifactRevisionId, PublishTestCase>();
+ expectedPublications = new HashMap<>();
expectedPublications.put(dataArtifact.getId(), new PublishTestCase(dataArtifact, dataFile,
true));
expectedPublications.put(ivyArtifact.getId(), new PublishTestCase(ivyArtifact, ivyFile,
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3cf36b8c/test/java/org/apache/ivy/core/report/ResolveReportTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/report/ResolveReportTest.java b/test/java/org/apache/ivy/core/report/ResolveReportTest.java
index 8890c75..d01d206 100644
--- a/test/java/org/apache/ivy/core/report/ResolveReportTest.java
+++ b/test/java/org/apache/ivy/core/report/ResolveReportTest.java
@@ -86,8 +86,8 @@ public class ResolveReportTest {
String rev, String conf, String[] targetConfs) {
assertEquals(ModuleRevisionId.newInstance(org, mod, rev), dep.getDependencyRevisionId());
assertTrue(Arrays.asList(dep.getModuleConfigurations()).contains(conf));
- assertEquals(new HashSet<String>(Arrays.asList(targetConfs)),
- new HashSet<String>(Arrays.asList(dep.getDependencyConfigurations(conf))));
+ assertEquals(new HashSet<>(Arrays.asList(targetConfs)),
+ new HashSet<>(Arrays.asList(dep.getDependencyConfigurations(conf))));
}
@Test
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3cf36b8c/test/java/org/apache/ivy/core/resolve/ResolveTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/resolve/ResolveTest.java b/test/java/org/apache/ivy/core/resolve/ResolveTest.java
index c274129..1bddd54 100644
--- a/test/java/org/apache/ivy/core/resolve/ResolveTest.java
+++ b/test/java/org/apache/ivy/core/resolve/ResolveTest.java
@@ -163,7 +163,7 @@ public class ResolveTest {
getResolveOptions(new String[] {"default"}).setValidate(false));
assertNotNull(report);
- Map<String, String> extra = new HashMap<String, String>();
+ Map<String, String> extra = new HashMap<>();
extra.put("extra", "foo");
ArtifactDownloadReport[] dReports = report.getConfigurationReport("default")
.getDownloadReports(ModuleRevisionId.newInstance("org15", "mod15.3", "1.1", extra));
@@ -549,8 +549,8 @@ public class ResolveTest {
assertFalse(report.hasError());
assertEquals(
- new HashSet<ModuleRevisionId>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
- "mod1.2", "1.5"))), report.getConfigurationReport("default").getModuleRevisionIds());
+ new HashSet<>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.5"))), report.getConfigurationReport("default").getModuleRevisionIds());
// now we clean the repository to simulate repo not available (network pb for instance)
FileUtil.forceDelete(new File("build/testCache2"));
@@ -561,8 +561,8 @@ public class ResolveTest {
assertFalse(report.hasError());
assertEquals(
- new HashSet<ModuleRevisionId>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
- "mod1.2", "1.5"))), report.getConfigurationReport("default").getModuleRevisionIds());
+ new HashSet<>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.5"))), report.getConfigurationReport("default").getModuleRevisionIds());
}
@Test
@@ -587,8 +587,8 @@ public class ResolveTest {
assertFalse(report.hasError());
assertEquals(
- new HashSet<ModuleRevisionId>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
- "mod1.2", "1.5"))), report.getConfigurationReport("default").getModuleRevisionIds());
+ new HashSet<>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.5"))), report.getConfigurationReport("default").getModuleRevisionIds());
// now we clean the repository to simulate repo not available (network pb for instance)
FileUtil.forceDelete(new File("build/testCache2"));
@@ -599,8 +599,8 @@ public class ResolveTest {
assertFalse(report.hasError());
assertEquals(
- new HashSet<ModuleRevisionId>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
- "mod1.2", "1.5"))), report.getConfigurationReport("default").getModuleRevisionIds());
+ new HashSet<>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.5"))), report.getConfigurationReport("default").getModuleRevisionIds());
}
@Test
@@ -626,8 +626,8 @@ public class ResolveTest {
assertFalse(report.hasError());
assertEquals(
- new HashSet<ModuleRevisionId>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
- "mod1.2", "1.5"))), report.getConfigurationReport("default").getModuleRevisionIds());
+ new HashSet<>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.5"))), report.getConfigurationReport("default").getModuleRevisionIds());
// now we wait for ttl expiration
Thread.sleep(700);
@@ -638,8 +638,8 @@ public class ResolveTest {
assertFalse(report.hasError());
assertEquals(
- new HashSet<ModuleRevisionId>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
- "mod1.2", "1.5"))), report.getConfigurationReport("default").getModuleRevisionIds());
+ new HashSet<>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.5"))), report.getConfigurationReport("default").getModuleRevisionIds());
// now we clean the repository to simulate repo not available (network pb for instance)
FileUtil.forceDelete(new File("build/testCache2"));
@@ -650,8 +650,8 @@ public class ResolveTest {
assertFalse(report.hasError());
assertEquals(
- new HashSet<ModuleRevisionId>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
- "mod1.2", "1.5"))), report.getConfigurationReport("default").getModuleRevisionIds());
+ new HashSet<>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.5"))), report.getConfigurationReport("default").getModuleRevisionIds());
}
@Test
@@ -673,8 +673,8 @@ public class ResolveTest {
assertFalse(report.hasError());
assertEquals(
- new HashSet<ModuleRevisionId>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
- "mod1.2", "1.5"))), report.getConfigurationReport("default").getModuleRevisionIds());
+ new HashSet<>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.5"))), report.getConfigurationReport("default").getModuleRevisionIds());
// now we update the repository
FileUtil.copy(new File("test/repositories/1/org1/mod1.2/jars/mod1.2-2.0.jar"), new File(
@@ -686,8 +686,8 @@ public class ResolveTest {
assertFalse(report.hasError());
assertEquals(
- new HashSet<ModuleRevisionId>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
- "mod1.2", "1.6"))), report.getConfigurationReport("default").getModuleRevisionIds());
+ new HashSet<>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.6"))), report.getConfigurationReport("default").getModuleRevisionIds());
}
@Test
@@ -720,8 +720,8 @@ public class ResolveTest {
assertFalse(report.hasError());
assertEquals(
- new HashSet<ModuleRevisionId>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
- "mod1.2", "1.5"))), report.getConfigurationReport("default").getModuleRevisionIds());
+ new HashSet<>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.5"))), report.getConfigurationReport("default").getModuleRevisionIds());
// wait for org1 TTL to expire
Thread.sleep(700);
@@ -732,8 +732,8 @@ public class ResolveTest {
assertFalse(report.hasError());
assertEquals(
- new HashSet<ModuleRevisionId>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
- "mod1.2", "1.6"))), report.getConfigurationReport("default").getModuleRevisionIds());
+ new HashSet<>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.6"))), report.getConfigurationReport("default").getModuleRevisionIds());
}
@Test
@@ -763,8 +763,8 @@ public class ResolveTest {
assertFalse(report.hasError());
assertEquals(
- new HashSet<ModuleRevisionId>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
- "mod1.2", "1.5"))), report.getConfigurationReport("default").getModuleRevisionIds());
+ new HashSet<>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.5"))), report.getConfigurationReport("default").getModuleRevisionIds());
// resolve again with refresh: it should find the new version
report = ivy.resolve(new File("test/repositories/1/org1/mod1.4/ivys/ivy-1.0.2.xml"),
@@ -772,8 +772,8 @@ public class ResolveTest {
assertFalse(report.hasError());
assertEquals(
- new HashSet<ModuleRevisionId>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
- "mod1.2", "1.6"))), report.getConfigurationReport("default").getModuleRevisionIds());
+ new HashSet<>(Collections.singletonList(ModuleRevisionId.newInstance("org1",
+ "mod1.2", "1.6"))), report.getConfigurationReport("default").getModuleRevisionIds());
FileUtil.forceDelete(new File("build/testCache2"));
}
@@ -1788,7 +1788,7 @@ public class ResolveTest {
ResolveReport report = ivy.resolve(ResolveTest.class.getResource("ivy-225.xml"),
getResolveOptions(new String[] {"default"}));
- List<ModuleRevisionId> revisions = new ArrayList<ModuleRevisionId>(report
+ List<ModuleRevisionId> revisions = new ArrayList<>(report
.getConfigurationReport("default").getModuleRevisionIds());
assertTrue("number of revisions is not correct", revisions.size() >= 3);
@@ -1928,23 +1928,23 @@ public class ResolveTest {
// here we should get all three recursive dependencies
assertEquals(
- new HashSet<ModuleRevisionId>(Arrays.asList(
- ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"),
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"),
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))),
+ new HashSet<>(Arrays.asList(
+ ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"),
+ ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"),
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))),
r.getConfigurationReport("A").getModuleRevisionIds());
// here we should get only mod2.1 and mod1.1 cause compile is not transitive in mod2.1
assertEquals(
- new HashSet<ModuleRevisionId>(Arrays.asList(
- ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"),
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"))),
+ new HashSet<>(Arrays.asList(
+ ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"),
+ ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"))),
r.getConfigurationReport("B").getModuleRevisionIds());
// here we should get only mod2.1 cause compile is not transitive
assertEquals(
- new HashSet<ModuleRevisionId>(Collections.singletonList(ModuleRevisionId.newInstance("org2",
- "mod2.1", "0.3.2"))), r.getConfigurationReport("compile").getModuleRevisionIds());
+ new HashSet<>(Collections.singletonList(ModuleRevisionId.newInstance("org2",
+ "mod2.1", "0.3.2"))), r.getConfigurationReport("compile").getModuleRevisionIds());
}
@Test
@@ -1963,24 +1963,24 @@ public class ResolveTest {
// here we should get all three recursive dependencies
assertEquals(
- new HashSet<ModuleRevisionId>(Arrays.asList(
- ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"),
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"),
- ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))),
+ new HashSet<>(Arrays.asList(
+ ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"),
+ ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"),
+ ModuleRevisionId.newInstance("org1", "mod1.2", "2.0"))),
r.getConfigurationReport("A").getModuleRevisionIds());
// here we should get only mod2.1 and mod1.1 cause compile is not transitive in mod2.1
assertEquals(
- new HashSet<ModuleRevisionId>(Arrays.asList(
- ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"),
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"))),
+ new HashSet<>(Arrays.asList(
+ ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"),
+ ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"))),
r.getConfigurationReport("B").getModuleRevisionIds());
// here we should get only mod2.1 cause compile is not transitive
assertEquals(
- new HashSet<ModuleRevisionId>(Arrays.asList(
- ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"),
- ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"))),
+ new HashSet<>(Arrays.asList(
+ ModuleRevisionId.newInstance("org2", "mod2.1", "0.3.2"),
+ ModuleRevisionId.newInstance("org1", "mod1.1", "1.0"))),
r.getConfigurationReport("compile").getModuleRevisionIds());
}
@@ -2244,7 +2244,7 @@ public class ResolveTest {
IvyNode[] evicted = compileReport.getEvictedNodes();
assertNotNull(evicted);
- Collection<ModuleRevisionId> evictedModules = new ArrayList<ModuleRevisionId>();
+ Collection<ModuleRevisionId> evictedModules = new ArrayList<>();
for (IvyNode anEvicted : evicted) {
evictedModules.add(anEvicted.getId());
}
@@ -2643,7 +2643,7 @@ public class ResolveTest {
ivy.resolve(new File("test/repositories/2/mod4.1/ivy-4.5.xml"),
getResolveOptions(new String[] {"*"}));
- List<File> lockFiles = new ArrayList<File>();
+ List<File> lockFiles = new ArrayList<>();
findLockFiles(cache, lockFiles);
assertTrue("There were lockfiles left in the cache: " + lockFiles, lockFiles.isEmpty());
}
@@ -3078,7 +3078,7 @@ public class ResolveTest {
@Test
public void testResolveModeDynamic2() throws Exception {
// same as ResolveModeDynamic1, but resolve mode is set in settings
- Map<String, String> attributes = new HashMap<String, String>();
+ Map<String, String> attributes = new HashMap<>();
attributes.put("organisation", "org1");
attributes.put("module", "mod1.2");
ivy.getSettings().addModuleConfiguration(attributes, ExactPatternMatcher.INSTANCE, null,
@@ -3131,7 +3131,7 @@ public class ResolveTest {
public void testResolveModeDefaultOverrideSettings() throws Exception {
// same as ResolveModeDynamic2, but resolve mode is set in settings, and overridden when
// calling resolve
- Map<String, String> attributes = new HashMap<String, String>();
+ Map<String, String> attributes = new HashMap<>();
attributes.put("organisation", "org1");
attributes.put("module", "mod1.2");
ivy.getSettings().addModuleConfiguration(attributes, ExactPatternMatcher.INSTANCE, null,
@@ -3518,7 +3518,7 @@ public class ResolveTest {
assertTrue(modRevIds.contains(ModuleRevisionId.newInstance("org", "dep1", "1.0")));
assertTrue(modRevIds.contains(ModuleRevisionId.newInstance("org", "dep2", "1.0")));
- Map<String, String> extra = new HashMap<String, String>();
+ Map<String, String> extra = new HashMap<>();
extra.put("o:a", "58701");
assertTrue(modRevIds.contains(ModuleRevisionId.newInstance("org", "badArtifact",
"1.0.0.m4", extra)));
@@ -4454,7 +4454,7 @@ public class ResolveTest {
assertTrue(getIvyFileInCache(
ModuleRevisionId.newInstance("org.apache", "test-classified", "1.0")).exists());
- Map<String, String> cmap = new HashMap<String, String>();
+ Map<String, String> cmap = new HashMap<>();
cmap.put("classifier", "asl");
assertTrue(getArchiveFileInCache(ivy, "org.apache", "test-classified", null /* branch */
, "1.0", "test-classified", "jar", "jar", cmap).exists());
@@ -4482,7 +4482,7 @@ public class ResolveTest {
assertTrue(getIvyFileInCache(
ModuleRevisionId.newInstance("org.apache", "test-classified", "2.0")).exists());
- Map<String, String> cmap = new HashMap<String, String>();
+ Map<String, String> cmap = new HashMap<>();
cmap.put("classifier", "asl");
assertTrue(getArchiveFileInCache(ivy, "org.apache", "test-classified", null /* branch */
, "2.0", "test-classified", "jar", "jar", cmap).exists());
@@ -5662,9 +5662,9 @@ public class ResolveTest {
assertFalse(report.hasError());
assertEquals(
- new HashSet<ModuleRevisionId>(Arrays.asList(
- ModuleRevisionId.newInstance("myorg", "modA", "1"),
- ModuleRevisionId.newInstance("myorg", "modB", "1"))), report
+ new HashSet<>(Arrays.asList(
+ ModuleRevisionId.newInstance("myorg", "modA", "1"),
+ ModuleRevisionId.newInstance("myorg", "modB", "1"))), report
.getConfigurationReport("default").getModuleRevisionIds());
DeliverOptions dopts = new DeliverOptions();
@@ -5711,7 +5711,7 @@ public class ResolveTest {
Set<ModuleRevisionId> reportMrids = report.getConfigurationReport("default")
.getModuleRevisionIds();
assertEquals(
- new HashSet<ModuleRevisionId>(Arrays.asList(modAExpectedRevId, modBExpectedRevId)),
+ new HashSet<>(Arrays.asList(modAExpectedRevId, modBExpectedRevId)),
reportMrids);
DeliverOptions dopts = new DeliverOptions();
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3cf36b8c/test/java/org/apache/ivy/core/search/SearchTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/search/SearchTest.java b/test/java/org/apache/ivy/core/search/SearchTest.java
index e56f9bd..c16e735 100644
--- a/test/java/org/apache/ivy/core/search/SearchTest.java
+++ b/test/java/org/apache/ivy/core/search/SearchTest.java
@@ -42,13 +42,13 @@ public class SearchTest {
Ivy ivy = Ivy.newInstance();
ivy.configure(new File("test/repositories/m2/ivysettings.xml").toURI().toURL());
- Map<String, Object> otherTokenValues = new HashMap<String, Object>();
+ Map<String, Object> otherTokenValues = new HashMap<>();
otherTokenValues.put(IvyPatternHelper.ORGANISATION_KEY, "org.apache");
otherTokenValues.put(IvyPatternHelper.MODULE_KEY, "test-metadata");
String[] revs = ivy.listTokenValues(IvyPatternHelper.REVISION_KEY, otherTokenValues);
- assertEquals(new HashSet<String>(Arrays.asList(new String[] {"1.0", "1.1"})),
- new HashSet<String>(Arrays.asList(revs)));
+ assertEquals(new HashSet<>(Arrays.asList(new String[]{"1.0", "1.1"})),
+ new HashSet<>(Arrays.asList(revs)));
}
@Test
@@ -57,13 +57,13 @@ public class SearchTest {
ivy.configure(new File("test/repositories/m2/ivysettings.xml").toURI().toURL());
((IBiblioResolver) ivy.getSettings().getResolver("m2")).setUseMavenMetadata(false);
- Map<String, Object> otherTokenValues = new HashMap<String, Object>();
+ Map<String, Object> otherTokenValues = new HashMap<>();
otherTokenValues.put(IvyPatternHelper.ORGANISATION_KEY, "org.apache");
otherTokenValues.put(IvyPatternHelper.MODULE_KEY, "test-metadata");
String[] revs = ivy.listTokenValues(IvyPatternHelper.REVISION_KEY, otherTokenValues);
- assertEquals(new HashSet<String>(Arrays.asList(new String[] {"1.0", "1.1", "1.2"})),
- new HashSet<String>(Arrays.asList(revs)));
+ assertEquals(new HashSet<>(Arrays.asList(new String[]{"1.0", "1.1", "1.2"})),
+ new HashSet<>(Arrays.asList(revs)));
}
@Test
@@ -72,7 +72,7 @@ public class SearchTest {
ivy.configure(new File("test/repositories/IVY-1128/ivysettings.xml"));
IvySettings settings = ivy.getSettings();
- Map<String, String> extendedAttributes = new HashMap<String, String>();
+ Map<String, String> extendedAttributes = new HashMap<>();
extendedAttributes.put("e:att1", "extraatt");
extendedAttributes.put("e:att2", "extraatt2");
ModuleRevisionId criteria = ModuleRevisionId.newInstance("test", "a", "*",
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3cf36b8c/test/java/org/apache/ivy/core/sort/SortTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/sort/SortTest.java b/test/java/org/apache/ivy/core/sort/SortTest.java
index 9dda5df..cf10807 100644
--- a/test/java/org/apache/ivy/core/sort/SortTest.java
+++ b/test/java/org/apache/ivy/core/sort/SortTest.java
@@ -346,7 +346,7 @@ public class SortTest {
private Collection<List<ModuleDescriptor>> getAllLists(ModuleDescriptor a, ModuleDescriptor b,
ModuleDescriptor c, ModuleDescriptor d) {
final int nbOfList = 24;
- Collection<List<ModuleDescriptor>> r = new ArrayList<List<ModuleDescriptor>>(nbOfList);
+ Collection<List<ModuleDescriptor>> r = new ArrayList<>(nbOfList);
r.add(Arrays.asList(new ModuleDescriptor[] {a, b, c, d}));
r.add(Arrays.asList(new ModuleDescriptor[] {a, b, d, c}));
r.add(Arrays.asList(new ModuleDescriptor[] {a, c, b, d}));
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3cf36b8c/test/java/org/apache/ivy/osgi/core/ManifestParserTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/osgi/core/ManifestParserTest.java b/test/java/org/apache/ivy/osgi/core/ManifestParserTest.java
index 2bafc34..c1c9c58 100644
--- a/test/java/org/apache/ivy/osgi/core/ManifestParserTest.java
+++ b/test/java/org/apache/ivy/osgi/core/ManifestParserTest.java
@@ -40,7 +40,7 @@ public class ManifestParserTest {
assertEquals("20080101", bundleInfo.getVersion().qualifier());
assertEquals("1.0.0.20080101", bundleInfo.getVersion().toString());
assertEquals(2, bundleInfo.getRequires().size());
- Set<BundleRequirement> expectedRequires = new HashSet<BundleRequirement>();
+ Set<BundleRequirement> expectedRequires = new HashSet<>();
expectedRequires.add(new BundleRequirement(BundleInfo.BUNDLE_TYPE, "com.acme.bravo",
new VersionRange("2.0.0"), null));
expectedRequires.add(new BundleRequirement(BundleInfo.BUNDLE_TYPE, "com.acme.delta",
@@ -61,7 +61,7 @@ public class ManifestParserTest {
assertEquals("20080202", bundleInfo.getVersion().qualifier());
assertEquals("2.0.0.20080202", bundleInfo.getVersion().toString());
assertEquals(1, bundleInfo.getRequires().size());
- expectedRequires = new HashSet<BundleRequirement>();
+ expectedRequires = new HashSet<>();
expectedRequires.add(new BundleRequirement(BundleInfo.BUNDLE_TYPE, "com.acme.charlie",
new VersionRange("3.0.0"), null));
assertEquals(1, bundleInfo.getExports().size());
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3cf36b8c/test/java/org/apache/ivy/osgi/obr/OBRResolverTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/osgi/obr/OBRResolverTest.java b/test/java/org/apache/ivy/osgi/obr/OBRResolverTest.java
index c4c8a91..e18cd61 100644
--- a/test/java/org/apache/ivy/osgi/obr/OBRResolverTest.java
+++ b/test/java/org/apache/ivy/osgi/obr/OBRResolverTest.java
@@ -327,15 +327,15 @@ public class OBRResolverTest {
new ResolveOptions().setConfs(new String[] {conf}).setOutputReport(false));
assertFalse("resolve failed " + resolveReport.getAllProblemMessages(),
resolveReport.hasError());
- Set<ModuleRevisionId> actual = new HashSet<ModuleRevisionId>();
+ Set<ModuleRevisionId> actual = new HashSet<>();
for (Artifact artifact : resolveReport.getArtifacts()) {
actual.add(artifact.getModuleRevisionId());
}
- Set<ModuleRevisionId> expected = new HashSet<ModuleRevisionId>(Arrays.asList(expectedMrids));
+ Set<ModuleRevisionId> expected = new HashSet<>(Arrays.asList(expectedMrids));
if (expected2Mrids != null) {
// in this use case, we have two choices, let's try the second one
try {
- Set<ModuleRevisionId> expected2 = new HashSet<ModuleRevisionId>(
+ Set<ModuleRevisionId> expected2 = new HashSet<>(
Arrays.asList(expected2Mrids));
assertEquals(expected2, actual);
return; // test passed
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3cf36b8c/test/java/org/apache/ivy/osgi/obr/OBRXMLWriterTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/osgi/obr/OBRXMLWriterTest.java b/test/java/org/apache/ivy/osgi/obr/OBRXMLWriterTest.java
index db991db..0054656 100644
--- a/test/java/org/apache/ivy/osgi/obr/OBRXMLWriterTest.java
+++ b/test/java/org/apache/ivy/osgi/obr/OBRXMLWriterTest.java
@@ -49,7 +49,7 @@ public class OBRXMLWriterTest {
@Test
public void testWriteWithSource() throws Exception {
- List<BundleInfo> bundles = new ArrayList<BundleInfo>();
+ List<BundleInfo> bundles = new ArrayList<>();
BundleInfo bundle = new BundleInfo(BUNDLE_1, BUNDLE_VERSION);
bundle.addArtifact(new BundleArtifact(false, new URI("file:///test.jar"), null));
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3cf36b8c/test/java/org/apache/ivy/plugins/repository/vfs/VfsResourceTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/repository/vfs/VfsResourceTest.java b/test/java/org/apache/ivy/plugins/repository/vfs/VfsResourceTest.java
index 4801175..89aae0f 100644
--- a/test/java/org/apache/ivy/plugins/repository/vfs/VfsResourceTest.java
+++ b/test/java/org/apache/ivy/plugins/repository/vfs/VfsResourceTest.java
@@ -140,13 +140,13 @@ public class VfsResourceTest {
.asList(new String[] {"ivy-1.0.xml", "ivy-1.1.xml", "ivy-1.2.xml", "ivy-1.3.xml"});
for (VfsURI baseVfsURI : helper.createVFSUriSet(testFolder)) {
- List<String> expected = new ArrayList<String>();
+ List<String> expected = new ArrayList<>();
for (String expectedFile : expectedFiles) {
String resId = baseVfsURI.toString() + "/" + expectedFile;
expected.add(resId);
}
- List<String> actual = new ArrayList<String>();
+ List<String> actual = new ArrayList<>();
VfsResource res = new VfsResource(baseVfsURI.toString(), helper.fsManager);
for (String resId : res.getChildren()) {
// remove entries ending in .svn
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3cf36b8c/test/java/org/apache/ivy/plugins/repository/vfs/VfsTestHelper.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/repository/vfs/VfsTestHelper.java b/test/java/org/apache/ivy/plugins/repository/vfs/VfsTestHelper.java
index ecbed50..394dfba 100644
--- a/test/java/org/apache/ivy/plugins/repository/vfs/VfsTestHelper.java
+++ b/test/java/org/apache/ivy/plugins/repository/vfs/VfsTestHelper.java
@@ -76,7 +76,7 @@ public class VfsTestHelper {
* @return <class>List</class> of well-formed VFS resource identifiers
*/
public List<VfsURI> createVFSUriSet(String resource) {
- List<VfsURI> set = new ArrayList<VfsURI>();
+ List<VfsURI> set = new ArrayList<>();
for (String scheme : VfsURI.SUPPORTED_SCHEMES) {
set.add(VfsURI.vfsURIFactory(scheme, resource, ivy));
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3cf36b8c/test/java/org/apache/ivy/util/ConfiguratorTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/util/ConfiguratorTest.java b/test/java/org/apache/ivy/util/ConfiguratorTest.java
index ba642c0..9a2af55 100644
--- a/test/java/org/apache/ivy/util/ConfiguratorTest.java
+++ b/test/java/org/apache/ivy/util/ConfiguratorTest.java
@@ -46,9 +46,9 @@ public class ConfiguratorTest {
}
public static class City {
- private final List<Housing> _housings = new ArrayList<Housing>();
+ private final List<Housing> _housings = new ArrayList<>();
- private final List<Street> _streets = new ArrayList<Street>();
+ private final List<Street> _streets = new ArrayList<>();
private String _name;
@@ -80,9 +80,9 @@ public class ConfiguratorTest {
public static class Street {
private Class<?> _clazz;
- private final List<Tree> _trees = new ArrayList<Tree>();
+ private final List<Tree> _trees = new ArrayList<>();
- private final List<Person> _walkers = new ArrayList<Person>();
+ private final List<Person> _walkers = new ArrayList<>();
public List<Tree> getTrees() {
return _trees;
@@ -110,7 +110,7 @@ public class ConfiguratorTest {
}
public static abstract class Housing {
- private final List<Room> _rooms = new ArrayList<Room>();
+ private final List<Room> _rooms = new ArrayList<>();
private boolean _isEmpty;
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3cf36b8c/test/java/org/apache/ivy/util/MockMessageLogger.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/util/MockMessageLogger.java b/test/java/org/apache/ivy/util/MockMessageLogger.java
index 586ed7a..ce4c6cb 100644
--- a/test/java/org/apache/ivy/util/MockMessageLogger.java
+++ b/test/java/org/apache/ivy/util/MockMessageLogger.java
@@ -22,11 +22,11 @@ import java.util.List;
public class MockMessageLogger extends AbstractMessageLogger {
- private final List<String> _endProgress = new ArrayList<String>();
+ private final List<String> _endProgress = new ArrayList<>();
- private final List<String> _logs = new ArrayList<String>();
+ private final List<String> _logs = new ArrayList<>();
- private final List<String> _rawLogs = new ArrayList<String>();
+ private final List<String> _rawLogs = new ArrayList<>();
private int _progressCalls;
[11/11] ant-ivy git commit: diamont operator
Posted by jh...@apache.org.
diamont operator
Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/225afb8b
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/225afb8b
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/225afb8b
Branch: refs/heads/master
Commit: 225afb8bad88c9bbb70b24d9ac3c28fb21f39465
Parents: c7d4b53
Author: Jan Matèrne <jh...@apache.org>
Authored: Wed Jun 14 11:06:18 2017 +0200
Committer: Jan Matèrne <jh...@apache.org>
Committed: Wed Jun 14 11:06:18 2017 +0200
----------------------------------------------------------------------
src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java | 4 +---
test/java/org/apache/ivy/core/sort/SortTest.java | 3 ---
2 files changed, 1 insertion(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/225afb8b/src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java b/src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java
index 53e4429..3250e96 100644
--- a/src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java
+++ b/src/java/org/apache/ivy/plugins/repository/vfs/VfsResource.java
@@ -63,7 +63,6 @@ public class VfsResource implements Resource {
try {
resourceImpl = fsManager.resolveFile(vfsURI);
content = resourceImpl.getContent();
-
exists = resourceImpl.exists();
lastModified = content.getLastModifiedTime();
contentLength = content.getSize();
@@ -74,7 +73,6 @@ public class VfsResource implements Resource {
lastModified = 0;
contentLength = 0;
}
-
init = true;
}
}
@@ -88,7 +86,7 @@ public class VfsResource implements Resource {
*/
public List<String> getChildren() {
init();
- ArrayList<String> list = new ArrayList<String>();
+ ArrayList<String> list = new ArrayList<>();
try {
if ((resourceImpl != null) && resourceImpl.exists()
&& (resourceImpl.getType() == FileType.FOLDER)) {
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/225afb8b/test/java/org/apache/ivy/core/sort/SortTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/sort/SortTest.java b/test/java/org/apache/ivy/core/sort/SortTest.java
index cf10807..33031b8 100644
--- a/test/java/org/apache/ivy/core/sort/SortTest.java
+++ b/test/java/org/apache/ivy/core/sort/SortTest.java
@@ -196,7 +196,6 @@ public class SortTest {
*/
@Test
public void testLatestIntegration() {
-
addDependency(md2, "md1", "latest.integration");
addDependency(md3, "md2", "latest.integration");
addDependency(md4, "md3", "latest.integration");
@@ -210,7 +209,6 @@ public class SortTest {
for (List<ModuleDescriptor> toSort : permutations) {
assertSorted(expectedOrder, sortModuleDescriptors(toSort, nonMatchReporter));
}
-
}
/**
@@ -236,7 +234,6 @@ public class SortTest {
for (List<ModuleDescriptor> toSort : permutations) {
assertSorted(possibleOrder, sortModuleDescriptors(toSort, nonMatchReporter));
}
-
}
/**
[03/11] ant-ivy git commit: More foreach loops
Posted by jh...@apache.org.
More foreach loops
Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/8f35a1d2
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/8f35a1d2
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/8f35a1d2
Branch: refs/heads/master
Commit: 8f35a1d28e795833e6a095ff55ecc37f3db882aa
Parents: 8b9f2d5
Author: twogee <g....@gmail.com>
Authored: Sun Jun 11 00:26:54 2017 +0200
Committer: twogee <g....@gmail.com>
Committed: Sun Jun 11 00:26:54 2017 +0200
----------------------------------------------------------------------
.../filter-framework/src/filter/hmimpl/HMFilter.java | 3 +--
src/example/dual/project/src/example/HelloIvy.java | 4 ++--
src/example/hello-ivy/src/example/HelloConsole.java | 4 ++--
src/example/multi-project/projects/list/src/list/Main.java | 9 ++++-----
4 files changed, 9 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8f35a1d2/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java
----------------------------------------------------------------------
diff --git a/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java b/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java
index bcb2e1d..6e8b0ad 100644
--- a/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java
+++ b/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java
@@ -31,8 +31,7 @@ public class HMFilter implements IFilter {
return values;
}
List<String> result = new ArrayList<String>();
- for (int i = 0; i < values.length; i++) {
- String string = values[i];
+ for (String string : values) {
if (string != null && string.startsWith(prefix)) {
result.add(string);
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8f35a1d2/src/example/dual/project/src/example/HelloIvy.java
----------------------------------------------------------------------
diff --git a/src/example/dual/project/src/example/HelloIvy.java b/src/example/dual/project/src/example/HelloIvy.java
index bc84237..6125ff0 100644
--- a/src/example/dual/project/src/example/HelloIvy.java
+++ b/src/example/dual/project/src/example/HelloIvy.java
@@ -25,7 +25,7 @@ import org.apache.commons.lang.WordUtils;
* Simple hello world example to show how easy it is to retrieve libs with ivy,
* including transitive dependencies
*/
-public final class Hello {
+public final class HelloIvy {
public static void main(String[] args) throws Exception {
String message = "hello ivy !";
System.out.println("standard message : " + message);
@@ -46,6 +46,6 @@ public final class Hello {
System.out.println("found logging class in classpath: " + clss);
}
- private Hello() {
+ private HelloIvy() {
}
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8f35a1d2/src/example/hello-ivy/src/example/HelloConsole.java
----------------------------------------------------------------------
diff --git a/src/example/hello-ivy/src/example/HelloConsole.java b/src/example/hello-ivy/src/example/HelloConsole.java
index f3d0d45..c3e51d1 100644
--- a/src/example/hello-ivy/src/example/HelloConsole.java
+++ b/src/example/hello-ivy/src/example/HelloConsole.java
@@ -28,7 +28,7 @@ import org.apache.commons.lang.WordUtils;
/**
* Simple example to show how easy it is to retrieve transitive libs with ivy !!!
*/
-public final class Hello {
+public final class HelloConsole {
public static void main(String[] args) throws Exception {
Option msg = OptionBuilder.withArgName("msg")
.hasArg()
@@ -46,6 +46,6 @@ public final class Hello {
+ " : " + WordUtils.capitalizeFully(message));
}
- private Hello() {
+ private HelloConsole() {
}
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/8f35a1d2/src/example/multi-project/projects/list/src/list/Main.java
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/list/src/list/Main.java b/src/example/multi-project/projects/list/src/list/Main.java
index 5ae5c8d..c9915b6 100644
--- a/src/example/multi-project/projects/list/src/list/Main.java
+++ b/src/example/multi-project/projects/list/src/list/Main.java
@@ -51,11 +51,10 @@ public final class Main {
CommandLine line = parser.parse(options, args);
File dir = new File(line.getOptionValue("dir", "."));
- Collection files = ListFile.list(dir);
- System.out.println("listing files in " + dir);
- for (Iterator it = files.iterator(); it.hasNext();) {
- System.out.println("\t" + it.next() + "\n");
- }
+ System.out.println("listing files in " + dir);
+ for (Object file : ListFile.list(dir)) {
+ System.out.println("\t" + file + "\n");
+ }
} catch (ParseException exp) {
// oops, something went wrong
System.err.println("Parsing failed. Reason: " + exp.getMessage());
[09/11] ant-ivy git commit: More Java 7 diamonds
Posted by jh...@apache.org.
More Java 7 diamonds
Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/3b28fffb
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/3b28fffb
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/3b28fffb
Branch: refs/heads/master
Commit: 3b28fffbbac2a707906e35c7c014aa3eecef3510
Parents: 973704d
Author: twogee <g....@gmail.com>
Authored: Tue Jun 13 22:07:19 2017 +0200
Committer: twogee <g....@gmail.com>
Committed: Tue Jun 13 22:07:19 2017 +0200
----------------------------------------------------------------------
.../org/apache/ivy/ant/AntCallTriggerTest.java | 6 ++--
.../org/apache/ivy/ant/IvyBuildListTest.java | 3 +-
.../org/apache/ivy/ant/IvyResourcesTest.java | 6 ++--
.../ivy/core/publish/PublishEventsTest.java | 8 ++---
.../apache/ivy/core/retrieve/RetrieveTest.java | 2 +-
.../ivy/osgi/core/OsgiLatestStrategyTest.java | 12 +++----
.../latest/LatestRevisionStrategyTest.java | 16 ++++-----
.../xml/XmlModuleDescriptorParserTest.java | 36 ++++++++++----------
.../ivy/plugins/resolver/MockResolver.java | 2 +-
9 files changed, 44 insertions(+), 47 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3b28fffb/test/java/org/apache/ivy/ant/AntCallTriggerTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/AntCallTriggerTest.java b/test/java/org/apache/ivy/ant/AntCallTriggerTest.java
index f92a714..1383366 100644
--- a/test/java/org/apache/ivy/ant/AntCallTriggerTest.java
+++ b/test/java/org/apache/ivy/ant/AntCallTriggerTest.java
@@ -61,12 +61,12 @@ public class AntCallTriggerTest {
}
private void runAnt(File buildFile, String target, int messageLevel) throws BuildException {
- Vector targets = new Vector();
+ Vector<String> targets = new Vector<>();
targets.add(target);
runAnt(buildFile, targets, messageLevel);
}
- private void runAnt(File buildFile, Vector targets, int messageLevel) throws BuildException {
+ private void runAnt(File buildFile, Vector<String> targets, int messageLevel) throws BuildException {
runBuild(buildFile, targets, messageLevel);
// this exits the jvm at the end of the call
@@ -92,7 +92,7 @@ public class AntCallTriggerTest {
// ////////////////////////////////////////////////////////////////////////////
// miserable copy (updated to simple test cases) from ant Main class:
// the only available way I found to easily run ant exits jvm at the end
- private void runBuild(File buildFile, Vector targets, int messageLevel) throws BuildException {
+ private void runBuild(File buildFile, Vector<String> targets, int messageLevel) throws BuildException {
final Project project = new Project();
project.setCoreLoader(null);
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3b28fffb/test/java/org/apache/ivy/ant/IvyBuildListTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/IvyBuildListTest.java b/test/java/org/apache/ivy/ant/IvyBuildListTest.java
index cb5b4e4..01c0452 100644
--- a/test/java/org/apache/ivy/ant/IvyBuildListTest.java
+++ b/test/java/org/apache/ivy/ant/IvyBuildListTest.java
@@ -18,6 +18,7 @@
package org.apache.ivy.ant;
import java.io.File;
+import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -383,7 +384,7 @@ public class IvyBuildListTest {
assertListOfFiles("test/buildlist/", new String[] {"B", "C", "A", "D"}, files);
// the order of E and E2 is undefined
- List other = new ArrayList();
+ List<URI> other = new ArrayList<>();
other.add(new File(files[4]).getAbsoluteFile().toURI());
other.add(new File(files[5]).getAbsoluteFile().toURI());
Collections.sort(other);
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3b28fffb/test/java/org/apache/ivy/ant/IvyResourcesTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/IvyResourcesTest.java b/test/java/org/apache/ivy/ant/IvyResourcesTest.java
index ab60e6d..3103553 100644
--- a/test/java/org/apache/ivy/ant/IvyResourcesTest.java
+++ b/test/java/org/apache/ivy/ant/IvyResourcesTest.java
@@ -63,8 +63,8 @@ public class IvyResourcesTest {
return resources.getIvyInstance();
}
- private List asList(IvyResources ivyResources) {
- List resources = new ArrayList();
+ private List<File> asList(IvyResources ivyResources) {
+ List<File> resources = new ArrayList<>();
for (Object r : ivyResources) {
assertTrue(r instanceof FileResource);
resources.add(((FileResource) r).getFile());
@@ -202,7 +202,7 @@ public class IvyResourcesTest {
IvyDependencyExclude exclude = dependency.createExclude();
exclude.setOrg("org1");
- List files = asList(resources);
+ List<File> files = asList(resources);
assertEquals(3, files.size());
assertTrue(files.contains(getArchiveFileInCache("org1", "mod1.2", "2.0", "mod1.2", "jar",
"jar")));
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3b28fffb/test/java/org/apache/ivy/core/publish/PublishEventsTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/publish/PublishEventsTest.java b/test/java/org/apache/ivy/core/publish/PublishEventsTest.java
index 704a1fc..86a1401 100644
--- a/test/java/org/apache/ivy/core/publish/PublishEventsTest.java
+++ b/test/java/org/apache/ivy/core/publish/PublishEventsTest.java
@@ -74,7 +74,7 @@ public class PublishEventsTest {
private ModuleDescriptor publishModule;
- private Collection publishSources;
+ private Collection<String> publishSources;
private PublishOptions publishOptions;
@@ -180,7 +180,7 @@ public class PublishEventsTest {
// no modifications to input required for this case -- call out to the resolver, and verify
// that
// all of our test counters have been incremented.
- Collection missing = publishEngine.publish(publishModule.getModuleRevisionId(),
+ Collection<Artifact> missing = publishEngine.publish(publishModule.getModuleRevisionId(),
publishSources, "default", publishOptions);
assertEquals("no missing artifacts", 0, missing.size());
@@ -203,7 +203,7 @@ public class PublishEventsTest {
// set overwrite to true. InstrumentedResolver will verify that the correct argument value
// was provided.
publishOptions.setOverwrite(true);
- Collection missing = publishEngine.publish(publishModule.getModuleRevisionId(),
+ Collection<Artifact> missing = publishEngine.publish(publishModule.getModuleRevisionId(),
publishSources, "default", publishOptions);
assertEquals("no missing artifacts", 0, missing.size());
@@ -224,7 +224,7 @@ public class PublishEventsTest {
assertTrue("datafile has been destroyed", dataFile.delete());
PublishTestCase dataPublish = expectedPublications.get(dataArtifact.getId());
dataPublish.expectedSuccess = false;
- Collection missing = publishEngine.publish(publishModule.getModuleRevisionId(),
+ Collection<Artifact> missing = publishEngine.publish(publishModule.getModuleRevisionId(),
publishSources, "default", publishOptions);
assertEquals("one missing artifact", 1, missing.size());
assertSameArtifact("missing artifact was returned", dataArtifact, (Artifact) missing
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3b28fffb/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java b/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java
index 37a187c..12b92be 100644
--- a/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java
+++ b/test/java/org/apache/ivy/core/retrieve/RetrieveTest.java
@@ -137,7 +137,7 @@ public class RetrieveTest {
"test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml").toURI().toURL(),
getResolveOptions(new String[] {"*"}));
- final List events = new ArrayList();
+ final List<IvyEvent> events = new ArrayList<>();
ivy.getEventManager().addIvyListener(new IvyListener() {
public void progress(IvyEvent event) {
events.add(event);
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3b28fffb/test/java/org/apache/ivy/osgi/core/OsgiLatestStrategyTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/osgi/core/OsgiLatestStrategyTest.java b/test/java/org/apache/ivy/osgi/core/OsgiLatestStrategyTest.java
index 8a9305e..c0f0a8e 100644
--- a/test/java/org/apache/ivy/osgi/core/OsgiLatestStrategyTest.java
+++ b/test/java/org/apache/ivy/osgi/core/OsgiLatestStrategyTest.java
@@ -37,7 +37,7 @@ public class OsgiLatestStrategyTest {
"1.0.0.gamma", "1.0.0.rc1", "1.0.0.rc2", "1.0.1", "2", "2.0.0.b006", "2.0.0.b012",
"2.0.0.xyz"});
- List shuffled = new ArrayList(Arrays.asList(revs));
+ List<ArtifactInfo> shuffled = new ArrayList<>(Arrays.asList(revs));
Collections.shuffle(shuffled);
Collections.sort(shuffled, new OsgiLatestStrategy().new ArtifactInfoComparator());
assertEquals(Arrays.asList(revs), shuffled);
@@ -49,9 +49,8 @@ public class OsgiLatestStrategyTest {
"1.0.0.gamma", "1.0.0.rc1", "1.0.0.rc2", "1.0.1", "2", "2.0.0.b006", "2.0.0.b012",
"2.0.0.xyz"});
- List shuffled = new ArrayList(Arrays.asList(revs));
- ArtifactInfo[] shuffledRevs = (ArtifactInfo[]) shuffled
- .toArray(new ArtifactInfo[revs.length]);
+ List<ArtifactInfo> shuffled = new ArrayList<>(Arrays.asList(revs));
+ ArtifactInfo[] shuffledRevs = shuffled.toArray(new ArtifactInfo[revs.length]);
OsgiLatestStrategy latestRevisionStrategy = new OsgiLatestStrategy();
List sorted = latestRevisionStrategy.sort(shuffledRevs);
@@ -65,10 +64,9 @@ public class OsgiLatestStrategyTest {
"1.0.0.beta1", "1.0.0.beta2", "1.0.0.gamma", "1.0.0.rc1", "1.0.0.rc2", "1.0",
"1.0.1", "2.0"});
- List shuffled = new ArrayList(Arrays.asList(revs));
+ List<ArtifactInfo> shuffled = new ArrayList<>(Arrays.asList(revs));
Collections.shuffle(shuffled);
- ArtifactInfo[] shuffledRevs = (ArtifactInfo[]) shuffled
- .toArray(new ArtifactInfo[revs.length]);
+ ArtifactInfo[] shuffledRevs = shuffled.toArray(new ArtifactInfo[revs.length]);
OsgiLatestStrategy latestRevisionStrategy = new OsgiLatestStrategy();
ArtifactInfo latest = latestRevisionStrategy.findLatest(shuffledRevs, new Date());
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3b28fffb/test/java/org/apache/ivy/plugins/latest/LatestRevisionStrategyTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/latest/LatestRevisionStrategyTest.java b/test/java/org/apache/ivy/plugins/latest/LatestRevisionStrategyTest.java
index b2df0dd..dbcf3e0 100644
--- a/test/java/org/apache/ivy/plugins/latest/LatestRevisionStrategyTest.java
+++ b/test/java/org/apache/ivy/plugins/latest/LatestRevisionStrategyTest.java
@@ -35,7 +35,7 @@ public class LatestRevisionStrategyTest {
"1.0-dev1", "1.0-dev2", "1.0-alpha1", "1.0-alpha2", "1.0-beta1", "1.0-beta2",
"1.0-gamma", "1.0-rc1", "1.0-rc2", "1.0", "1.0.1", "2.0"});
- List shuffled = new ArrayList(Arrays.asList(revs));
+ List<ArtifactInfo> shuffled = new ArrayList<>(Arrays.asList(revs));
Collections.shuffle(shuffled);
Collections.sort(shuffled, new LatestRevisionStrategy().new ArtifactInfoComparator());
assertEquals(Arrays.asList(revs), shuffled);
@@ -47,12 +47,11 @@ public class LatestRevisionStrategyTest {
"1.0-dev1", "1.0-dev2", "1.0-alpha1", "1.0-alpha2", "1.0-beta1", "1.0-beta2",
"1.0-gamma", "1.0-rc1", "1.0-rc2", "1.0", "1.0.1", "2.0"});
- List shuffled = new ArrayList(Arrays.asList(revs));
- ArtifactInfo[] shuffledRevs = (ArtifactInfo[]) shuffled
- .toArray(new ArtifactInfo[revs.length]);
+ List<ArtifactInfo> shuffled = new ArrayList<>(Arrays.asList(revs));
+ ArtifactInfo[] shuffledRevs = shuffled.toArray(new ArtifactInfo[revs.length]);
LatestRevisionStrategy latestRevisionStrategy = new LatestRevisionStrategy();
- List sorted = latestRevisionStrategy.sort(shuffledRevs);
+ List<ArtifactInfo> sorted = latestRevisionStrategy.sort(shuffledRevs);
assertEquals(Arrays.asList(revs), sorted);
}
@@ -62,9 +61,8 @@ public class LatestRevisionStrategyTest {
"1.0-dev1", "1.0-dev2", "1.0-alpha1", "1.0-alpha2", "1.0-beta1", "1.0-beta2",
"1.0-gamma", "1.0-rc1", "1.0-rc2", "1.0", "1.0.1", "2.0"});
- List shuffled = new ArrayList(Arrays.asList(revs));
- ArtifactInfo[] shuffledRevs = (ArtifactInfo[]) shuffled
- .toArray(new ArtifactInfo[revs.length]);
+ List<ArtifactInfo> shuffled = new ArrayList<>(Arrays.asList(revs));
+ ArtifactInfo[] shuffledRevs = shuffled.toArray(new ArtifactInfo[revs.length]);
LatestRevisionStrategy latestRevisionStrategy = new LatestRevisionStrategy();
ArtifactInfo latest = latestRevisionStrategy.findLatest(shuffledRevs, new Date());
@@ -77,7 +75,7 @@ public class LatestRevisionStrategyTest {
ArtifactInfo[] revs = toMockAI(new String[] {"0.1", "0.2-pre", "0.2-dev", "0.2-rc1",
"0.2-final", "0.2-QA", "1.0-dev1"});
- List shuffled = new ArrayList(Arrays.asList(revs));
+ List<ArtifactInfo> shuffled = new ArrayList<>(Arrays.asList(revs));
Collections.shuffle(shuffled);
LatestRevisionStrategy latestRevisionStrategy = new LatestRevisionStrategy();
LatestRevisionStrategy.SpecialMeaning specialMeaning = new LatestRevisionStrategy.SpecialMeaning();
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3b28fffb/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java b/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java
index d7baf8e..390d713 100644
--- a/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java
+++ b/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleDescriptorParserTest.java
@@ -334,8 +334,8 @@ public class XmlModuleDescriptorParserTest extends AbstractModuleDescriptorParse
assertNotNull(dd);
assertEquals("yourorg", dd.getDependencyId().getOrganisation());
assertEquals("4.1", dd.getDependencyRevisionId().getRevision());
- assertEquals(new HashSet(Arrays.asList(new String[] {"myconf1", "myconf2"})), new HashSet(
- Arrays.asList(dd.getModuleConfigurations())));
+ assertEquals(new HashSet<>(Arrays.asList(new String[] {"myconf1", "myconf2"})),
+ new HashSet<>(Arrays.asList(dd.getModuleConfigurations())));
assertEquals(Arrays.asList(new String[] {"yourconf1", "yourconf2"}),
Arrays.asList(dd.getDependencyConfigurations("myconf1")));
assertEquals(Arrays.asList(new String[] {"yourconf1", "yourconf2"}),
@@ -350,8 +350,8 @@ public class XmlModuleDescriptorParserTest extends AbstractModuleDescriptorParse
assertNotNull(dd);
assertEquals("yourorg", dd.getDependencyId().getOrganisation());
assertEquals("5.1", dd.getDependencyRevisionId().getRevision());
- assertEquals(new HashSet(Arrays.asList(new String[] {"myconf1", "myconf2"})), new HashSet(
- Arrays.asList(dd.getModuleConfigurations())));
+ assertEquals(new HashSet<>(Arrays.asList(new String[] {"myconf1", "myconf2"})),
+ new HashSet<>(Arrays.asList(dd.getModuleConfigurations())));
assertEquals(Arrays.asList(new String[] {"yourconf1"}),
Arrays.asList(dd.getDependencyConfigurations("myconf1")));
assertEquals(Arrays.asList(new String[] {"yourconf1", "yourconf2"}),
@@ -366,8 +366,8 @@ public class XmlModuleDescriptorParserTest extends AbstractModuleDescriptorParse
assertNotNull(dd);
assertEquals("yourorg", dd.getDependencyId().getOrganisation());
assertEquals("11.1", dd.getDependencyRevisionId().getRevision());
- assertEquals(new HashSet(Arrays.asList(new String[] {"*"})),
- new HashSet(Arrays.asList(dd.getModuleConfigurations())));
+ assertEquals(new HashSet<>(Arrays.asList(new String[] {"*"})),
+ new HashSet<>(Arrays.asList(dd.getModuleConfigurations())));
assertEquals(Arrays.asList(new String[] {"myconf1"}),
Arrays.asList(dd.getDependencyConfigurations("myconf1")));
assertEquals(Arrays.asList(new String[] {"myconf2"}),
@@ -381,8 +381,8 @@ public class XmlModuleDescriptorParserTest extends AbstractModuleDescriptorParse
assertNotNull(dd);
assertEquals("yourorg", dd.getDependencyId().getOrganisation());
assertEquals("latest.integration", dd.getDependencyRevisionId().getRevision());
- assertEquals(new HashSet(Arrays.asList(new String[] {"myconf1", "myconf2"})), new HashSet(
- Arrays.asList(dd.getModuleConfigurations())));
+ assertEquals(new HashSet<>(Arrays.asList(new String[] {"myconf1", "myconf2"})),
+ new HashSet<>(Arrays.asList(dd.getModuleConfigurations())));
assertEquals(Arrays.asList(new String[] {"yourconf1"}),
Arrays.asList(dd.getDependencyConfigurations("myconf1")));
assertEquals(Arrays.asList(new String[] {"yourconf1", "yourconf2"}),
@@ -396,8 +396,8 @@ public class XmlModuleDescriptorParserTest extends AbstractModuleDescriptorParse
assertNotNull(dd);
assertEquals("yourorg", dd.getDependencyId().getOrganisation());
assertEquals("7.1", dd.getDependencyRevisionId().getRevision());
- assertEquals(new HashSet(Arrays.asList(new String[] {"myconf1", "myconf2"})), new HashSet(
- Arrays.asList(dd.getModuleConfigurations())));
+ assertEquals(new HashSet<>(Arrays.asList(new String[] {"myconf1", "myconf2"})),
+ new HashSet<>(Arrays.asList(dd.getModuleConfigurations())));
assertEquals(Arrays.asList(new String[] {"yourconf1"}),
Arrays.asList(dd.getDependencyConfigurations("myconf1")));
assertEquals(Arrays.asList(new String[] {"yourconf1", "yourconf2"}),
@@ -411,8 +411,8 @@ public class XmlModuleDescriptorParserTest extends AbstractModuleDescriptorParse
assertNotNull(dd);
assertEquals("yourorg", dd.getDependencyId().getOrganisation());
assertEquals("8.1", dd.getDependencyRevisionId().getRevision());
- assertEquals(new HashSet(Arrays.asList(new String[] {"*"})),
- new HashSet(Arrays.asList(dd.getModuleConfigurations())));
+ assertEquals(new HashSet<>(Arrays.asList(new String[] {"*"})),
+ new HashSet<>(Arrays.asList(dd.getModuleConfigurations())));
assertDependencyArtifacts(dd, new String[] {"myconf1"}, new String[] {"yourartifact8-1",
"yourartifact8-2"});
assertDependencyArtifacts(dd, new String[] {"myconf2"}, new String[] {"yourartifact8-1",
@@ -426,8 +426,8 @@ public class XmlModuleDescriptorParserTest extends AbstractModuleDescriptorParse
assertNotNull(dd);
assertEquals("yourorg", dd.getDependencyId().getOrganisation());
assertEquals("9.1", dd.getDependencyRevisionId().getRevision());
- assertEquals(new HashSet(Arrays.asList(new String[] {"myconf1", "myconf2", "myconf3"})),
- new HashSet(Arrays.asList(dd.getModuleConfigurations())));
+ assertEquals(new HashSet<>(Arrays.asList(new String[] {"myconf1", "myconf2", "myconf3"})),
+ new HashSet<>(Arrays.asList(dd.getModuleConfigurations())));
assertDependencyArtifacts(dd, new String[] {"myconf1"}, new String[] {"yourartifact9-1"});
assertDependencyArtifacts(dd, new String[] {"myconf2"}, new String[] {"yourartifact9-1",
"yourartifact9-2"});
@@ -442,8 +442,8 @@ public class XmlModuleDescriptorParserTest extends AbstractModuleDescriptorParse
assertNotNull(dd);
assertEquals("yourorg", dd.getDependencyId().getOrganisation());
assertEquals("10.1", dd.getDependencyRevisionId().getRevision());
- assertEquals(new HashSet(Arrays.asList(new String[] {"*"})),
- new HashSet(Arrays.asList(dd.getModuleConfigurations())));
+ assertEquals(new HashSet<>(Arrays.asList(new String[] {"*"})),
+ new HashSet<>(Arrays.asList(dd.getModuleConfigurations())));
assertDependencyArtifactIncludeRules(dd, new String[] {"myconf1"}, new String[] {"your.*",
PatternMatcher.ANY_EXPRESSION});
assertDependencyArtifactIncludeRules(dd, new String[] {"myconf2"}, new String[] {"your.*",
@@ -884,8 +884,8 @@ public class XmlModuleDescriptorParserTest extends AbstractModuleDescriptorParse
// confs def: conf2,conf3->*
dd = getDependency(dependencies, "mymodule2");
- assertEquals(new HashSet(Arrays.asList(new String[] {"conf2", "conf3"})), new HashSet(
- Arrays.asList(dd.getModuleConfigurations())));
+ assertEquals(new HashSet<>(Arrays.asList(new String[] {"conf2", "conf3"})),
+ new HashSet<>(Arrays.asList(dd.getModuleConfigurations())));
assertEquals(Arrays.asList(new String[] {"*"}),
Arrays.asList(dd.getDependencyConfigurations("conf2")));
assertEquals(Arrays.asList(new String[] {"*"}),
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/3b28fffb/test/java/org/apache/ivy/plugins/resolver/MockResolver.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/plugins/resolver/MockResolver.java b/test/java/org/apache/ivy/plugins/resolver/MockResolver.java
index bfedc55..d7c9f65 100644
--- a/test/java/org/apache/ivy/plugins/resolver/MockResolver.java
+++ b/test/java/org/apache/ivy/plugins/resolver/MockResolver.java
@@ -64,7 +64,7 @@ public class MockResolver extends AbstractResolver {
return r;
}
- List askedDeps = new ArrayList();
+ List<DependencyDescriptor> askedDeps = new ArrayList<>();
ResolvedModuleRevision rmr;
[04/11] ant-ivy git commit: More generics…
Posted by jh...@apache.org.
More generics…
Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/314dfa80
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/314dfa80
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/314dfa80
Branch: refs/heads/master
Commit: 314dfa80d4e815ba3c689cd3ad0d508209665bf6
Parents: 8f35a1d
Author: twogee <g....@gmail.com>
Authored: Sun Jun 11 04:38:47 2017 +0200
Committer: twogee <g....@gmail.com>
Committed: Sun Jun 11 04:38:47 2017 +0200
----------------------------------------------------------------------
test/java/org/apache/ivy/TestHelper.java | 9 +++------
.../apache/ivy/core/publish/PublishEventsTest.java | 15 +++++++--------
2 files changed, 10 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/314dfa80/test/java/org/apache/ivy/TestHelper.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/TestHelper.java b/test/java/org/apache/ivy/TestHelper.java
index 1a18c66..c260f5a 100644
--- a/test/java/org/apache/ivy/TestHelper.java
+++ b/test/java/org/apache/ivy/TestHelper.java
@@ -108,9 +108,8 @@ public class TestHelper {
* @return a collection of {@link ModuleRevisionId}
*/
public static Collection<ModuleRevisionId> parseMrids(String mrids) {
- String[] m = mrids.split(",?\\s+");
Collection<ModuleRevisionId> c = new LinkedHashSet<ModuleRevisionId>();
- for (String s : m) {
+ for (String s : mrids.split(",?\\s+")) {
c.add(ModuleRevisionId.parse(s));
}
return c;
@@ -184,8 +183,7 @@ public class TestHelper {
ModuleRevisionId.parse(m.group(1)), new Date());
String mrids = m.group(2);
if (mrids != null) {
- Collection<ModuleRevisionId> depMrids = parseMrids(mrids);
- for (ModuleRevisionId dep : depMrids) {
+ for (ModuleRevisionId dep : parseMrids(mrids)) {
md.addDependency(new DefaultDependencyDescriptor(dep, false));
}
}
@@ -203,9 +201,8 @@ public class TestHelper {
* @return the collection of module descriptors parsed
*/
public static Collection<ModuleDescriptor> parseMicroIvyDescriptors(String microIvy) {
- String[] mds = microIvy.split("\\s*;;\\s*");
Collection<ModuleDescriptor> r = new ArrayList<ModuleDescriptor>();
- for (String md : mds) {
+ for (String md : microIvy.split("\\s*;;\\s*")) {
r.add(parseMicroIvyDescriptor(md));
}
return r;
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/314dfa80/test/java/org/apache/ivy/core/publish/PublishEventsTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/publish/PublishEventsTest.java b/test/java/org/apache/ivy/core/publish/PublishEventsTest.java
index 858d44a..13937c6 100644
--- a/test/java/org/apache/ivy/core/publish/PublishEventsTest.java
+++ b/test/java/org/apache/ivy/core/publish/PublishEventsTest.java
@@ -33,6 +33,7 @@ import org.apache.ivy.core.event.publish.StartArtifactPublishEvent;
import org.apache.ivy.core.module.descriptor.Artifact;
import org.apache.ivy.core.module.descriptor.MDArtifact;
import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
+import org.apache.ivy.core.module.id.ArtifactRevisionId;
import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorParser;
import org.apache.ivy.plugins.resolver.MockResolver;
import org.apache.ivy.plugins.trigger.AbstractTrigger;
@@ -46,7 +47,7 @@ import static org.junit.Assert.*;
public class PublishEventsTest {
// maps ArtifactRevisionId to PublishTestCase instance.
- private HashMap expectedPublications;
+ private HashMap<ArtifactRevisionId, PublishTestCase> expectedPublications;
// expected values for the current artifact being published.
private PublishTestCase currentTestCase;
@@ -123,7 +124,7 @@ public class PublishEventsTest {
assertEquals("sanity check", "foo", dataArtifact.getName());
ivyArtifact = MDArtifact.newIvyArtifact(publishModule);
- expectedPublications = new HashMap();
+ expectedPublications = new HashMap<ArtifactRevisionId, PublishTestCase>();
expectedPublications.put(dataArtifact.getId(), new PublishTestCase(dataArtifact, dataFile,
true));
expectedPublications.put(ivyArtifact.getId(), new PublishTestCase(ivyArtifact, ivyFile,
@@ -221,8 +222,7 @@ public class PublishEventsTest {
// delete the datafile. the publish should fail
// and the ivy artifact should still publish successfully.
assertTrue("datafile has been destroyed", dataFile.delete());
- PublishTestCase dataPublish = (PublishTestCase) expectedPublications.get(dataArtifact
- .getId());
+ PublishTestCase dataPublish = expectedPublications.get(dataArtifact.getId());
dataPublish.expectedSuccess = false;
Collection missing = publishEngine.publish(publishModule.getModuleRevisionId(),
publishSources, "default", publishOptions);
@@ -246,8 +246,8 @@ public class PublishEventsTest {
// set an error to be thrown during publication of the data file.
this.publishError = new IOException("boom!");
// we don't care which artifact is attempted; either will fail with an IOException.
- for (Object o : expectedPublications.values()) {
- ((PublishTestCase) o).expectedSuccess = false;
+ for (PublishTestCase publishTestCase : expectedPublications.values()) {
+ publishTestCase.expectedSuccess = false;
}
try {
@@ -386,8 +386,7 @@ public class PublishEventsTest {
Artifact artifact = startEvent.getArtifact();
assertNotNull("event defines artifact", artifact);
- PublishTestCase currentTestCase = (PublishTestCase) test.expectedPublications
- .remove(artifact.getId());
+ PublishTestCase currentTestCase = test.expectedPublications.remove(artifact.getId());
assertNotNull("artifact " + artifact.getId() + " was expected for publication",
currentTestCase);
assertFalse("current publication has not been visited yet",
[10/11] ant-ivy git commit: Merge branch 'PR-43'
Posted by jh...@apache.org.
Merge branch 'PR-43'
Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/c7d4b539
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/c7d4b539
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/c7d4b539
Branch: refs/heads/master
Commit: c7d4b539bd0684c22950ecf64684f0dcfe36ba7e
Parents: 545536e 3b28fff
Author: Jan Matèrne <jh...@apache.org>
Authored: Wed Jun 14 10:53:58 2017 +0200
Committer: Jan Matèrne <jh...@apache.org>
Committed: Wed Jun 14 10:53:58 2017 +0200
----------------------------------------------------------------------
ivy.xml | 32 ++---
src/example/bintray/ivy.xml | 10 +-
.../chainedresolvers-project/ivy.xml | 4 +-
src/example/configurations/jdbc-example/ivy.xml | 32 ++---
.../src/example/ConfigurationsExample.java | 9 +-
.../multi-projects/filter-framework/ivy.xml | 18 +--
.../src/filter/FilterProvider.java | 4 +-
.../src/filter/ccimpl/CCFilter.java | 14 +--
.../src/filter/hmimpl/HMFilter.java | 11 +-
.../test/filter/AbstractTestFilter.java | 1 -
.../configurations/multi-projects/myapp/ivy.xml | 12 +-
src/example/dependence/dependee/ivy.xml | 4 +-
src/example/dependence/depender/ivy.xml | 4 +-
src/example/dual/project/ivy.xml | 4 +-
src/example/dual/project/src/example/Hello.java | 51 --------
.../dual/project/src/example/HelloIvy.java | 51 ++++++++
src/example/hello-ivy/ivy.xml | 6 +-
src/example/hello-ivy/src/example/Hello.java | 51 --------
.../hello-ivy/src/example/HelloConsole.java | 51 ++++++++
.../multi-project/projects/console/ivy.xml | 12 +-
.../projects/console/src/console/Main.java | 10 +-
src/example/multi-project/projects/find/ivy.xml | 14 +--
.../projects/find/src/find/FindFile.java | 24 ++--
.../projects/find/src/find/Main.java | 36 +++---
src/example/multi-project/projects/list/ivy.xml | 10 +-
.../projects/list/src/list/ListFile.java | 16 +--
.../projects/list/src/list/Main.java | 25 ++--
src/example/multi-project/projects/size/ivy.xml | 8 +-
.../projects/size/src/size/FileSize.java | 19 +--
.../multi-project/projects/sizewhere/ivy.xml | 14 +--
.../projects/sizewhere/src/sizewhere/Main.java | 32 ++---
.../sizewhere/src/sizewhere/SizeWhere.java | 9 +-
.../multi-project/projects/version/ivy.xml | 4 +-
.../projects/version/src/version/Version.java | 4 +-
.../ivy/core/cache/RepositoryCacheManager.java | 18 +--
.../plugins/repository/ssh/SshRepository.java | 10 +-
.../ivy/plugins/repository/vfs/VfsResource.java | 8 +-
src/java/org/apache/ivy/util/FileUtil.java | 2 +-
test/java/org/apache/ivy/TestFixture.java | 3 +-
test/java/org/apache/ivy/TestHelper.java | 43 +++----
.../apache/ivy/ant/AntBuildResolverTest.java | 12 +-
.../org/apache/ivy/ant/AntCallTriggerTest.java | 11 +-
.../org/apache/ivy/ant/BuildOBRTaskTest.java | 5 +-
.../org/apache/ivy/ant/FixDepsTaskTest.java | 9 +-
.../org/apache/ivy/ant/IvyBuildListTest.java | 7 +-
.../java/org/apache/ivy/ant/IvyDeliverTest.java | 49 ++++----
.../apache/ivy/ant/IvyPostResolveTaskTest.java | 69 ++++++-----
.../java/org/apache/ivy/ant/IvyResolveTest.java | 2 +-
.../org/apache/ivy/ant/IvyResourcesTest.java | 11 +-
.../core/module/descriptor/IvyMakePomTest.java | 13 +--
.../apache/ivy/core/module/id/ModuleIdTest.java | 1 +
.../ivy/core/publish/PublishEventsTest.java | 24 ++--
.../ivy/core/report/ResolveReportTest.java | 4 +-
.../apache/ivy/core/resolve/ResolveTest.java | 116 +++++++++----------
.../apache/ivy/core/retrieve/RetrieveTest.java | 2 +-
.../org/apache/ivy/core/search/SearchTest.java | 18 +--
.../java/org/apache/ivy/core/sort/SortTest.java | 97 ++++++++--------
.../ivy/osgi/core/ManifestParserTest.java | 4 +-
.../ivy/osgi/core/OsgiLatestStrategyTest.java | 12 +-
.../apache/ivy/osgi/obr/OBRResolverTest.java | 6 +-
.../apache/ivy/osgi/obr/OBRXMLWriterTest.java | 12 +-
.../conflict/LatestConflictManagerTest.java | 20 +---
.../latest/LatestRevisionStrategyTest.java | 16 ++-
.../plugins/lock/ArtifactLockStrategyTest.java | 6 +-
.../matcher/AbstractPatternMatcherTest.java | 16 +--
.../xml/XmlModuleDescriptorParserTest.java | 36 +++---
.../parser/xml/XmlModuleUpdaterTest.java | 18 +--
.../repository/vfs/VfsRepositoryTest.java | 33 ++----
.../plugins/repository/vfs/VfsResourceTest.java | 50 +++-----
.../plugins/repository/vfs/VfsTestHelper.java | 10 +-
.../ivy/plugins/repository/vfs/VfsURI.java | 41 ++++---
.../ivy/plugins/resolver/ChainResolverTest.java | 16 +--
.../plugins/resolver/IBiblioResolverTest.java | 4 +-
.../ivy/plugins/resolver/MockResolver.java | 2 +-
.../org/apache/ivy/util/ConfiguratorTest.java | 10 +-
.../org/apache/ivy/util/MockMessageLogger.java | 6 +-
.../ivy/util/url/ApacheURLListerTest.java | 20 ++--
77 files changed, 695 insertions(+), 783 deletions(-)
----------------------------------------------------------------------
[06/11] ant-ivy git commit: Untabify
Posted by jh...@apache.org.
Untabify
Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/d7651dce
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/d7651dce
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/d7651dce
Branch: refs/heads/master
Commit: d7651dce4016976d41d71d07d9f5e7f4bebda902
Parents: fb3ccf6
Author: twogee <g....@gmail.com>
Authored: Tue Jun 13 19:49:25 2017 +0200
Committer: twogee <g....@gmail.com>
Committed: Tue Jun 13 19:49:25 2017 +0200
----------------------------------------------------------------------
.../hello-ivy/src/example/HelloConsole.java | 2 +-
.../projects/find/src/find/Main.java | 4 ++--
.../projects/list/src/list/Main.java | 2 +-
.../ivy/core/cache/RepositoryCacheManager.java | 18 +++++++++---------
.../ivy/plugins/repository/ssh/SshRepository.java | 10 +++++-----
src/java/org/apache/ivy/util/FileUtil.java | 2 +-
6 files changed, 19 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d7651dce/src/example/hello-ivy/src/example/HelloConsole.java
----------------------------------------------------------------------
diff --git a/src/example/hello-ivy/src/example/HelloConsole.java b/src/example/hello-ivy/src/example/HelloConsole.java
index 1d32c35..4f9aa01 100644
--- a/src/example/hello-ivy/src/example/HelloConsole.java
+++ b/src/example/hello-ivy/src/example/HelloConsole.java
@@ -30,7 +30,7 @@ import org.apache.commons.lang.WordUtils;
public final class HelloConsole {
public static void main(String[] args) throws Exception {
Option msg = Option.builder("m")
- .longOpt("message")
+ .longOpt("message")
.hasArg()
.desc("the message to capitalize")
.build();
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d7651dce/src/example/multi-project/projects/find/src/find/Main.java
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/find/src/find/Main.java b/src/example/multi-project/projects/find/src/find/Main.java
index 731f168..ef2aa82 100644
--- a/src/example/multi-project/projects/find/src/find/Main.java
+++ b/src/example/multi-project/projects/find/src/find/Main.java
@@ -31,12 +31,12 @@ import java.util.Collection;
public final class Main {
private static Options getOptions() {
Option dir = Option.builder("d")
- .longOpt("dir")
+ .longOpt("dir")
.hasArg()
.desc("list files in given dir")
.build();
Option name = Option.builder("n")
- .longOpt("name")
+ .longOpt("name")
.hasArg()
.desc("list files with given name")
.build();
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d7651dce/src/example/multi-project/projects/list/src/list/Main.java
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/list/src/list/Main.java b/src/example/multi-project/projects/list/src/list/Main.java
index c45f0d9..a230d2b 100644
--- a/src/example/multi-project/projects/list/src/list/Main.java
+++ b/src/example/multi-project/projects/list/src/list/Main.java
@@ -30,7 +30,7 @@ import org.apache.commons.cli.ParseException;
public final class Main {
private static Options getOptions() {
Option dir = Option.builder("d")
- .longOpt("dir")
+ .longOpt("dir")
.hasArg()
.desc("list files in given dir")
.build();
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d7651dce/src/java/org/apache/ivy/core/cache/RepositoryCacheManager.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/core/cache/RepositoryCacheManager.java b/src/java/org/apache/ivy/core/cache/RepositoryCacheManager.java
index b2b3e77..c45d4d1 100644
--- a/src/java/org/apache/ivy/core/cache/RepositoryCacheManager.java
+++ b/src/java/org/apache/ivy/core/cache/RepositoryCacheManager.java
@@ -114,8 +114,8 @@ public interface RepositoryCacheManager {
*/
ArtifactDownloadReport downloadRepositoryResource(Resource resource, String name,
String type, String extension,
- CacheResourceOptions options,
- Repository repository);
+ CacheResourceOptions options,
+ Repository repository);
/**
* Caches an original module descriptor.
@@ -140,27 +140,27 @@ public interface RepositoryCacheManager {
*/
ResolvedModuleRevision cacheModuleDescriptor(DependencyResolver resolver,
ResolvedResource originalMetadataRef,
- DependencyDescriptor dd,
+ DependencyDescriptor dd,
Artifact requestedMetadataArtifact,
- ResourceDownloader downloader,
+ 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
+ * from
* @param originalMetadataRef a resolved resource pointing to the remote original module
- * descriptor
+ * descriptor
* @param requestedMetadataArtifact the module descriptor artifact as requested originally
* @param rmr the {@link ResolvedModuleRevision} representing the local
- * cached module descriptor
+ * cached module descriptor
* @param writer a {@link ModuleDescriptorWriter} able to write the module
- * descriptor to a stream.
+ * descriptor to a stream.
*/
void originalToCachedModuleDescriptor(DependencyResolver resolver,
ResolvedResource originalMetadataRef,
- Artifact requestedMetadataArtifact,
+ Artifact requestedMetadataArtifact,
ResolvedModuleRevision rmr, ModuleDescriptorWriter writer);
/**
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d7651dce/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java b/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java
index 65dd378..5c3a9c0 100644
--- a/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java
+++ b/src/java/org/apache/ivy/plugins/repository/ssh/SshRepository.java
@@ -59,9 +59,9 @@ public class SshRepository extends AbstractSshBasedRepository {
/**
* create a new resource with lazy initializing
- *
- * @param source String
- * @return Resource
+ *
+ * @param source String
+ * @return Resource
*/
public Resource getResource(String source) {
Message.debug("SShRepository:getResource called: " + source);
@@ -446,8 +446,8 @@ public class SshRepository extends AbstractSshBasedRepository {
/**
* return ssh as scheme use the Resolver type name here? would be nice if it would be static, so
* we could use SshResolver.getTypeName()
- *
- * @return String
+ *
+ * @return String
*/
protected String getRepositoryScheme() {
return "ssh";
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/d7651dce/src/java/org/apache/ivy/util/FileUtil.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/ivy/util/FileUtil.java b/src/java/org/apache/ivy/util/FileUtil.java
index ad4fb10..4ba2dd0 100644
--- a/src/java/org/apache/ivy/util/FileUtil.java
+++ b/src/java/org/apache/ivy/util/FileUtil.java
@@ -59,7 +59,7 @@ public final class FileUtil {
// according to tests by users, 64kB seems to be a good value for the buffer used during copy;
// further improvements could be obtained using NIO API
- private static final int BUFFER_SIZE = 64 * 1024;
+ private static final int BUFFER_SIZE = 64 * 1024;
private static final byte[] EMPTY_BUFFER = new byte[0];
[05/11] ant-ivy git commit: Complete generification of examples;
update example dependencies; use Java 7 syntax in test;
fix regression in ModuleIdTest
Posted by jh...@apache.org.
Complete generification of examples; update example dependencies; use Java 7 syntax in test; fix regression in ModuleIdTest
Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/fb3ccf60
Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/fb3ccf60
Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/fb3ccf60
Branch: refs/heads/master
Commit: fb3ccf60e9a2d55a1abe8aafe38e45861e7a8eac
Parents: 314dfa8
Author: twogee <g....@gmail.com>
Authored: Tue Jun 13 19:35:37 2017 +0200
Committer: twogee <g....@gmail.com>
Committed: Tue Jun 13 19:35:37 2017 +0200
----------------------------------------------------------------------
src/example/bintray/ivy.xml | 10 ++--
.../chainedresolvers-project/ivy.xml | 4 +-
src/example/configurations/jdbc-example/ivy.xml | 32 ++++++-------
.../src/example/ConfigurationsExample.java | 9 ++--
.../multi-projects/filter-framework/ivy.xml | 18 +++----
.../src/filter/FilterProvider.java | 4 +-
.../src/filter/ccimpl/CCFilter.java | 12 ++---
.../src/filter/hmimpl/HMFilter.java | 8 ++--
.../configurations/multi-projects/myapp/ivy.xml | 12 ++---
src/example/dependence/dependee/ivy.xml | 4 +-
src/example/dependence/depender/ivy.xml | 4 +-
src/example/dual/project/ivy.xml | 4 +-
.../dual/project/src/example/HelloIvy.java | 4 +-
src/example/hello-ivy/ivy.xml | 6 +--
.../hello-ivy/src/example/HelloConsole.java | 14 +++---
.../multi-project/projects/console/ivy.xml | 12 ++---
.../projects/console/src/console/Main.java | 10 ++--
src/example/multi-project/projects/find/ivy.xml | 14 +++---
.../projects/find/src/find/FindFile.java | 24 +++++-----
.../projects/find/src/find/Main.java | 34 +++++++-------
src/example/multi-project/projects/list/ivy.xml | 10 ++--
.../projects/list/src/list/ListFile.java | 11 +++--
.../projects/list/src/list/Main.java | 18 ++++---
src/example/multi-project/projects/size/ivy.xml | 8 ++--
.../projects/size/src/size/FileSize.java | 18 +++----
.../multi-project/projects/sizewhere/ivy.xml | 14 +++---
.../projects/sizewhere/src/sizewhere/Main.java | 32 ++++++-------
.../sizewhere/src/sizewhere/SizeWhere.java | 9 ++--
.../multi-project/projects/version/ivy.xml | 4 +-
.../projects/version/src/version/Version.java | 4 +-
.../org/apache/ivy/ant/AntCallTriggerTest.java | 5 +-
.../org/apache/ivy/ant/BuildOBRTaskTest.java | 5 +-
.../org/apache/ivy/ant/FixDepsTaskTest.java | 2 +-
.../java/org/apache/ivy/ant/IvyDeliverTest.java | 49 +++++++++-----------
.../apache/ivy/core/module/id/ModuleIdTest.java | 1 +
35 files changed, 211 insertions(+), 218 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/bintray/ivy.xml
----------------------------------------------------------------------
diff --git a/src/example/bintray/ivy.xml b/src/example/bintray/ivy.xml
index 120a43b..9b9721c 100644
--- a/src/example/bintray/ivy.xml
+++ b/src/example/bintray/ivy.xml
@@ -20,12 +20,12 @@
<info organisation="org.apache" module="hello-ivy"/>
<dependencies>
<!-- https://jcenter.bintray.com/ -->
- <dependency org="org.jfrog.artifactory.client" name="artifactory-cli" rev="1.0" />
- <dependency org="org.jfrog.artifactory.client" name="artifactory-cli" rev="1.0" />
- <dependency org="org.jfrog" name="build-info-api" rev="1.3.1" />
+ <dependency org="org.jfrog.artifactory.client" name="artifactory-cli" rev="1.0"/>
+ <dependency org="org.jfrog.artifactory.client" name="artifactory-cli" rev="1.0"/>
+ <dependency org="org.jfrog" name="build-info-api" rev="1.3.1"/>
<!-- https://dl.bintray.com/dsowerby/maven/ -->
- <dependency org="uk.q3c.krail" name="krail" rev="0.7.0" />
+ <dependency org="uk.q3c.krail" name="krail" rev="0.7.0"/>
<!-- https://dl.bintray.com/igelgrun/batrak/ -->
- <dependency org="igel.batrak" name="batrak-core" rev="0.1" />
+ <dependency org="igel.batrak" name="batrak-core" rev="0.1"/>
</dependencies>
</ivy-module>
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/chained-resolvers/chainedresolvers-project/ivy.xml
----------------------------------------------------------------------
diff --git a/src/example/chained-resolvers/chainedresolvers-project/ivy.xml b/src/example/chained-resolvers/chainedresolvers-project/ivy.xml
index 450d0a6..5509889 100644
--- a/src/example/chained-resolvers/chainedresolvers-project/ivy.xml
+++ b/src/example/chained-resolvers/chainedresolvers-project/ivy.xml
@@ -14,12 +14,12 @@
"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.
+ under the License.
-->
<ivy-module version="1.0">
<info organisation="org.apache" module="chained-resolvers"/>
<dependencies>
- <dependency org="commons-lang" name="commons-lang" rev="2.0" conf="default"/>
+ <dependency org="commons-lang" name="commons-lang" rev="2.6" conf="default"/>
<dependency name="test" rev="1.0"/>
</dependencies>
</ivy-module>
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/configurations/jdbc-example/ivy.xml
----------------------------------------------------------------------
diff --git a/src/example/configurations/jdbc-example/ivy.xml b/src/example/configurations/jdbc-example/ivy.xml
index 8e42350..ee8a82c 100644
--- a/src/example/configurations/jdbc-example/ivy.xml
+++ b/src/example/configurations/jdbc-example/ivy.xml
@@ -15,30 +15,30 @@
"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.
+ under the License.
-->
<ivy-module version="1.0">
<info organisation="org.apache" module="configurations" >
- <description>
- This is an example project that aims to demonstrate the usage of the configuration in ivy.
- This project provide 4 configurations. Each configurations describe the requirement to build or run the project
- </description>
+ <description>
+ This is an example project that aims to demonstrate the usage of the configuration in ivy.
+ This project provide 4 configurations. Each configurations describe the requirement to build or run the project
+ </description>
</info>
<configurations>
- <conf name="compile" description="This is this configuration that describes modules need to build our project"/>
- <conf name="test" extends="compile" description="This is this configuration that describes modules need to run test on our project"/>
- <conf name="rundev" extends="compile" description="This is this configuration that describes modules need to execute our project in a dev environement"/>
- <conf name="runprod" extends="compile" description="This is this configuration that describes modules need to execute our project in a production environement"/>
+ <conf name="compile" description="This is this configuration that describes modules need to build our project"/>
+ <conf name="test" extends="compile" description="This is this configuration that describes modules need to run test on our project"/>
+ <conf name="rundev" extends="compile" description="This is this configuration that describes modules need to execute our project in a dev environement"/>
+ <conf name="runprod" extends="compile" description="This is this configuration that describes modules need to execute our project in a production environement"/>
</configurations>
-
+
<dependencies>
- <!-- this dependency is needed for all configuration -->
- <dependency org="commons-cli" name="commons-cli" rev="1.0" />
+ <!-- this dependency is needed for all configuration -->
+ <dependency org="commons-cli" name="commons-cli" rev="1.4"/>
<!-- when launching our app in dev mode we use mckoi db and mckoi jdbc client conf="run.dev->embedded, client"-->
- <dependency org="mckoi" name="mckoi" rev="1.0.2" conf="rundev->default"/>
+ <dependency org="mckoi" name="mckoi" rev="1.0.2" conf="rundev->default"/>
<!-- when launching our app in production environement we needs other jdbc driver -->
- <dependency org="mm-mysql" name="mm-mysql" rev="2.0.7" conf="runprod->default"/>
- <!-- junit is only need in the test configuration-->
- <dependency org="junit" name="junit" rev="4.12" conf="test->default"/>
+ <dependency org="mm-mysql" name="mm-mysql" rev="2.0.7" conf="runprod->default"/>
+ <!-- junit is only need in the test configuration-->
+ <dependency org="junit" name="junit" rev="4.12" conf="test->default"/>
</dependencies>
</ivy-module>
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/configurations/jdbc-example/src/example/ConfigurationsExample.java
----------------------------------------------------------------------
diff --git a/src/example/configurations/jdbc-example/src/example/ConfigurationsExample.java b/src/example/configurations/jdbc-example/src/example/ConfigurationsExample.java
index 925824f..0a6a0e6 100644
--- a/src/example/configurations/jdbc-example/src/example/ConfigurationsExample.java
+++ b/src/example/configurations/jdbc-example/src/example/ConfigurationsExample.java
@@ -17,19 +17,20 @@
*/
package example;
-import java.io.IOException;
-import java.util.Properties;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
-import org.apache.commons.cli.PosixParser;
+
+import java.io.IOException;
+import java.util.Properties;
public final class ConfigurationsExample {
public static void main(String[] args) {
String jdbcPropToLoad = "prod.properties";
- CommandLineParser parser = new PosixParser();
+ CommandLineParser parser = new DefaultParser();
Options options = new Options();
options.addOption("d", "dev", false,
"Dev tag to launch app in dev mode. Means that app will launch embedded mckoi db.");
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/configurations/multi-projects/filter-framework/ivy.xml
----------------------------------------------------------------------
diff --git a/src/example/configurations/multi-projects/filter-framework/ivy.xml b/src/example/configurations/multi-projects/filter-framework/ivy.xml
index fc5e6de..e0c0794 100644
--- a/src/example/configurations/multi-projects/filter-framework/ivy.xml
+++ b/src/example/configurations/multi-projects/filter-framework/ivy.xml
@@ -14,23 +14,23 @@
"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.
+ under the License.
-->
<ivy-module version="1.0">
<info organisation="org.apache" module="filter-framework"/>
<configurations>
- <conf name="api" description="only provide filter framework API"/>
- <conf name="homemade-impl" extends="api" description="provide a home made implementation of our api"/>
- <conf name="cc-impl" extends="api" description="provide an implementation that use apache common collection framework"/>
- <conf name="test" extends="cc-impl" visibility="private" description="for testing our framework"/>
+ <conf name="api" description="only provide filter framework API"/>
+ <conf name="homemade-impl" extends="api" description="provide a home made implementation of our api"/>
+ <conf name="cc-impl" extends="api" description="provide an implementation that use apache common collection framework"/>
+ <conf name="test" extends="cc-impl" visibility="private" description="for testing our framework"/>
</configurations>
<publications>
- <artifact name="filter-api" type="jar" conf="api" ext="jar"/>
- <artifact name="filter-hmimpl" type="jar" conf="homemade-impl" ext="jar"/>
- <artifact name="filter-ccimpl" type="jar" conf="cc-impl" ext="jar"/>
+ <artifact name="filter-api" type="jar" conf="api" ext="jar"/>
+ <artifact name="filter-hmimpl" type="jar" conf="homemade-impl" ext="jar"/>
+ <artifact name="filter-ccimpl" type="jar" conf="cc-impl" ext="jar"/>
</publications>
<dependencies>
- <dependency org="commons-collections" name="commons-collections" rev="3.1" conf="cc-impl->default"/>
+ <dependency org="org.apache.commons" name="commons-collections4" rev="4.1" conf="cc-impl->default"/>
<dependency org="junit" name="junit" rev="4.12" conf="test->default"/>
</dependencies>
</ivy-module>
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/configurations/multi-projects/filter-framework/src/filter/FilterProvider.java
----------------------------------------------------------------------
diff --git a/src/example/configurations/multi-projects/filter-framework/src/filter/FilterProvider.java b/src/example/configurations/multi-projects/filter-framework/src/filter/FilterProvider.java
index a948c3e..7c9afbb 100644
--- a/src/example/configurations/multi-projects/filter-framework/src/filter/FilterProvider.java
+++ b/src/example/configurations/multi-projects/filter-framework/src/filter/FilterProvider.java
@@ -22,11 +22,11 @@ public final class FilterProvider {
public static IFilter getFilter() {
try {
- Class clazz = Class.forName("filter.ccimpl.CCFilter");
+ Class<?> clazz = Class.forName("filter.ccimpl.CCFilter");
return (IFilter) clazz.newInstance();
} catch (Exception e) {
try {
- Class clazz = Class.forName("filter.hmimpl.HMFilter");
+ Class<?> clazz = Class.forName("filter.hmimpl.HMFilter");
return (IFilter) clazz.newInstance();
} catch (Exception e1) {
System.err.println("No filter implementation found in classpath !");
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/configurations/multi-projects/filter-framework/src/filter/ccimpl/CCFilter.java
----------------------------------------------------------------------
diff --git a/src/example/configurations/multi-projects/filter-framework/src/filter/ccimpl/CCFilter.java b/src/example/configurations/multi-projects/filter-framework/src/filter/ccimpl/CCFilter.java
index 2dc71c4..af2c2fa 100644
--- a/src/example/configurations/multi-projects/filter-framework/src/filter/ccimpl/CCFilter.java
+++ b/src/example/configurations/multi-projects/filter-framework/src/filter/ccimpl/CCFilter.java
@@ -20,8 +20,8 @@ package filter.ccimpl;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.collections.Predicate;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
import filter.IFilter;
public class CCFilter implements IFilter {
@@ -34,10 +34,10 @@ public class CCFilter implements IFilter {
return values;
}
- List<String> result = new ArrayList<String>(Arrays.asList(values));
- CollectionUtils.filter(result, new Predicate() {
- public boolean evaluate(Object o) {
- return o != null && o.toString().startsWith(prefix);
+ List<String> result = new ArrayList<>(Arrays.asList(values));
+ CollectionUtils.filter(result, new Predicate<String>() {
+ public boolean evaluate(String string) {
+ return string != null && string.startsWith(prefix);
}
});
return result.toArray(new String[result.size()]);
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java
----------------------------------------------------------------------
diff --git a/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java b/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java
index 6e8b0ad..62b63f9 100644
--- a/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java
+++ b/src/example/configurations/multi-projects/filter-framework/src/filter/hmimpl/HMFilter.java
@@ -30,10 +30,10 @@ public class HMFilter implements IFilter {
if (prefix == null) {
return values;
}
- List<String> result = new ArrayList<String>();
- for (String string : values) {
- if (string != null && string.startsWith(prefix)) {
- result.add(string);
+ List<String> result = new ArrayList<>();
+ for (String value : values) {
+ if (value != null && value.startsWith(prefix)) {
+ result.add(value);
}
}
return result.toArray(new String[result.size()]);
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/configurations/multi-projects/myapp/ivy.xml
----------------------------------------------------------------------
diff --git a/src/example/configurations/multi-projects/myapp/ivy.xml b/src/example/configurations/multi-projects/myapp/ivy.xml
index 5890d33..3ad7521 100644
--- a/src/example/configurations/multi-projects/myapp/ivy.xml
+++ b/src/example/configurations/multi-projects/myapp/ivy.xml
@@ -14,17 +14,17 @@
"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.
+ under the License.
-->
<ivy-module version="1.0">
<info organisation="org.apache" module="myapp"/>
-
+
<configurations>
- <conf name="build" visibility="private" description="compilation only need api jar" />
- <conf name="noexternaljar" description="use only company jar" />
- <conf name="withexternaljar" description="use company jar and third party jars" />
+ <conf name="build" visibility="private" description="compilation only need api jar"/>
+ <conf name="noexternaljar" description="use only company jar"/>
+ <conf name="withexternaljar" description="use company jar and third party jars"/>
</configurations>
-
+
<dependencies>
<dependency org="org.apache" name="filter-framework" rev="latest.integration" conf="build->api; noexternaljar->homemade-impl; withexternaljar->cc-impl"/>
</dependencies>
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/dependence/dependee/ivy.xml
----------------------------------------------------------------------
diff --git a/src/example/dependence/dependee/ivy.xml b/src/example/dependence/dependee/ivy.xml
index c4196ff..3714320 100644
--- a/src/example/dependence/dependee/ivy.xml
+++ b/src/example/dependence/dependee/ivy.xml
@@ -14,11 +14,11 @@
"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.
+ under the License.
-->
<ivy-module version="1.0">
<info organisation="org.apache" module="dependee"/>
<dependencies>
- <dependency org="commons-lang" name="commons-lang" rev="2.0"/>
+ <dependency org="commons-lang" name="commons-lang" rev="2.6"/>
</dependencies>
</ivy-module>
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/dependence/depender/ivy.xml
----------------------------------------------------------------------
diff --git a/src/example/dependence/depender/ivy.xml b/src/example/dependence/depender/ivy.xml
index 1f77ce6..f4a14c5 100644
--- a/src/example/dependence/depender/ivy.xml
+++ b/src/example/dependence/depender/ivy.xml
@@ -14,11 +14,11 @@
"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.
+ under the License.
-->
<ivy-module version="1.0">
<info organisation="org.apache" module="depender"/>
<dependencies>
- <dependency name="dependee" rev="latest.integration" />
+ <dependency name="dependee" rev="latest.integration"/>
</dependencies>
</ivy-module>
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/dual/project/ivy.xml
----------------------------------------------------------------------
diff --git a/src/example/dual/project/ivy.xml b/src/example/dual/project/ivy.xml
index 02d8bab..7745cd3 100644
--- a/src/example/dual/project/ivy.xml
+++ b/src/example/dual/project/ivy.xml
@@ -14,12 +14,12 @@
"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.
+ under the License.
-->
<ivy-module version="1.0">
<info organisation="org.apache" module="hello-ivy"/>
<dependencies>
<dependency org="commons-httpclient" name="commons-httpclient" rev="2.0.2"/>
- <dependency org="commons-lang" name="commons-lang" rev="2.0"/>
+ <dependency org="commons-lang" name="commons-lang" rev="2.6"/>
</dependencies>
</ivy-module>
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/dual/project/src/example/HelloIvy.java
----------------------------------------------------------------------
diff --git a/src/example/dual/project/src/example/HelloIvy.java b/src/example/dual/project/src/example/HelloIvy.java
index 6125ff0..8ad7a9d 100644
--- a/src/example/dual/project/src/example/HelloIvy.java
+++ b/src/example/dual/project/src/example/HelloIvy.java
@@ -27,7 +27,7 @@ import org.apache.commons.lang.WordUtils;
*/
public final class HelloIvy {
public static void main(String[] args) throws Exception {
- String message = "hello ivy !";
+ String message = "Hello Ivy!";
System.out.println("standard message : " + message);
System.out.println("capitalized by " + WordUtils.class.getName()
+ " : " + WordUtils.capitalizeFully(message));
@@ -42,7 +42,7 @@ public final class HelloIvy {
System.out.println(
"now check if httpclient dependency on commons-logging has been realized");
- Class clss = Class.forName("org.apache.commons.logging.Log");
+ Class<?> clss = Class.forName("org.apache.commons.logging.Log");
System.out.println("found logging class in classpath: " + clss);
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/hello-ivy/ivy.xml
----------------------------------------------------------------------
diff --git a/src/example/hello-ivy/ivy.xml b/src/example/hello-ivy/ivy.xml
index da3870e..f6eeec1 100644
--- a/src/example/hello-ivy/ivy.xml
+++ b/src/example/hello-ivy/ivy.xml
@@ -14,12 +14,12 @@
"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.
+ under the License.
-->
<ivy-module version="2.0">
<info organisation="org.apache" module="hello-ivy"/>
<dependencies>
- <dependency org="commons-lang" name="commons-lang" rev="2.0"/>
- <dependency org="commons-cli" name="commons-cli" rev="1.0"/>
+ <dependency org="commons-lang" name="commons-lang" rev="2.6"/>
+ <dependency org="commons-cli" name="commons-cli" rev="1.4"/>
</dependencies>
</ivy-module>
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/hello-ivy/src/example/HelloConsole.java
----------------------------------------------------------------------
diff --git a/src/example/hello-ivy/src/example/HelloConsole.java b/src/example/hello-ivy/src/example/HelloConsole.java
index c3e51d1..1d32c35 100644
--- a/src/example/hello-ivy/src/example/HelloConsole.java
+++ b/src/example/hello-ivy/src/example/HelloConsole.java
@@ -19,9 +19,8 @@ package example;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
-import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.Option;
-import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.commons.lang.WordUtils;
@@ -30,17 +29,18 @@ import org.apache.commons.lang.WordUtils;
*/
public final class HelloConsole {
public static void main(String[] args) throws Exception {
- Option msg = OptionBuilder.withArgName("msg")
+ Option msg = Option.builder("m")
+ .longOpt("message")
.hasArg()
- .withDescription("the message to capitalize")
- .create("message");
+ .desc("the message to capitalize")
+ .build();
Options options = new Options();
options.addOption(msg);
- CommandLineParser parser = new GnuParser();
+ CommandLineParser parser = new DefaultParser();
CommandLine line = parser.parse(options, args);
- String message = line.getOptionValue("message", "hello ivy !");
+ String message = line.getOptionValue("m", "Hello Ivy!");
System.out.println("standard message : " + message);
System.out.println("capitalized by " + WordUtils.class.getName()
+ " : " + WordUtils.capitalizeFully(message));
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/multi-project/projects/console/ivy.xml
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/console/ivy.xml b/src/example/multi-project/projects/console/ivy.xml
index 959a58b..bdcb336 100644
--- a/src/example/multi-project/projects/console/ivy.xml
+++ b/src/example/multi-project/projects/console/ivy.xml
@@ -14,17 +14,17 @@
"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.
+ under the License.
-->
<ivy-module version="1.0">
- <info
+ <info
organisation="org.apache.ivy.example"
module="console"
status="integration"/>
<dependencies>
- <dependency name="version" rev="latest.integration" conf="default" />
- <dependency name="list" rev="latest.integration" conf="default->standalone" />
- <dependency name="find" rev="latest.integration" conf="default->standalone" />
- <dependency name="sizewhere" rev="latest.integration" conf="default->standalone" />
+ <dependency name="version" rev="latest.integration" conf="default"/>
+ <dependency name="list" rev="latest.integration" conf="default->standalone"/>
+ <dependency name="find" rev="latest.integration" conf="default->standalone"/>
+ <dependency name="sizewhere" rev="latest.integration" conf="default->standalone"/>
</dependencies>
</ivy-module>
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/multi-project/projects/console/src/console/Main.java
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/console/src/console/Main.java b/src/example/multi-project/projects/console/src/console/Main.java
index 87ab609..83dfad4 100644
--- a/src/example/multi-project/projects/console/src/console/Main.java
+++ b/src/example/multi-project/projects/console/src/console/Main.java
@@ -25,10 +25,10 @@ import java.lang.reflect.Method;
public final class Main {
- private static final Collection QUIT_COMMANDS =
- Arrays.asList(new String[] {"quit", "q", "exit"});
- private static final Collection HELP_COMMANDS =
- Arrays.asList(new String[] {"help", "h", "?"});
+ private static final Collection<String> QUIT_COMMANDS =
+ Arrays.asList("quit", "q", "exit");
+ private static final Collection<String> HELP_COMMANDS =
+ Arrays.asList("help", "h", "?");
public static void main(String[] a) throws Exception {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
@@ -51,7 +51,7 @@ public final class Main {
try {
String[] args = new String[split.length - 1];
System.arraycopy(split, 1, args, 0, args.length);
- Class cl = Class.forName(split[0] + ".Main");
+ Class<?> cl = Class.forName(split[0] + ".Main");
Method m = cl.getMethod("main", new Class[] {String[].class});
m.invoke(null, new Object[] {args});
} catch (Exception ex) {
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/multi-project/projects/find/ivy.xml
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/find/ivy.xml b/src/example/multi-project/projects/find/ivy.xml
index ce19513..9fc92ee 100644
--- a/src/example/multi-project/projects/find/ivy.xml
+++ b/src/example/multi-project/projects/find/ivy.xml
@@ -14,10 +14,10 @@
"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.
+ under the License.
-->
<ivy-module version="1.0">
- <info
+ <info
organisation="org.apache.ivy.example"
module="find"
status="integration"/>
@@ -26,12 +26,12 @@
<conf name="standalone" extends="core"/>
</configurations>
<publications>
- <artifact name="find" type="jar" conf="core" />
+ <artifact name="find" type="jar" conf="core"/>
</publications>
<dependencies>
- <dependency name="version" rev="latest.integration" conf="core->default" />
- <dependency name="list" rev="latest.integration" conf="core" />
- <dependency org="commons-collections" name="commons-collections" rev="3.1" conf="core->default" />
- <dependency org="commons-cli" name="commons-cli" rev="1.0" conf="standalone->default" />
+ <dependency name="version" rev="latest.integration" conf="core->default"/>
+ <dependency name="list" rev="latest.integration" conf="core"/>
+ <dependency org="org.apache.commons" name="commons-collections4" rev="4.1" conf="core->default"/>
+ <dependency org="commons-cli" name="commons-cli" rev="1.4" conf="standalone->default"/>
</dependencies>
</ivy-module>
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/multi-project/projects/find/src/find/FindFile.java
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/find/src/find/FindFile.java b/src/example/multi-project/projects/find/src/find/FindFile.java
index 8e54dc2..7df6379 100644
--- a/src/example/multi-project/projects/find/src/find/FindFile.java
+++ b/src/example/multi-project/projects/find/src/find/FindFile.java
@@ -17,28 +17,28 @@
*/
package find;
-import version.Version;
-import list.ListFile;
-
import java.util.Collection;
import java.io.File;
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.collections.Predicate;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.Predicate;
+
+import static list.ListFile.list;
+import static version.Version.register;
public final class FindFile {
static {
- Version.register("find");
+ register("find");
}
- public static Collection find(File dir, String name) {
- return find(ListFile.list(dir), name);
+ public static Collection<File> find(File dir, String name) {
+ return find(list(dir), name);
}
- private static Collection find(Collection files, final String name) {
- return CollectionUtils.select(files, new Predicate() {
- public boolean evaluate(Object o) {
- return ((File) o).getName().contains(name);
+ private static Collection<File> find(Collection<File> files, final String name) {
+ return CollectionUtils.select(files, new Predicate<File>() {
+ public boolean evaluate(File file) {
+ return file.getName().contains(name);
}
});
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/multi-project/projects/find/src/find/Main.java
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/find/src/find/Main.java b/src/example/multi-project/projects/find/src/find/Main.java
index ccfa1ce..731f168 100644
--- a/src/example/multi-project/projects/find/src/find/Main.java
+++ b/src/example/multi-project/projects/find/src/find/Main.java
@@ -17,29 +17,29 @@
*/
package find;
-import java.io.File;
-import java.util.Collection;
-import java.util.Iterator;
-
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
-import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
-import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
+import java.io.File;
+import java.util.Collection;
+
public final class Main {
private static Options getOptions() {
- Option dir = OptionBuilder.withArgName("dir")
+ Option dir = Option.builder("d")
+ .longOpt("dir")
.hasArg()
- .withDescription("list files in given dir")
- .create("dir");
- Option name = OptionBuilder.withArgName("name")
+ .desc("list files in given dir")
+ .build();
+ Option name = Option.builder("n")
+ .longOpt("name")
.hasArg()
- .withDescription("list files with given name")
- .create("name");
+ .desc("list files with given name")
+ .build();
Options options = new Options();
options.addOption(dir);
@@ -52,14 +52,14 @@ public final class Main {
Options options = getOptions();
try {
- CommandLineParser parser = new GnuParser();
+ CommandLineParser parser = new DefaultParser();
CommandLine line = parser.parse(options, args);
- File dir = new File(line.getOptionValue("dir", "."));
- String name = line.getOptionValue("name", "jar");
- Collection files = FindFile.find(dir, name);
+ File dir = new File(line.getOptionValue("d", "."));
+ String name = line.getOptionValue("n", "jar");
+ Collection<File> files = FindFile.find(dir, name);
System.out.println("listing files in " + dir + " containing " + name);
- for (Object file : files) {
+ for (File file : files) {
System.out.println("\t" + file + "\n");
}
} catch (ParseException exp) {
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/multi-project/projects/list/ivy.xml
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/list/ivy.xml b/src/example/multi-project/projects/list/ivy.xml
index 8251fdc..ebb6d06 100644
--- a/src/example/multi-project/projects/list/ivy.xml
+++ b/src/example/multi-project/projects/list/ivy.xml
@@ -14,10 +14,10 @@
"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.
+ under the License.
-->
<ivy-module version="1.0">
- <info
+ <info
organisation="org.apache.ivy.example"
module="list"
status="integration"/>
@@ -26,10 +26,10 @@
<conf name="standalone" extends="core"/>
</configurations>
<publications>
- <artifact name="list" type="jar" conf="core" />
+ <artifact name="list" type="jar" conf="core"/>
</publications>
<dependencies>
- <dependency name="version" rev="latest.integration" conf="core->default" />
- <dependency org="commons-cli" name="commons-cli" rev="1.0" conf="standalone->default" />
+ <dependency name="version" rev="latest.integration" conf="core->default"/>
+ <dependency org="commons-cli" name="commons-cli" rev="1.4" conf="standalone->default"/>
</dependencies>
</ivy-module>
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/multi-project/projects/list/src/list/ListFile.java
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/list/src/list/ListFile.java b/src/example/multi-project/projects/list/src/list/ListFile.java
index 14a28e7..3025389 100644
--- a/src/example/multi-project/projects/list/src/list/ListFile.java
+++ b/src/example/multi-project/projects/list/src/list/ListFile.java
@@ -17,23 +17,24 @@
*/
package list;
-import version.Version;
import java.util.Collection;
import java.util.ArrayList;
import java.io.File;
+import static version.Version.register;
+
public final class ListFile {
static {
- Version.register("list");
+ register("list");
}
- public static Collection list(File dir) {
- Collection files = new ArrayList();
+ public static Collection<File> list(File dir) {
+ Collection<File> files = new ArrayList<File>();
return list(dir, files);
}
- private static Collection list(File file, Collection files) {
+ private static Collection<File> list(File file, Collection<File> files) {
if (file.isDirectory()) {
for (File f : file.listFiles()) {
list(f, files);
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/multi-project/projects/list/src/list/Main.java
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/list/src/list/Main.java b/src/example/multi-project/projects/list/src/list/Main.java
index c9915b6..c45f0d9 100644
--- a/src/example/multi-project/projects/list/src/list/Main.java
+++ b/src/example/multi-project/projects/list/src/list/Main.java
@@ -18,24 +18,22 @@
package list;
import java.io.File;
-import java.util.Collection;
-import java.util.Iterator;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
-import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
-import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
public final class Main {
private static Options getOptions() {
- Option dir = OptionBuilder.withArgName("dir")
+ Option dir = Option.builder("d")
+ .longOpt("dir")
.hasArg()
- .withDescription("list files in given dir")
- .create("dir");
+ .desc("list files in given dir")
+ .build();
Options options = new Options();
options.addOption(dir);
@@ -47,12 +45,12 @@ public final class Main {
Options options = getOptions();
try {
- CommandLineParser parser = new GnuParser();
+ CommandLineParser parser = new DefaultParser();
CommandLine line = parser.parse(options, args);
- File dir = new File(line.getOptionValue("dir", "."));
+ File dir = new File(line.getOptionValue("d", "."));
System.out.println("listing files in " + dir);
- for (Object file : ListFile.list(dir)) {
+ for (File file : ListFile.list(dir)) {
System.out.println("\t" + file + "\n");
}
} catch (ParseException exp) {
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/multi-project/projects/size/ivy.xml
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/size/ivy.xml b/src/example/multi-project/projects/size/ivy.xml
index ff20d0e..b7c8591 100644
--- a/src/example/multi-project/projects/size/ivy.xml
+++ b/src/example/multi-project/projects/size/ivy.xml
@@ -14,15 +14,15 @@
"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.
+ under the License.
-->
<ivy-module version="1.0">
- <info
+ <info
organisation="org.apache.ivy.example"
module="size"
status="integration"/>
<dependencies>
- <dependency name="version" rev="latest.integration" conf="default" />
- <dependency name="list" rev="latest.integration" conf="default->core" />
+ <dependency name="version" rev="latest.integration" conf="default"/>
+ <dependency name="list" rev="latest.integration" conf="default->core"/>
</dependencies>
</ivy-module>
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/multi-project/projects/size/src/size/FileSize.java
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/size/src/size/FileSize.java b/src/example/multi-project/projects/size/src/size/FileSize.java
index c2efcf1..a6e752d 100644
--- a/src/example/multi-project/projects/size/src/size/FileSize.java
+++ b/src/example/multi-project/projects/size/src/size/FileSize.java
@@ -17,24 +17,26 @@
*/
package size;
-import version.Version;
-import java.util.Collection;
-import java.util.Iterator;
import java.io.File;
+import java.util.Collection;
+
+import static list.ListFile.list;
+import static version.Version.register;
public final class FileSize {
static {
- Version.register("size");
+ register("size");
}
+ @SuppressWarnings("unused")
public static long totalSize(File dir) {
- return totalSize(list.ListFile.list(dir));
+ return totalSize(list(dir));
}
- public static long totalSize(Collection files) {
+ public static long totalSize(Collection<File> files) {
long total = 0;
- for (Object file : files) {
- total += ((File) file).length();
+ for (File file : files) {
+ total += file.length();
}
return total;
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/multi-project/projects/sizewhere/ivy.xml
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/sizewhere/ivy.xml b/src/example/multi-project/projects/sizewhere/ivy.xml
index 344cb3f..787520d 100644
--- a/src/example/multi-project/projects/sizewhere/ivy.xml
+++ b/src/example/multi-project/projects/sizewhere/ivy.xml
@@ -14,10 +14,10 @@
"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.
+ under the License.
-->
<ivy-module version="1.0">
- <info
+ <info
organisation="org.apache.ivy.example"
module="sizewhere"
status="integration"/>
@@ -26,12 +26,12 @@
<conf name="standalone" extends="core"/>
</configurations>
<publications>
- <artifact name="sizewhere" type="jar" conf="core" />
+ <artifact name="sizewhere" type="jar" conf="core"/>
</publications>
<dependencies>
- <dependency name="version" rev="latest.integration" conf="core->default" />
- <dependency name="size" rev="latest.integration" conf="core->default" />
- <dependency name="find" rev="latest.integration" conf="core" />
- <dependency org="commons-cli" name="commons-cli" rev="1.0" conf="standalone->default" />
+ <dependency name="version" rev="latest.integration" conf="core->default"/>
+ <dependency name="size" rev="latest.integration" conf="core->default"/>
+ <dependency name="find" rev="latest.integration" conf="core"/>
+ <dependency org="commons-cli" name="commons-cli" rev="1.4" conf="standalone->default"/>
</dependencies>
</ivy-module>
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/multi-project/projects/sizewhere/src/sizewhere/Main.java
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/sizewhere/src/sizewhere/Main.java b/src/example/multi-project/projects/sizewhere/src/sizewhere/Main.java
index dc2a996..a2509e3 100644
--- a/src/example/multi-project/projects/sizewhere/src/sizewhere/Main.java
+++ b/src/example/multi-project/projects/sizewhere/src/sizewhere/Main.java
@@ -17,27 +17,28 @@
*/
package sizewhere;
-import java.io.File;
-
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
-import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
-import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
+import java.io.File;
+
public final class Main {
private static Options getOptions() {
- Option dir = OptionBuilder.withArgName("dir")
+ Option dir = Option.builder("d")
+ .longOpt("dir")
.hasArg()
- .withDescription("give total size of files in given dir")
- .create("dir");
- Option name = OptionBuilder.withArgName("name")
+ .desc("give total size of files in given dir")
+ .build();
+ Option name = Option.builder("n")
+ .longOpt("name")
.hasArg()
- .withDescription("give total size of files with given name")
- .create("name");
+ .desc("give total size of files with given name")
+ .build();
Options options = new Options();
options.addOption(dir);
@@ -49,17 +50,16 @@ public final class Main {
public static void main(String[] args) throws Exception {
Options options = getOptions();
try {
-
- CommandLineParser parser = new GnuParser();
+ CommandLineParser parser = new DefaultParser();
CommandLine line = parser.parse(options, args);
- File dir = new File(line.getOptionValue("dir", "."));
- String name = line.getOptionValue("name", "jar");
+ File dir = new File(line.getOptionValue("d", "."));
+ String name = line.getOptionValue("n", "jar");
System.out.println("total size of files in " + dir
+ " containing " + name + ": " + SizeWhere.totalSize(dir, name));
} catch (ParseException exp) {
- // oops, something went wrong
- System.err.println("Parsing failed. Reason: " + exp.getMessage());
+ // oops, something went wrong
+ System.err.println("Parsing failed. Reason: " + exp.getMessage());
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp("sizewhere", options);
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/multi-project/projects/sizewhere/src/sizewhere/SizeWhere.java
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/sizewhere/src/sizewhere/SizeWhere.java b/src/example/multi-project/projects/sizewhere/src/sizewhere/SizeWhere.java
index df27f31..0b5cc62 100644
--- a/src/example/multi-project/projects/sizewhere/src/sizewhere/SizeWhere.java
+++ b/src/example/multi-project/projects/sizewhere/src/sizewhere/SizeWhere.java
@@ -17,19 +17,20 @@
*/
package sizewhere;
-import version.Version;
import size.FileSize;
-import find.FindFile;
import java.io.File;
+import static find.FindFile.find;
+import static version.Version.register;
+
public final class SizeWhere {
static {
- Version.register("sizewhere");
+ register("sizewhere");
}
public static long totalSize(File dir, String name) {
- return FileSize.totalSize(FindFile.find(dir, name));
+ return FileSize.totalSize(find(dir, name));
}
private SizeWhere() {
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/multi-project/projects/version/ivy.xml
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/version/ivy.xml b/src/example/multi-project/projects/version/ivy.xml
index 7a29b46..e3e2b14 100644
--- a/src/example/multi-project/projects/version/ivy.xml
+++ b/src/example/multi-project/projects/version/ivy.xml
@@ -14,10 +14,10 @@
"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.
+ under the License.
-->
<ivy-module version="1.0">
- <info
+ <info
organisation="org.apache.ivy.example"
module="version"
status="integration"/>
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/src/example/multi-project/projects/version/src/version/Version.java
----------------------------------------------------------------------
diff --git a/src/example/multi-project/projects/version/src/version/Version.java b/src/example/multi-project/projects/version/src/version/Version.java
index 9c9a605..9c34c32 100644
--- a/src/example/multi-project/projects/version/src/version/Version.java
+++ b/src/example/multi-project/projects/version/src/version/Version.java
@@ -24,11 +24,11 @@ import java.util.HashMap;
public final class Version {
static {
- versions = new HashMap();
+ versions = new HashMap<>();
register("version");
}
- private static Map versions;
+ private static Map<String, String> versions;
public static void register(String module) {
try {
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/test/java/org/apache/ivy/ant/AntCallTriggerTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/AntCallTriggerTest.java b/test/java/org/apache/ivy/ant/AntCallTriggerTest.java
index d1f79c7..f92a714 100644
--- a/test/java/org/apache/ivy/ant/AntCallTriggerTest.java
+++ b/test/java/org/apache/ivy/ant/AntCallTriggerTest.java
@@ -149,12 +149,9 @@ public class AntCallTriggerTest {
System.setErr(err);
System.setIn(in);
}
- } catch (RuntimeException exc) {
+ } catch (RuntimeException | Error exc) {
error = exc;
throw exc;
- } catch (Error err) {
- error = err;
- throw err;
} finally {
project.fireBuildFinished(error);
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/test/java/org/apache/ivy/ant/BuildOBRTaskTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/BuildOBRTaskTest.java b/test/java/org/apache/ivy/ant/BuildOBRTaskTest.java
index 7451bd3..95eb9a9 100644
--- a/test/java/org/apache/ivy/ant/BuildOBRTaskTest.java
+++ b/test/java/org/apache/ivy/ant/BuildOBRTaskTest.java
@@ -63,11 +63,8 @@ public class BuildOBRTaskTest {
private BundleRepoDescriptor readObr(File obrFile) throws IOException, SAXException {
BundleRepoDescriptor obr;
- FileInputStream in = new FileInputStream(obrFile);
- try {
+ try (FileInputStream in = new FileInputStream(obrFile)) {
obr = OBRXMLParser.parse(obrFile.toURI(), in);
- } finally {
- in.close();
}
return obr;
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/test/java/org/apache/ivy/ant/FixDepsTaskTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/FixDepsTaskTest.java b/test/java/org/apache/ivy/ant/FixDepsTaskTest.java
index 8811348..0223fed 100644
--- a/test/java/org/apache/ivy/ant/FixDepsTaskTest.java
+++ b/test/java/org/apache/ivy/ant/FixDepsTaskTest.java
@@ -217,7 +217,7 @@ public class FixDepsTaskTest {
}
private List<String> toString(List<DependencyDescriptor> list) {
- List<String> strings = new ArrayList<String>(list.size());
+ List<String> strings = new ArrayList<>(list.size());
for (DependencyDescriptor dd : list) {
strings.add(dd.toString());
}
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/test/java/org/apache/ivy/ant/IvyDeliverTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/ant/IvyDeliverTest.java b/test/java/org/apache/ivy/ant/IvyDeliverTest.java
index 881b971..0e94d4d 100644
--- a/test/java/org/apache/ivy/ant/IvyDeliverTest.java
+++ b/test/java/org/apache/ivy/ant/IvyDeliverTest.java
@@ -133,28 +133,23 @@ public class IvyDeliverTest {
// we could do a better job of this with xmlunit
int lineNo = 1;
- BufferedReader merged = new BufferedReader(new FileReader(delivered));
- BufferedReader expected = new BufferedReader(new InputStreamReader(getClass()
- .getResourceAsStream("ivy-extends-merged.xml")));
- try {
- 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());
- }
-
- ++lineNo;
- }
- } finally {
- merged.close();
- expected.close();
- }
+ try (BufferedReader merged = new BufferedReader(new FileReader(delivered));
+ BufferedReader expected = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream("ivy-extends-merged.xml")))) {
+ 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());
+ }
+
+ ++lineNo;
+ }
+ }
}
@Test
@@ -385,7 +380,7 @@ public class IvyDeliverTest {
md.getModuleRevisionId());
DependencyDescriptor[] dds = md.getDependencies();
assertEquals(1, dds.length);
- Map<String, String> extraAtt = new HashMap<String, String>();
+ Map<String, String> extraAtt = new HashMap<>();
extraAtt.put("myExtraAtt", "myValue");
assertEquals(ModuleRevisionId.newInstance("org1", "mod1.2", "2.2", extraAtt),
dds[0].getDependencyRevisionId());
@@ -423,8 +418,8 @@ public class IvyDeliverTest {
File list = new File("build/test/retrieve");
String[] files = list.list();
- HashSet<String> actualFileSet = new HashSet<String>(Arrays.asList(files));
- HashSet<String> expectedFileSet = new HashSet<String>();
+ HashSet<String> actualFileSet = new HashSet<>(Arrays.asList(files));
+ HashSet<String> expectedFileSet = new HashSet<>();
for (DependencyDescriptor dd : dds) {
String name = dd.getDependencyId().getName();
String rev = dd.getDependencyRevisionId().getRevision();
@@ -470,8 +465,8 @@ public class IvyDeliverTest {
File list = new File("build/test/retrieve");
String[] files = list.list();
- HashSet<String> actualFileSet = new HashSet<String>(Arrays.asList(files));
- HashSet<String> expectedFileSet = new HashSet<String>();
+ HashSet<String> actualFileSet = new HashSet<>(Arrays.asList(files));
+ HashSet<String> expectedFileSet = new HashSet<>();
for (DependencyDescriptor dd : dds) {
String name = dd.getDependencyId().getName();
String rev = dd.getDependencyRevisionId().getRevision();
http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/fb3ccf60/test/java/org/apache/ivy/core/module/id/ModuleIdTest.java
----------------------------------------------------------------------
diff --git a/test/java/org/apache/ivy/core/module/id/ModuleIdTest.java b/test/java/org/apache/ivy/core/module/id/ModuleIdTest.java
index 6adc823..a1de1db 100644
--- a/test/java/org/apache/ivy/core/module/id/ModuleIdTest.java
+++ b/test/java/org/apache/ivy/core/module/id/ModuleIdTest.java
@@ -70,6 +70,7 @@ public class ModuleIdTest {
ModuleId moduleId2 = new ModuleId(null, name);
assertNotNull(moduleId);
+ assertFalse(moduleId.equals(null));
assertFalse(moduleId.equals(moduleId2));
assertFalse(moduleId2.equals(moduleId));
}