Remove main() in tests, optimise target dependencies in build.xml and address diverse Checkstyle warnings
Project: http://git-wip-us.apache.org/repos/asf/ant-ivy/repo Commit: http://git-wip-us.apache.org/repos/asf/ant-ivy/commit/a9880a18 Tree: http://git-wip-us.apache.org/repos/asf/ant-ivy/tree/a9880a18 Diff: http://git-wip-us.apache.org/repos/asf/ant-ivy/diff/a9880a18 Branch: refs/heads/master Commit: a9880a18fe1c30ede7b409093dbc4b5c24042d33 Parents: 7d45286 Author: twogee <g.grigelio...@gmail.com> Authored: Mon Jun 5 23:05:35 2017 +0200 Committer: twogee <g.grigelio...@gmail.com> Committed: Mon Jun 5 23:05:35 2017 +0200 ---------------------------------------------------------------------- build.xml | 13 +++++++++---- .../org/apache/ivy/plugins/lock/DeleteOnExitHook.java | 2 +- src/java/org/apache/ivy/util/DateUtil.java | 2 +- src/java/org/apache/ivy/util/EncryptedProperties.java | 1 + src/java/org/apache/ivy/util/EncrytedProperties.java | 2 +- test/java/org/apache/ivy/core/TestPerformance.java | 7 ------- .../descriptor/DefaultDependencyDescriptorTest.java | 5 ----- .../ivy/core/settings/XmlSettingsParserTest.java | 9 +++++---- 8 files changed, 18 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/a9880a18/build.xml ---------------------------------------------------------------------- diff --git a/build.xml b/build.xml index 1f14e05..4529899 100644 --- a/build.xml +++ b/build.xml @@ -49,13 +49,13 @@ <ivy:configure override="true"/> </target> - <target name="install" depends="init-ivy-home,jar" + <target name="install" depends="jar" description="build Ivy and install it in Ivy user home for builds using Ivy user home to load Ivy jar"> <property name="ivy.jar.file" value="${ivy.home}/jars/ivy.jar"/> <copy file="${artifacts.build.dir}/jars/${final.name}" tofile="${ivy.jar.file}"/> </target> - <target name="install-ant" depends="init-ivy-home,jar" + <target name="install-ant" depends="jar" description="build Ivy and install it in Ant home lib"> <condition property="ant.home" value="${env.ANT_HOME}"> <isset property="env.ANT_HOME"/> @@ -262,7 +262,7 @@ todir="${ant.classes.build.dir}/fr/jayasoft/ivy/ant"/> </target> - <target name="compile-optional" depends="compile-ant,resolve"> + <target name="compile-optional" depends="compile-ant"> <javac srcdir="${src.dir}" destdir="${optional.classes.build.dir}" sourcepath="" @@ -456,6 +456,11 @@ message="At least one test has failed. See logs (in ${test.xml.dir}) for details (use the target test-report to run the test with a report)"/> </target> + <target name="check-ibiblio" depends="build-test"> + <java classname="org.apache.ivy.plugins.resolver.IBiblioHelper" + classpathref="test.classpath"/> + </target> + <!-- ================================================================= REPORTS AND DOCUMENTATION ================================================================= --> @@ -550,7 +555,7 @@ <taskdef uri="antlib:com.puppycrawl.tools.checkstyle.ant" resource="com/puppycrawl/tools/checkstyle/ant/antlib.xml" classpathref="checkstyle.classpath"/> </target> - + <!-- Checks Ivy codebase according to ${checkstyle.src.dir}/checkstyle-config --> <target name="checkstyle-internal" depends="init-checkstyle"> <mkdir dir="${checkstyle.report.dir}"/> http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/a9880a18/src/java/org/apache/ivy/plugins/lock/DeleteOnExitHook.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/ivy/plugins/lock/DeleteOnExitHook.java b/src/java/org/apache/ivy/plugins/lock/DeleteOnExitHook.java index bb86970..ea3fe40 100644 --- a/src/java/org/apache/ivy/plugins/lock/DeleteOnExitHook.java +++ b/src/java/org/apache/ivy/plugins/lock/DeleteOnExitHook.java @@ -21,7 +21,7 @@ import java.io.File; import java.util.Iterator; import java.util.LinkedHashSet; -class DeleteOnExitHook { +final class DeleteOnExitHook { static { Runtime.getRuntime().addShutdownHook(new Thread() { http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/a9880a18/src/java/org/apache/ivy/util/DateUtil.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/ivy/util/DateUtil.java b/src/java/org/apache/ivy/util/DateUtil.java index fe66e1d..1190b6b 100644 --- a/src/java/org/apache/ivy/util/DateUtil.java +++ b/src/java/org/apache/ivy/util/DateUtil.java @@ -21,7 +21,7 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; -public class DateUtil { +public final class DateUtil { private DateUtil() { // Utility class http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/a9880a18/src/java/org/apache/ivy/util/EncryptedProperties.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/ivy/util/EncryptedProperties.java b/src/java/org/apache/ivy/util/EncryptedProperties.java index cbed952..2644372 100644 --- a/src/java/org/apache/ivy/util/EncryptedProperties.java +++ b/src/java/org/apache/ivy/util/EncryptedProperties.java @@ -29,6 +29,7 @@ import java.util.Properties; * putAll puts given values without encrypting them. It this thus recommended to void using them, * use setProperty and getProperty instead. */ +@SuppressWarnings("serial") public class EncryptedProperties extends Properties { public EncryptedProperties() { http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/a9880a18/src/java/org/apache/ivy/util/EncrytedProperties.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/ivy/util/EncrytedProperties.java b/src/java/org/apache/ivy/util/EncrytedProperties.java index 3242de5..a2a998d 100644 --- a/src/java/org/apache/ivy/util/EncrytedProperties.java +++ b/src/java/org/apache/ivy/util/EncrytedProperties.java @@ -17,10 +17,10 @@ */ package org.apache.ivy.util; - /** * Deprecated because of renaming due spell check. */ +@SuppressWarnings("serial") @Deprecated public class EncrytedProperties extends EncryptedProperties { } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/a9880a18/test/java/org/apache/ivy/core/TestPerformance.java ---------------------------------------------------------------------- diff --git a/test/java/org/apache/ivy/core/TestPerformance.java b/test/java/org/apache/ivy/core/TestPerformance.java index 29a9176..64ea1df 100644 --- a/test/java/org/apache/ivy/core/TestPerformance.java +++ b/test/java/org/apache/ivy/core/TestPerformance.java @@ -140,11 +140,4 @@ public class TestPerformance { private ResolveOptions getResolveOptions(String[] confs) { return new ResolveOptions().setConfs(confs); } - - public static void main(String[] args) throws Exception { - TestPerformance t = new TestPerformance(); - t.setUp(); - t.testPerfs(); - t.tearDown(); - } } http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/a9880a18/test/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptorTest.java ---------------------------------------------------------------------- diff --git a/test/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptorTest.java b/test/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptorTest.java index d89813d..099d996 100644 --- a/test/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptorTest.java +++ b/test/java/org/apache/ivy/core/module/descriptor/DefaultDependencyDescriptorTest.java @@ -19,17 +19,12 @@ package org.apache.ivy.core.module.descriptor; import org.junit.Test; -import org.junit.runner.JUnitCore; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; public class DefaultDependencyDescriptorTest { - public static void main(String[] args) { - JUnitCore.runClasses(DefaultDependencyDescriptorTest.class); - } - /* * Test method for * 'org.apache.ivy.DefaultDependencyDescriptor.replaceSelfFallbackPattern(String, String)' http://git-wip-us.apache.org/repos/asf/ant-ivy/blob/a9880a18/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java ---------------------------------------------------------------------- diff --git a/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java b/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java index 6bbd885..e3db042 100644 --- a/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java +++ b/test/java/org/apache/ivy/core/settings/XmlSettingsParserTest.java @@ -17,13 +17,17 @@ */ package org.apache.ivy.core.settings; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + import java.io.File; import java.io.IOException; import java.text.ParseException; import java.util.List; import org.apache.ivy.core.cache.DefaultRepositoryCacheManager; -import org.apache.ivy.core.cache.RepositoryCacheManager; import org.apache.ivy.core.cache.ResolutionCacheManager; import org.apache.ivy.core.module.descriptor.Artifact; import org.apache.ivy.core.module.id.ModuleId; @@ -47,13 +51,10 @@ import org.apache.ivy.plugins.resolver.packager.PackagerResolver; import org.apache.ivy.plugins.version.ChainVersionMatcher; import org.apache.ivy.plugins.version.MockVersionMatcher; import org.apache.ivy.plugins.version.VersionMatcher; - import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import static org.junit.Assert.*; - /** * TODO write javadoc */