diff --git a/pom.xml b/pom.xml index 902cc6a..f7e3577 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.nordstrom.tools java-utils - 3.4.1 + 3.4.2-SNAPSHOT jar Java Utils @@ -31,13 +31,13 @@ 1.3.15 2.0.17 7.5.1 - 3.10.1 - 3.0.0-M7 - 3.2.1 - 3.4.0 - 3.0.1 - 1.6.13 - 3.0.0-M6 + 3.14.0 + 3.5.3 + 3.3.1 + 3.11.2 + 3.2.8 + 1.7.0 + 3.1.1 10.14.2.0 true @@ -46,126 +46,62 @@ scm:git:https://github.com/sbabcoc/Java-Utils.git scm:git:https://github.com/sbabcoc/Java-Utils.git https://github.com/sbabcoc/Java-Utils/tree/master - java-utils-3.4.1 + HEAD ossrh - https://s01.oss.sonatype.org/content/repositories/snapshots + >https://ossrh-staging-api.central.sonatype.com/content/repositories/snapshots ossrh - https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ + https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/ - - - - ch.qos.logback - logback-classic - ${logback.version} - - - ch.qos.logback - logback-core - ${logback.version} - - - org.slf4j - slf4j-api - ${slf4j.version} - - - org.testng - testng - ${testng.version} - - - org.apache.derby - derby - ${apache-derby.version} - - - - ch.qos.logback logback-classic + ${logback.version} test ch.qos.logback logback-core + ${logback.version} test org.slf4j slf4j-api + ${slf4j.version} test org.testng testng + ${testng.version} test org.apache.derby derby + ${apache-derby.version} test - - - - org.apache.maven.plugins - maven-compiler-plugin - ${compiler-plugin.version} - - - org.apache.maven.plugins - maven-surefire-plugin - ${surefire-plugin.version} - - - org.apache.maven.plugins - maven-source-plugin - ${source-plugin.version} - - - org.apache.maven.plugins - maven-javadoc-plugin - ${javadoc-plugin.version} - - - org.apache.maven.plugins - maven-gpg-plugin - ${gpg-plugin.version} - - - org.sonatype.plugins - nexus-staging-maven-plugin - ${staging-plugin.version} - - - org.apache.maven.plugins - maven-release-plugin - ${release-plugin.version} - - - - org.apache.maven.plugins maven-compiler-plugin + ${compiler-plugin.version} - org.apache.maven.plugins maven-surefire-plugin + ${surefire-plugin.version} ${maven.compiler.release} @@ -173,8 +109,8 @@ - org.apache.maven.plugins maven-source-plugin + ${source-plugin.version} attach-sources @@ -185,8 +121,8 @@ - org.apache.maven.plugins maven-javadoc-plugin + ${javadoc-plugin.version} attach-javadocs @@ -197,8 +133,8 @@ - org.apache.maven.plugins maven-gpg-plugin + ${gpg-plugin.version} sign-artifacts @@ -217,16 +153,24 @@ org.sonatype.plugins nexus-staging-maven-plugin + ${staging-plugin.version} true + + + io.github.x-stream + mxparser + 1.2.1 + + ossrh - https://s01.oss.sonatype.org/ + https://ossrh-staging-api.central.sonatype.com/ true - org.apache.maven.plugins maven-release-plugin + ${release-plugin.version} true false diff --git a/src/main/java/com/nordstrom/common/base/StackTrace.java b/src/main/java/com/nordstrom/common/base/StackTrace.java index f264434..737470b 100644 --- a/src/main/java/com/nordstrom/common/base/StackTrace.java +++ b/src/main/java/com/nordstrom/common/base/StackTrace.java @@ -4,27 +4,46 @@ * Throwable created purely for the purposes of reporting a stack trace. * * This is not an Error or an Exception and is not expected to be thrown or caught. - * This blog post provided the - * original implementation. + * This blog post + * provided the original implementation. * @author Peter K Lawrey */ - public class StackTrace extends Throwable { private static final long serialVersionUID = -3623586250962214453L; + /** + * Constructor for StackTrace with default message ("stack trace") + */ public StackTrace() { this("stack trace"); } + /** + * Constructor for StackTrace with specified message. + * + * @param message stack trace message + */ public StackTrace(String message) { this(message, null); } + /** + * Constructor for StackTrace with specified message and cause. + * + * @param message stack trace message + * @param cause stack trace cause + */ public StackTrace(String message, Throwable cause) { super(message + " on " + Thread.currentThread().getName(), cause); } + /** + * Static factory to capture a stack trace for the specified thread. + * + * @param t thread for which stack trace should be captured + * @return {@link StackTrace} object with a string representing the thread as its message + */ public static StackTrace forThread(Thread t) { if (t == null) return null; diff --git a/src/main/java/com/nordstrom/common/clazz/CustomClassLoader.java b/src/main/java/com/nordstrom/common/clazz/CustomClassLoader.java index 3ffbf18..4f634ff 100644 --- a/src/main/java/com/nordstrom/common/clazz/CustomClassLoader.java +++ b/src/main/java/com/nordstrom/common/clazz/CustomClassLoader.java @@ -16,6 +16,11 @@ public class CustomClassLoader extends ClassLoader { private final URL[] pathUrls; + /** + * Constructor for CustomClassLoader instances. + * + * @param classpath class path for this class loader + */ public CustomClassLoader(String classpath) { pathUrls = Arrays.stream(classpath.split(File.pathSeparator)).map(entry -> { try { diff --git a/src/main/java/com/nordstrom/common/file/OSInfo.java b/src/main/java/com/nordstrom/common/file/OSInfo.java index 0bee130..3eaacb1 100644 --- a/src/main/java/com/nordstrom/common/file/OSInfo.java +++ b/src/main/java/com/nordstrom/common/file/OSInfo.java @@ -132,9 +132,28 @@ public static String arch() { * This enumeration defines the default set of operating system mappings. */ public enum OSType implements OSProps { + /** + * OS type: Windows
+ * pattern: (?i).*win.* + */ WINDOWS("(?i).*win.*"), + + /** + * OS type: Macintosh
+ * pattern: (?i).*mac.* + */ MACINTOSH("(?i).*mac.*"), + + /** + * OS type: Unix
+ * pattern: (?i).*(?:nix|nux|aix).* + */ UNIX("(?i).*(?:nix|nux|aix).*"), + + /** + * OS type: Solaris
+ * pattern: (?i).*sunos.* + */ SOLARIS("(?i).*sunos.*"); OSType(String pattern) { diff --git a/src/main/java/com/nordstrom/common/file/PathUtils.java b/src/main/java/com/nordstrom/common/file/PathUtils.java index 229ddbd..1e93fe1 100644 --- a/src/main/java/com/nordstrom/common/file/PathUtils.java +++ b/src/main/java/com/nordstrom/common/file/PathUtils.java @@ -70,14 +70,60 @@ private PathUtils() { * This enumeration contains methods to help build proxy subclass names and select reports directories. */ public enum ReportsDirectory { - + /** + * SureFire test class pattern #1
+ * pattern: (Test)(.*)
+ * folder: surefire-reports + */ SUREFIRE_1("(Test)(.*)", SUREFIRE_PATH), + + /** + * SureFire test class pattern #2
+ * pattern: (.*)(Test)
+ * folder: surefire-reports + */ SUREFIRE_2("(.*)(Test)", SUREFIRE_PATH), + + /** + * SureFire test class pattern #3
+ * pattern: (.*)(Tests)
+ * folder: surefire-reports + */ SUREFIRE_3("(.*)(Tests)", SUREFIRE_PATH), + + /** + * SureFire test class pattern #4
+ * pattern: (.*)(TestCase)
+ * folder: surefire-reports + */ SUREFIRE_4("(.*)(TestCase)", SUREFIRE_PATH), + + /** + * FailSafe test class pattern #1
+ * pattern: (IT)(.*)
+ * folder: failsafe-reports + */ FAILSAFE_1("(IT)(.*)", FAILSAFE_PATH), + + /** + * FailSafe test class pattern #2
+ * pattern: (.*)(IT)
+ * folder: failsafe-reports + */ FAILSAFE_2("(.*)(IT)", FAILSAFE_PATH), + + /** + * FailSafe test class pattern #3
+ * pattern: (.*)(ITCase)
+ * folder: failsafe-reports + */ FAILSAFE_3("(.*)(ITCase)", FAILSAFE_PATH), + + /** + * Artifact test class pattern
+ * pattern: .*
+ * folder: artifact-capture + */ ARTIFACT(".*", "artifact-capture"); private final String regex; diff --git a/src/main/java/com/nordstrom/common/file/VolumeInfo.java b/src/main/java/com/nordstrom/common/file/VolumeInfo.java index 181dc37..b071381 100644 --- a/src/main/java/com/nordstrom/common/file/VolumeInfo.java +++ b/src/main/java/com/nordstrom/common/file/VolumeInfo.java @@ -74,6 +74,9 @@ public static Map getVolumeProps(InputStream is) throws IOE return propsList; } + /** + * This class defines a volume property record. + */ public static class VolumeProps { String file; @@ -83,6 +86,14 @@ public static class VolumeProps { private final long size; private long free; + /** + * Constructor for VolumeProps instances. + * + * @param spec device specification + * @param file mount point + * @param type file system type + * @param opts mount options + */ VolumeProps(String spec, String file, String type, String... opts) { if (IS_WINDOWS) { this.file = spec; @@ -98,21 +109,47 @@ public static class VolumeProps { this.free = f.getFreeSpace(); } + /** + * Get the volume device [Unix] or mount point [Windows]. + * + * @return volume device / mount point + */ public String getFile() { return file; } + /** + * Get volume device type. + * + * @return volume device type + */ public String getType() { return type; } + /** + * Get volume options. + * + * @return volume options + */ public String[] getOpts() { return opts; } + /** + * Get volume total space. + * + * @return volume total space + */ public long getSize() { return size; } + + /** + * Get volume free space. + * + * @return volume free space + */ public long getFree() { return free; } diff --git a/src/main/java/com/nordstrom/common/jdbc/DatabaseUtils.java b/src/main/java/com/nordstrom/common/jdbc/DatabaseUtils.java index bf7dc31..59325e6 100644 --- a/src/main/java/com/nordstrom/common/jdbc/DatabaseUtils.java +++ b/src/main/java/com/nordstrom/common/jdbc/DatabaseUtils.java @@ -863,14 +863,39 @@ private ResultPackage(Connection connection, PreparedStatement statement, Result this.resultSet = resultSet; } + /** + * Get connection of this result package. + * + * @return result package {@link Connection} object + */ public Connection getConnection() { return connection; } + /** + * Get statement of this result package. + * + * @return result package {@link PreparedStatement} object + */ public PreparedStatement getStatement() { return statement; } + /** + * Determine if statement of this result package is 'callable'. + * + * @return {@code true} if statement is 'callable'; otherwise {@code false} + */ + public boolean isCallable() { + return statement instanceof CallableStatement; + } + + /** + * Get statement of this result package as a 'callable' object. + * + * @return statement of this result package as a {@link CallableStatement} object + * @throws UnsupportedOperationException if package statement is not 'callable' + */ public CallableStatement getCallable() { if (statement instanceof CallableStatement) { return (CallableStatement) statement; @@ -879,7 +904,7 @@ public CallableStatement getCallable() { } /** - * Get the result set object of this package. + * Get the result set object of this result package. * * @return {@link ResultSet} object */ diff --git a/src/main/java/com/nordstrom/common/uri/UriUtils.java b/src/main/java/com/nordstrom/common/uri/UriUtils.java index f58ba77..cdd639c 100644 --- a/src/main/java/com/nordstrom/common/uri/UriUtils.java +++ b/src/main/java/com/nordstrom/common/uri/UriUtils.java @@ -8,6 +8,11 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; +/** + * This utility class provides static methods that simplify the assembly of {@link URI} objects. + * These methods handle the {@link URISyntaxException} for you, and they also handle the task of + * URL-encoding query parameter keys and values. + */ public class UriUtils { private UriUtils() {