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:21 UTC
[04/11] ant-ivy git commit: More generics…
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",